[9c39b317] | 1 | # -*- coding: utf-8 -*- |
---|
| 2 | |
---|
| 3 | import codecs, filecmp, os, subprocess, sys |
---|
| 4 | |
---|
| 5 | def main(): |
---|
| 6 | startApplication("sasview") |
---|
| 7 | mouseClick(waitForObject(":groupBox_6.cbCategory_QComboBox_2"), 144, 11, 0, Qt.LeftButton) |
---|
| 8 | mouseClick(waitForObjectItem(":groupBox_6.cbCategory_QComboBox_2", "Shape Independent"), 124, 2, 0, Qt.LeftButton) |
---|
| 9 | mouseClick(waitForObject(":groupBox_6.cbModel_QComboBox_2"), 119, 10, 0, Qt.LeftButton) |
---|
| 10 | mouseClick(waitForObjectItem(":groupBox_6.cbModel_QComboBox_2", "fractal\\_core\\_shell"), 96, 5, 0, Qt.LeftButton) |
---|
| 11 | clickButton(waitForObject(":FittingWidgetUI.cmdPlot_QPushButton_2")) |
---|
| 12 | snooze(2) |
---|
| 13 | clickButton(waitForObject(":FittingWidgetUI.cmdPlot_QPushButton_2")) |
---|
| 14 | snooze(3) |
---|
| 15 | |
---|
| 16 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 160, 186, 0) |
---|
| 17 | |
---|
| 18 | activateItem(waitForObjectItem(":MainWindow_QMenu", "M1 [fractal\\_core\\_shell]")) |
---|
| 19 | activateItem(waitForObjectItem(":M1 [fractal_core_shell]_QMenu", "DataInfo")) |
---|
| 20 | test.compare(str(waitForObjectExists(":Data Info: M1 [fractal_core_shell]_QTextEdit").windowTitle), "Data Info: M1 [fractal_core_shell]") |
---|
| 21 | test.compare(str(waitForObjectExists(":Data Info: M1 [fractal_core_shell]_QTextEdit").plainText), "File: M1 [fractal_core_shell]\nTitle: M1 [fractal_core_shell]\nRun: []\nSESANS: None\nInstrument: \nSample:\n ID: \n Transmission: None\n Thickness: None [mm]\n Temperature: None [None]\n Position: x = None y = None z = None [mm]\n Orientation: x = None y = None z = None [degree]\n Details:\n\nSource:\n Radiation: None\n Shape: None\n Wavelength: None [A]\n Waveln_min: None [nm]\n Waveln_max: None [nm]\n Waveln_spread:None [percent]\n Beam_size: x = None y = None z = None [mm]\n\n\nData:\n Type: Data1D\n X-axis: \\rm{Q} [A^{-1}]\n Y-axis: \\rm{Intensity} [cm^{-1}]\n Length: 25\n\nData Min Max:\nX_min = 0.005: X_max = 0.1\nY_min = 0.00577961925859: Y_max = 1592.22664984\ndY_min = 0.0: dY_max = 0.0\n\nData Points:\n<index> <X> <Y> <dY> <dX>\n0 0.005 1592.22664984 0.0 0.0\n1 0.00895833333333 1160.4338237 0.0 0.0\n2 0.0129166666667 832.332829973 0.0 0.0\n3 0.016875 609.492198923 0.0 0.0\n4 0.0208333333333 454.848550322 0.0 0.0\n5 0.0247916666667 341.76757376 0.0 0.0\n6 0.02875 255.268917083 0.0 0.0\n7 0.0327083333333 187.358716694 0.0 0.0\n8 0.0366666666667 133.708192402 0.0 0.0\n9 0.040625 91.7799634289 0.0 0.0\n10 0.0445833333333 59.8328101721 0.0 0.0\n11 0.0485416666667 36.4197740996 0.0 0.0\n12 0.0525 20.1646142404 0.0 0.0\n13 0.0564583333333 9.69587397243 0.0 0.0\n14 0.0604166666667 3.66605410824 0.0 0.0\n15 0.064375 0.80918605159 0.0 0.0\n16 0.0683333333333 0.00577961925859 0.0 0.0\n17 0.0722916666667 0.335328964715 0.0 0.0\n18 0.07625 1.10554185938 0.0 0.0\n19 0.0802083333333 1.85484725334 0.0 0.0\n20 0.0841666666667 2.3305018113 0.0 0.0\n21 0.088125 2.44856278674 0.0 0.0\n22 0.0920833333333 2.24402371743 0.0 0.0\n23 0.0960416666667 1.81962984573 0.0 0.0\n24 0.1 1.30062869275 0.0 0.0\n") |
---|
| 22 | test.compare(waitForObjectExists(":Data Info: M1 [fractal_core_shell]_QTextEdit").visible, True) |
---|
| 23 | sendEvent("QCloseEvent", waitForObject(":Data Info: M1 [fractal_core_shell]_QTextEdit")) |
---|
| 24 | snooze(2) |
---|
| 25 | #sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg_2"), QEvent.MouseButtonPress, 186, 208, Qt.RightButton, 2, 0) |
---|
| 26 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), QEvent.MouseButtonRelease, 186, 208, Qt.RightButton, 0, 0) |
---|
| 27 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 186, 208, 0) |
---|
| 28 | activateItem(waitForObjectItem(":MainWindow_QMenu", "M1 [fractal\\_core\\_shell]")) |
---|
| 29 | activateItem(waitForObjectItem(":M1 [fractal_core_shell]_QMenu", "Save Points as a File")) |
---|
| 30 | test.compare(str(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle), "Save As") |
---|
| 31 | test.compare(waitForObjectExists(":QFileDialog_QFileDialog").visible, True) |
---|
| 32 | test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "M1 [fractal_core_shell]_out.txt") |
---|
| 33 | test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").count, 2) |
---|
| 34 | test.compare(str(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentText), "Text files (*.txt)") |
---|
| 35 | test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentIndex, 0) |
---|
| 36 | #clickButton(waitForObject(":QFileDialog.Save_QPushButton")) |
---|
| 37 | #snooze(2) |
---|
| 38 | #txtfile = os.path.join(os.path.expanduser('~'), 'M1 [fractal_core_shell]_out.txt') |
---|
| 39 | #txtfile = 'M1 [fractal_core_shell]_out.txt' |
---|
| 40 | #test.verify(os.path.exists(txtfile), "TXT file saved correctly") |
---|
| 41 | #os.remove(txtfile) |
---|
| 42 | clickButton(waitForObject(":QFileDialog.Cancel_QPushButton")) |
---|
| 43 | |
---|
| 44 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), QEvent.MouseButtonRelease, 223, 280, Qt.RightButton, 0, 0) |
---|
| 45 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 223, 280, 0) |
---|
| 46 | activateItem(waitForObjectItem(":MainWindow_QMenu", "M1 [fractal\\_core\\_shell]")) |
---|
| 47 | activateItem(waitForObjectItem(":M1 [fractal_core_shell]_QMenu", "Save Points as a File")) |
---|
| 48 | mouseClick(waitForObject(":QFileDialog.fileTypeCombo_QComboBox"), 280, 8, 0, Qt.LeftButton) |
---|
| 49 | mouseClick(waitForObjectItem(":QFileDialog.fileTypeCombo_QComboBox", "CanSAS 1D files(*\\.xml)"), 265, 4, 0, Qt.LeftButton) |
---|
| 50 | test.compare(str(waitForObjectExists(":fileNameEdit_QLineEdit").text), "M1 [fractal_core_shell]_out.xml") |
---|
| 51 | test.compare(str(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentText), "CanSAS 1D files(*.xml)") |
---|
| 52 | #clickButton(waitForObject(":QFileDialog.Save_QPushButton")) |
---|
| 53 | clickButton(waitForObject(":QFileDialog.Cancel_QPushButton")) |
---|
| 54 | |
---|
| 55 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 270, 151, 0) |
---|
| 56 | activateItem(waitForObjectItem(":MainWindow_QMenu", "M1 [fractal\\_core\\_shell]")) |
---|
| 57 | activateItem(waitForObjectItem(":M1 [fractal_core_shell]_QMenu", "Linear Fit")) |
---|
| 58 | test.compare(str(waitForObjectExists(":LinearFitUI_LinearFit").windowTitle), "Linear Fit") |
---|
| 59 | test.compare(waitForObjectExists(":LinearFitUI_LinearFit").visible, True) |
---|
| 60 | test.compare(str(waitForObjectExists(":groupBox_2.txtRangeMin_QLineEdit").toolTip), "<html><head/><body><p>Minimum value on the x-axis for the plotted data.</p></body></html>") |
---|
| 61 | test.compare(str(waitForObjectExists(":groupBox_2.txtRangeMin_QLineEdit").text), "0.005") |
---|
| 62 | test.compare(str(waitForObjectExists(":groupBox_2.txtRangeMax_QLineEdit").text), "0.1") |
---|
| 63 | test.compare(str(waitForObjectExists(":groupBox_2.txtRangeMax_QLineEdit").toolTip), "<html><head/><body><p>Maximum value on the x-axis for the plotted data.</p></body></html>") |
---|
| 64 | test.compare(str(waitForObjectExists(":groupBox.txtA_QLineEdit").text), "1") |
---|
| 65 | test.compare(str(waitForObjectExists(":groupBox.txtA_QLineEdit").toolTip), "<html><head/><body><p>Fit value for the slope parameter.</p></body></html>") |
---|
| 66 | test.compare(str(waitForObjectExists(":groupBox.txtB_QLineEdit").toolTip), "<html><head/><body><p>Fit value for the constant parameter.</p></body></html>") |
---|
| 67 | test.compare(str(waitForObjectExists(":groupBox.txtB_QLineEdit").text), "1") |
---|
| 68 | test.compare(str(waitForObjectExists(":groupBox.txtChi2_QLineEdit").toolTip), "<html><head/><body><p>Ï<span style=\" vertical-align:super;\">2</span> over degrees of freedom.</p></body></html>") |
---|
| 69 | test.compare(str(waitForObjectExists(":groupBox.txtChi2_QLineEdit").text), "0") |
---|
| 70 | clickButton(waitForObject(":LinearFitUI.cmdClose_QPushButton")) |
---|
| 71 | |
---|
| 72 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 352, 244, 0) |
---|
| 73 | activateItem(waitForObjectItem(":MainWindow_QMenu", "M1 [fractal\\_core\\_shell]")) |
---|
| 74 | activateItem(waitForObjectItem(":M1 [fractal_core_shell]_QMenu", "Modify Plot Property")) |
---|
| 75 | sendEvent("QMoveEvent", waitForObject(":PlotPropertiesUI_PlotProperties"), 745, 331, 937, 348) |
---|
| 76 | test.compare(waitForObjectExists(":PlotPropertiesUI_PlotProperties").visible, True) |
---|
| 77 | test.compare(str(waitForObjectExists(":PlotPropertiesUI_PlotProperties").windowTitle), "Modify Plot Properties") |
---|
| 78 | test.compare(str(waitForObjectExists(":groupBox.cbShape_QComboBox").currentText), "Line") |
---|
| 79 | test.compare(waitForObjectExists(":groupBox.cbShape_QComboBox").currentIndex, 17) |
---|
| 80 | test.compare(waitForObjectExists(":groupBox.cbShape_QComboBox").count, 21) |
---|
| 81 | test.compare(str(waitForObjectExists(":groupBox.qt_spinbox_lineedit_QLineEdit").displayText), "5") |
---|
| 82 | test.compare(waitForObjectExists(":groupBox.cbColor_QComboBox").count, 7) |
---|
| 83 | test.compare(str(waitForObjectExists(":groupBox.cbColor_QComboBox").currentText), "Blue") |
---|
| 84 | test.compare(waitForObjectExists(":groupBox.cbColor_QComboBox").currentIndex, 0) |
---|
| 85 | test.compare(str(waitForObjectExists(":groupBox.cmdCustom_QPushButton").text), "Custom..") |
---|
| 86 | test.compare(str(waitForObjectExists(":qt_workspacechild.txtLegend_QLineEdit").text), "M1 [fractal_core_shell]") |
---|
| 87 | test.compare(waitForObjectExists(":qt_workspacechild.txtLegend_QLineEdit").visible, True) |
---|
| 88 | mouseClick(waitForObject(":groupBox.cbShape_QComboBox"), 135, 13, 0, Qt.LeftButton) |
---|
| 89 | mouseClick(waitForObjectItem(":groupBox.cbShape_QComboBox", "Triangle Down"), 116, 5, 0, Qt.LeftButton) |
---|
| 90 | spinUp(waitForObject(":groupBox.sbSize_QSpinBox")) |
---|
| 91 | doubleClick(waitForObject(":groupBox.sbSize_QSpinBox"), 33, 6, 0, Qt.LeftButton) |
---|
| 92 | clickButton(waitForObject(":qt_workspacechild.OK_QPushButton_2")) |
---|
| 93 | #test.vp("VP1") |
---|
| 94 | #sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg_2"), QEvent.MouseButtonPress, 230, 166, Qt.RightButton, 2, 0) |
---|
| 95 | sendEvent("QMouseEvent", waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), QEvent.MouseButtonRelease, 230, 166, Qt.RightButton, 0, 0) |
---|
| 96 | openContextMenu(waitForObject(":qt_workspacechild_FigureCanvasQTAgg"), 230, 166, 0) |
---|
| 97 | activateItem(waitForObjectItem(":MainWindow_QMenu", "M1 [fractal\\_core\\_shell]")) |
---|
| 98 | activateItem(waitForObjectItem(":M1 [fractal_core_shell]_QMenu", "Modify Plot Property")) |
---|
| 99 | mouseClick(waitForObject(":groupBox.cbShape_QComboBox"), 70, 13, 0, Qt.LeftButton) |
---|
| 100 | mouseClick(waitForObject(":groupBox.cbShape_QComboBox"), 70, 13, 0, Qt.LeftButton) |
---|
| 101 | mouseClick(waitForObject(":groupBox.cbShape_QComboBox"), 58, 7, 0, Qt.LeftButton) |
---|
| 102 | mouseClick(waitForObjectItem(":groupBox.cbShape_QComboBox", "Vline"), 93, 7, 0, Qt.LeftButton) |
---|
| 103 | mouseClick(waitForObject(":groupBox.cbColor_QComboBox"), 54, 7, 0, Qt.LeftButton) |
---|
| 104 | mouseClick(waitForObjectItem(":groupBox.cbColor_QComboBox", "Magenta"), 31, 9, 0, Qt.LeftButton) |
---|
| 105 | mouseDrag(waitForObject(":qt_workspacechild.txtLegend_QLineEdit"), 20, 13, 116, -2, 1, Qt.LeftButton) |
---|
| 106 | type(waitForObject(":qt_workspacechild.txtLegend_QLineEdit"), "<Backspace>") |
---|
| 107 | type(waitForObject(":qt_workspacechild.txtLegend_QLineEdit"), "<Backspace>") |
---|
| 108 | clickButton(waitForObject(":qt_workspacechild.OK_QPushButton_2")) |
---|
| 109 | #test.vp("VP2") |
---|
| 110 | |
---|
| 111 | |
---|
| 112 | |
---|