source: sasview/src/sas/qtgui/UnitTesting/SquishTestSuites/suite_sasview_qt/tst_Data_ContextMenus/test.py @ d6b234b

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

Cleanup after merge (removed sasview/sasview)

  • Property mode set to 100755
File size: 13.2 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", 36, 9, 0, Qt.LeftButton)
8    waitForObjectItem(":stackedWidget.listView_QListView", "1d\\_data")
9    doubleClickItem(":stackedWidget.listView_QListView", "1d\\_data", 44, 10, 0, Qt.LeftButton)
10    waitForObjectItem(":stackedWidget.listView_QListView", "cyl\\_400\\_20\\.txt")
11    doubleClickItem(":stackedWidget.listView_QListView", "cyl\\_400\\_20\\.txt", 48, 12, 0, Qt.LeftButton)
12    waitForObjectItem(":groupBox.treeView_QTreeView", "cyl\\_400\\_20\\.txt")
13    clickItem(":groupBox.treeView_QTreeView", "cyl\\_400\\_20\\.txt", 51, 10, 0, Qt.LeftButton)
14    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "cyl\\_400\\_20\\.txt", 51, 10, 0)
15    activateItem(waitForObjectItem(":MainWindow_QMenu", "Data Info"))
16    test.compare(str(waitForObjectExists(":Data Info: cyl_400_20.txt_QTextEdit").windowTitle), "Data Info: cyl_400_20.txt")
17    test.compare(waitForObjectExists(":Data Info: cyl_400_20.txt_QTextEdit").visible, True)
18    test.compare(str(waitForObjectExists(":_QTextControl").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=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">File:            cyl_400_20.txt</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Title:           cyl_400_20.txt</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Run:             []</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">SESANS:          None</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Instrument:      </p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Sample:</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   ID:           </p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Transmission: None</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Thickness:    None [mm]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Temperature:  None [None]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Position:     x = None       y = None        z = None [mm]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Orientation:  x = None   y = None        z = None [degree]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Details:</p>\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>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Source:</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Radiation:    None</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Shape:        None</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Wavelength:   None [A]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Waveln_min:   None [nm]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Waveln_max:   None [nm]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Waveln_spread:None [percent]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Beam_size:    x = None y = None        z = None [mm]</p>\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>\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>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Data:</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Type:         Data1D</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   X-axis:       \\rm{Q}      [A^{-1}]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Y-axis:       \\rm{Intensity} [cm^{-1}]</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">   Length:       20</p>\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>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Data Min Max:</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">X_min = 0.025:  X_max = 0.5</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Y_min = 0.00121297:  Y_max = 125.852</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">dY_min = 0.0:  dY_max = 0.0</p>\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>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Data Points:</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">&lt;index&gt;       &lt;X&gt;       &lt;Y&gt;       &lt;dY&gt;      &lt;dX&gt;</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">0      0.025   125.852         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">1     0.05    53.6662         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">2     0.075   26.0733         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">3     0.1     11.8935         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">4     0.125   4.61714         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">5     0.15    1.29983         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">6     0.175   0.171347        0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">7     0.2     0.0417614       0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">8     0.225   0.172719        0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">9     0.25    0.247876        0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">10    0.275   0.20301         0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">11    0.3     0.104599        0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">12    0.325   0.0285595       0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">13    0.35    0.00213344      0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">14    0.375   0.0137511       0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">15    0.4     0.0312374       0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">16    0.425   0.0350328       0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">17    0.45    0.0243172       0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">18    0.475   0.00923067      0.0     0.0</p>\n<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">19    0.5     0.00121297      0.0     0.0</p>\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>")
19    sendEvent("QCloseEvent", waitForObject(":Data Info: cyl_400_20.txt_QTextEdit"))
20    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "cyl\\_400\\_20\\.txt", 181, 3, 0)
21    activateItem(waitForObjectItem(":MainWindow_QMenu", "Save As"))
22    test.compare(str(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle), "Save As")
23    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True)
24    test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "cyl_400_20_out.txt")
25    test.compare(str(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentText), "Text files (*.txt)")
26    test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentIndex, 0)
27    sendEvent("QMouseEvent", waitForObject(":QFileDialog.Cancel_QPushButton"), QEvent.MouseButtonPress, 63, 11, Qt.LeftButton, 1, 0)
28    sendEvent("QMouseEvent", waitForObject(":QFileDialog.Cancel_QPushButton"), QEvent.MouseButtonRelease, 63, 11, Qt.LeftButton, 0, 0)
29    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "cyl\\_400\\_20\\.txt", 168, 5, 0)
30    activateItem(waitForObjectItem(":MainWindow_QMenu", "Quick Plot"))
31    test.compare(waitForObjectExists(":Plot cyl_400_20.txt_FigureCanvasQTAgg").visible, True)
32    test.compare(waitForObjectExists(":Plot cyl_400_20.txt_Plotter").visible, True)
33    test.compare(str(waitForObjectExists(":Plot cyl_400_20.txt_Plotter").windowTitle), "Plot cyl_400_20.txt")
34    sendEvent("QCloseEvent", waitForObject(":Plot cyl_400_20.txt_Plotter"))
35    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "cyl\\_400\\_20\\.txt", 233, 3, 0)
36    clickButton(waitForObject(":groupBox.cmdLoad_QPushButton"))
37    waitForObjectItem(":stackedWidget.listView_QListView", "test")
38    doubleClickItem(":stackedWidget.listView_QListView", "test", 44, 16, 0, Qt.LeftButton)
39    waitForObjectItem(":stackedWidget.listView_QListView", "2d\\_data")
40    doubleClickItem(":stackedWidget.listView_QListView", "2d\\_data", 51, 12, 0, Qt.LeftButton)
41    waitForObjectItem(":stackedWidget.listView_QListView", "P123\\_D2O\\_30\\_percent\\.dat")
42    doubleClickItem(":stackedWidget.listView_QListView", "P123\\_D2O\\_30\\_percent\\.dat", 66, 2, 0, Qt.LeftButton)
43    waitForObjectItem(":groupBox.treeView_QTreeView", "P123\\_D2O\\_30\\_percent\\.dat")
44    clickItem(":groupBox.treeView_QTreeView", "P123\\_D2O\\_30\\_percent\\.dat", 47, 8, 0, Qt.LeftButton)
45    openItemContextMenu(waitForObject(":groupBox.treeView_QTreeView"), "P123\\_D2O\\_30\\_percent\\.dat", 47, 8, 0)
46    activateItem(waitForObjectItem(":MainWindow_QMenu", "Data Info"))
47    test.compare(waitForObjectExists(":Data Info: P123_D2O_30_percent.dat_QTextEdit").visible, True)
48    test.compare(str(waitForObjectExists(":Data Info: P123_D2O_30_percent.dat_QTextEdit").windowTitle), "Data Info: P123_D2O_30_percent.dat")
49    sendEvent("QCloseEvent", waitForObject(":Data Info: P123_D2O_30_percent.dat_QTextEdit"))
Note: See TracBrowser for help on using the repository browser.