File: test_exporter_dialog.py

package info (click to toggle)
python-pyqtgraph 0.13.7-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,072 kB
  • sloc: python: 54,043; makefile: 127; ansic: 40; sh: 2
file content (27 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import pyqtgraph as pg

from tests.ui_testing import mouseClick


app = pg.mkQApp()


def test_export_dialog():
    plt = pg.PlotWidget()
    y1 = [1,3,2,3,1,6,9,8,4,2]
    plt.plot(y=y1)
    plt.show()

    # # export dialog doesn't exist
    assert plt.scene().exportDialog is None      
    mouseClick(
        plt,
        pos=pg.Qt.QtCore.QPointF(plt.mapFromGlobal(plt.geometry().center())),
        button=pg.Qt.QtCore.Qt.MouseButton.RightButton
    )
    plt.scene().contextMenu[0].trigger() # show show dialog
    plt.scene().showExportDialog()
    assert plt.scene().exportDialog.isVisible()
    plt.scene().exportDialog.close()
    app.processEvents()
    plt.close()