source: sasview/src/sas/qtgui/UnitTesting/SquishTestSuites/suite_sasview_qt/tst_Plot1D_ContextMenu/test.py

ESS_GUI
Last change on this file was d6b234b, checked in by Piotr Rozyczko <rozyczko@…>, 7 years ago

Cleanup after merge (removed sasview/sasview)

  • Property mode set to 100755
File size: 5.0 KB
Line 
1# -*- coding: utf-8 -*-
2
3def main():
4    startApplication("sasview")
5    clickButton(waitForObject(":groupBox.cmdLoad_QPushButton"))
6    waitForObjectItem(":stackedWidget.listView_QListView", "test")
7    doubleClickItem(":stackedWidget.listView_QListView", "test", 58, 14, 0, Qt.LeftButton)
8    waitForObjectItem(":stackedWidget.listView_QListView", "1d\\_data")
9    doubleClickItem(":stackedWidget.listView_QListView", "1d\\_data", 51, 7, 0, Qt.LeftButton)
10    waitForObjectItem(":stackedWidget.listView_QListView", "cyl\\_400\\_20\\.txt")
11    doubleClickItem(":stackedWidget.listView_QListView", "cyl\\_400\\_20\\.txt", 73, 10, 0, Qt.LeftButton)
12    clickButton(waitForObject(":groupBox.cmdSendTo_QPushButton"))
13    clickButton(waitForObject(":groupBox_3.cmdNew_QPushButton"))
14    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 131, 224, 0)
15    activateItem(waitForObjectItem(":MainWindow_QMenu", "Save Image"))
16    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True)
17    test.compare(str(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle), "Choose a filename to save to")
18    test.compare(waitForObjectExists(":fileNameEdit_QLineEdit").visible, True)
19    test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "image.png")
20    mouseClick(waitForObject(":QFileDialog.fileTypeCombo_QComboBox"), 461, 12, 0, Qt.LeftButton)
21    mouseClick(waitForObjectItem(":QFileDialog.fileTypeCombo_QComboBox", "Encapsulated Postscript (*\\.eps)"), 436, 9, 0, Qt.LeftButton)
22    test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "image.eps")
23    mouseClick(waitForObject(":QFileDialog.fileTypeCombo_QComboBox"), 423, 6, 0, Qt.LeftButton)
24    mouseClick(waitForObjectItem(":QFileDialog.fileTypeCombo_QComboBox", "Joint Photographic Experts Group (*\\.jpeg *\\.jpg)"), 364, 4, 0, Qt.LeftButton)
25    test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "image.jpeg")
26    sendEvent("QCloseEvent", waitForObject(":QFileDialog_QFileDialog"))
27    #openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 162, 232, 0)
28    #activateItem(waitForObjectItem(":MainWindow_QMenu", "Print Image"))
29    #clickButton(waitForObject(":Print.Cancel_Button"))
30    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 290, 296, 0)
31    activateItem(waitForObjectItem(":MainWindow_QMenu", "Add Text"))
32    test.compare(waitForObjectExists(":AddText_AddText").visible, True)
33    test.compare(str(waitForObjectExists(":AddText_AddText").windowTitle), "Add Text")
34    test.compare(str(waitForObjectExists(":groupBox.textEdit_QTextEdit").html), "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\np, li { white-space: pre-wrap; }\n</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>")
35    sendEvent("QCloseEvent", waitForObject(":AddText_AddText"))
36    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 211, 271, 0)
37    activateItem(waitForObjectItem(":MainWindow_QMenu", "Add Text"))
38    type(waitForObject(":groupBox.textEdit_QTextEdit"), "test")
39    clickButton(waitForObject(":qt_workspacechild.OK_QPushButton"))
40    test.vp("VP1")
41    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 169, 327, 0)
42    activateItem(waitForObjectItem(":MainWindow_QMenu", "Remove Text"))
43    test.vp("VP2")
44    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 276, 287, 0)
45    activateItem(waitForObjectItem(":MainWindow_QMenu", "Change Scale"))
46    test.compare(str(waitForObjectExists(":scalePropertiesUI_ScaleProperties").windowTitle), "Scale Properties")
47    test.compare(waitForObjectExists(":scalePropertiesUI_ScaleProperties").visible, True)
48    clickButton(waitForObject(":qt_workspacechild.Cancel_QPushButton_2"))
49    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 182, 346, 0)
50    activateItem(waitForObjectItem(":MainWindow_QMenu", "Set Graph Range"))
51    test.compare(waitForObjectExists(":setGraphRangeUI_SetGraphRange").visible, True)
52    test.compare(str(waitForObjectExists(":setGraphRangeUI_SetGraphRange").windowTitle), "Set Graph Range")
53    clickButton(waitForObject(":setGraphRangeUI.Cancel_QPushButton"))
54    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 186, 366, 0)
55    activateItem(waitForObjectItem(":MainWindow_QMenu", "Reset Graph Range"))
56    openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 178, 349, 0)
57    activateItem(waitForObjectItem(":MainWindow_QMenu", "Window Title"))
58    test.compare(waitForObjectExists(":WindowTitle_WindowTitle").visible, True)
59    test.compare(str(waitForObjectExists(":WindowTitle_WindowTitle").windowTitle), "Modify Window Title")
60    clickButton(waitForObject(":qt_workspacechild.Cancel_QPushButton_2"))
Note: See TracBrowser for help on using the repository browser.