1 | # -*- coding: utf-8 -*- |
---|
2 | import codecs, filecmp, os, subprocess, sys |
---|
3 | |
---|
4 | def main(): |
---|
5 | startApplication("sasview") |
---|
6 | mouseClick(waitForObject(":MainWindow.Data Explorer_QWorkspace"), 676, 556, 0, Qt.LeftButton) |
---|
7 | mouseClick(waitForObject(":groupBox_6.cbCategory_QComboBox_2"), 83, 13, 0, Qt.LeftButton) |
---|
8 | mouseClick(waitForObjectItem(":groupBox_6.cbCategory_QComboBox_2", "Cylinder"), 79, 6, 0, Qt.LeftButton) |
---|
9 | clickButton(waitForObject(":FittingWidgetUI.cmdPlot_QPushButton_2")) |
---|
10 | snooze(1) |
---|
11 | clickButton(waitForObject(":FittingWidgetUI.cmdPlot_QPushButton_2")) |
---|
12 | snooze(2) |
---|
13 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 287, 212, 0) |
---|
14 | activateItem(waitForObjectItem(":MainWindow_QMenu", "Save Image")) |
---|
15 | test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentIndex, 4) |
---|
16 | test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").count, 9) |
---|
17 | test.compare(str(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentText), "Portable Network Graphics (*.png)") |
---|
18 | test.compare(waitForObjectExists(":qt_workspacechild.Save_QPushButton").visible, True) |
---|
19 | test.compare(waitForObjectExists(":qt_workspacechild.Save_QPushButton").default, True) |
---|
20 | test.compare(str(waitForObjectExists(":qt_workspacechild.Save_QPushButton").text), "&Save") |
---|
21 | test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").displayText), "image.png") |
---|
22 | test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "image.png") |
---|
23 | clickButton(waitForObject(":qt_workspacechild.Save_QPushButton")) |
---|
24 | snooze(1) |
---|
25 | pngfile = os.path.join(os.path.expanduser('~'), 'image.png') |
---|
26 | test.verify(os.path.exists(pngfile), "PNG file saved correctly") |
---|
27 | os.remove(pngfile) |
---|
28 | |
---|
29 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg_2"), QEvent.MouseButtonPress, 153, 294, Qt.RightButton, 2, 0) |
---|
30 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), QEvent.MouseButtonRelease, 153, 294, Qt.RightButton, 0, 0) |
---|
31 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 153, 294, 0) |
---|
32 | activateItem(waitForObjectItem(":MainWindow_QMenu", "Save Image")) |
---|
33 | mouseClick(waitForObject(":QFileDialog.fileTypeCombo_QComboBox"), 304, 7, 0, Qt.LeftButton) |
---|
34 | mouseClick(waitForObjectItem(":QFileDialog.fileTypeCombo_QComboBox", "Encapsulated Postscript (*\\.eps)"), 299, 7, 0, Qt.LeftButton) |
---|
35 | clickButton(waitForObject(":qt_workspacechild.Save_QPushButton")) |
---|
36 | snooze(1) |
---|
37 | epsfile = os.path.join(os.path.expanduser('~'), 'image.eps') |
---|
38 | test.verify(os.path.exists(epsfile), "EPS file saved correctly") |
---|
39 | os.remove(epsfile) |
---|
40 | |
---|
41 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg_2"), QEvent.MouseButtonPress, 138, 298, Qt.RightButton, 2, 0) |
---|
42 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), QEvent.MouseButtonRelease, 138, 298, Qt.RightButton, 0, 0) |
---|
43 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 138, 298, 0) |
---|
44 | activateItem(waitForObjectItem(":MainWindow_QMenu", "Save Image")) |
---|
45 | mouseClick(waitForObject(":QFileDialog.fileTypeCombo_QComboBox"), 333, 8, 0, Qt.LeftButton) |
---|
46 | mouseClick(waitForObjectItem(":QFileDialog.fileTypeCombo_QComboBox", "Joint Photographic Experts Group (*\\.jpeg *\\.jpg)"), 335, 10, 0, Qt.LeftButton) |
---|
47 | clickButton(waitForObject(":qt_workspacechild.Save_QPushButton")) |
---|
48 | snooze(1) |
---|
49 | jpgfile = os.path.join(os.path.expanduser('~'), 'image.jpeg') |
---|
50 | test.verify(os.path.exists(jpgfile), "JPEG file saved correctly") |
---|
51 | os.remove(jpgfile) |
---|