source: sasview/sasview/squish_test_suites/suite_sasview_calculators/tst_Scattering_Calculator/test.js @ 7d97e2d

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 7d97e2d was 7d97e2d, checked in by Piotr Rozyczko <rozyczko@…>, 7 years ago

Squish test suite for the calculators SASVIEW-698

  • Property mode set to 100755
File size: 16.3 KB
Line 
1function main() {
2    startApplication("sasview");
3    activateItem(waitForObjectItem(":MainWindow.menubar_QMenuBar", "Tool"));
4    activateItem(waitForObjectItem(":MainWindow.menuTool_QMenu", "Generic Scattering Calculator"));
5    setWindowState(waitForObject(":MainWindow_MainSasViewWindow"), WindowState.Minimize);
6    test.compare(waitForObjectExists(":GenericScatteringCalculator_GenericScatteringCalculator").windowTitle, "Generic SAS Calculator");
7    test.compare(waitForObjectExists(":GenericScatteringCalculator_GenericScatteringCalculator").visible, true);
8    test.compare(waitForObjectExists(":GenericScatteringCalculator_GenericScatteringCalculator").modal, false);
9    test.compare(waitForObjectExists(":groupBox_Datafile.txtData_QLineEdit").toolTip, "Display name of loaded datafile.");
10    test.compare(waitForObjectExists(":groupBox_Datafile.txtData_QLineEdit").text, "Default SLD Profile");
11    test.compare(waitForObjectExists(":groupBox_Datafile.cmdLoad_QPushButton").enabled, true);
12    test.compare(waitForObjectExists(":groupBox_Datafile.cmdDraw_QPushButton").enabled, false);
13    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").currentText, "Rectangular");
14    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").enabled, true);
15    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").count, 2);
16    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").currentIndex, 0);
17    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.txtNoPixels_QLineEdit").enabled, false);
18    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.txtNoPixels_QLineEdit").text, "1000");
19    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracIn_QLineEdit").text, "1.0");
20    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracIn_QLineEdit").toolTip, "<html><head/><body><p>Ratio of spin up/(spin up + spin down) neutrons after the analyzer.</p><p>It must be between 0 and 1.</p><p>It is equal to 0.5 for unpolarized neutrons.</p></body></html>");
21    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").text, "1.0");
22    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").toolTip, "<html><head/><body><p>Ratio of spin up/(spin up + spin down) neutrons before the sample.</p><p>It must be between 0 and 1.</p><p>It is equal to 0.5 for unpolarized neutrons.</p></body></html>");
23    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").readOnly, false);
24    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").readOnly, false);
25    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").text, "0.0");
26    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").toolTip, "<html><head/><body><p>Polarization angle.</p></body></html>");
27    test.compare(waitForObjectExists(":groupBox_InputParam.txtBackground_QLineEdit").text, "0.0");
28    test.compare(waitForObjectExists(":groupBox_InputParam.txtBackground_QLineEdit").readOnly, false);
29    test.compare(waitForObjectExists(":groupBox_InputParam.txtSolventSLD_QLineEdit").text, "0.0");
30    test.compare(waitForObjectExists(":groupBox_InputParam.txtSolventSLD_QLineEdit").readOnly, false);
31    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").toolTip, "<html><head/><body><p>Default total volume calculated from the pizel information (or natural density for pdb file)</p></body></html>");
32    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").readOnly, false);
33    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").text, "216000.0");
34    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdCompute_QPushButton").enabled, true);
35    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdReset_QPushButton").enabled, true);
36    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdClose_QPushButton").enabled, true);
37    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdHelp_QPushButton").enabled, true);
38    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.cmdDrawpoints_QPushButton").enabled, false);
39    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.cmdSave_QPushButton").enabled, false);
40    clickButton(waitForObject(":GenericScatteringCalculator.cmdCompute_QPushButton"));
41   
42    sendEvent("QMoveEvent", waitForObject(":_Plotter2D"), 1165, 717, 1309, 731);
43    sendEvent("QMoveEvent", waitForObject(":_Plotter2D"), 1178, 699, 1322, 713);
44    sendEvent("QMoveEvent", waitForObject(":_Plotter2D"), 1026, 396, 1170, 410);
45    sendEvent("QCloseEvent", waitForObject(":_Plotter2D"));
46    mouseClick(waitForObject(":groupBox_Datafile.cbShape_QComboBox"), 122, 9, 0, Qt.LeftButton);
47    mouseClick(waitForObjectItem(":groupBox_Datafile.cbShape_QComboBox", "Ellipsoid"), 108, 9, 0, Qt.LeftButton);
48    mouseClick(waitForObject(":groupBox_Qrange.txtNoQBins_QLineEdit"), 31, 15, 0, Qt.LeftButton);
49   
50    mouseClick(waitForObject(":groupBox_Datafile.cbShape_QComboBox"), 137, 8, 0, Qt.LeftButton);
51    mouseClick(waitForObjectItem(":groupBox_Datafile.cbShape_QComboBox", "Ellipsoid"), 125, 2, 0, Qt.LeftButton);
52    clickButton(waitForObject(":GenericScatteringCalculator.cmdCompute_QPushButton"));
53    sendEvent("QCloseEvent", waitForObject(":_Plotter2D"));
54    mouseClick(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), 33, 10, 0, Qt.LeftButton);
55    type(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), "<Left>");
56    type(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), "<Left>");
57    type(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), "<Backspace>");
58    type(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), "2");
59    type(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), "<Backspace>");
60    type(waitForObject(":groupBox_InputParam.txtUpFracIn_QLineEdit"), "2");
61    mouseDrag(waitForObject(":groupBox_InputParam.txtUpTheta_QLineEdit"), 24, 11, -26, 11, 1, Qt.LeftButton);
62    type(waitForObject(":groupBox_InputParam.txtUpTheta_QLineEdit"), "ee");
63    type(waitForObject(":groupBox_InputParam.txtUpTheta_QLineEdit"), "<Backspace>");
64    type(waitForObject(":groupBox_InputParam.txtUpTheta_QLineEdit"), "<Backspace>");
65    type(waitForObject(":groupBox_InputParam.txtUpTheta_QLineEdit"), "2.0");
66    type(waitForObject(":groupBox_InputParam.txtUpTheta_QLineEdit"), "<Tab>");
67    type(waitForObject(":groupBox_InputParam.txtBackground_QLineEdit"), "1.0");
68    type(waitForObject(":groupBox_InputParam.txtBackground_QLineEdit"), "<Tab>");
69    type(waitForObject(":groupBox_InputParam.txtScale_QLineEdit"), "2.0");
70    type(waitForObject(":groupBox_InputParam.txtScale_QLineEdit"), "<Tab>");
71    type(waitForObject(":groupBox_InputParam.txtSolventSLD_QLineEdit"), "10.0");
72    type(waitForObject(":groupBox_InputParam.txtSolventSLD_QLineEdit"), "<Tab>");
73    clickButton(waitForObject(":GenericScatteringCalculator.cmdCompute_QPushButton"));
74
75    clickButton(waitForObject(":GenericScatteringCalculator.cmdReset_QPushButton"));
76 
77    test.compare(waitForObjectExists(":groupBox_Datafile.txtData_QLineEdit").toolTip, "Display name of loaded datafile.");
78    test.compare(waitForObjectExists(":groupBox_Datafile.txtData_QLineEdit").text, "Default SLD Profile");
79    test.compare(waitForObjectExists(":groupBox_Datafile.cmdLoad_QPushButton").enabled, true);
80    test.compare(waitForObjectExists(":groupBox_Datafile.cmdDraw_QPushButton").enabled, false);
81    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").currentText, "Rectangular");
82    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").enabled, true);
83    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").count, 2);
84    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").currentIndex, 0);
85    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.txtNoPixels_QLineEdit").enabled, false);
86    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.txtNoPixels_QLineEdit").text, "1000");
87    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracIn_QLineEdit").text, "1.0");
88    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracIn_QLineEdit").toolTip, "<html><head/><body><p>Ratio of spin up/(spin up + spin down) neutrons after the analyzer.</p><p>It must be between 0 and 1.</p><p>It is equal to 0.5 for unpolarized neutrons.</p></body></html>");
89    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").text, "1.0");
90    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").toolTip, "<html><head/><body><p>Ratio of spin up/(spin up + spin down) neutrons before the sample.</p><p>It must be between 0 and 1.</p><p>It is equal to 0.5 for unpolarized neutrons.</p></body></html>");
91    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").readOnly, false);
92    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").readOnly, false);
93    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").text, "0.0");
94    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").toolTip, "<html><head/><body><p>Polarization angle.</p></body></html>");
95    test.compare(waitForObjectExists(":groupBox_InputParam.txtBackground_QLineEdit").text, "0.0");
96    test.compare(waitForObjectExists(":groupBox_InputParam.txtBackground_QLineEdit").readOnly, false);
97    test.compare(waitForObjectExists(":groupBox_InputParam.txtSolventSLD_QLineEdit").text, "0.0");
98    test.compare(waitForObjectExists(":groupBox_InputParam.txtSolventSLD_QLineEdit").readOnly, false);
99    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").toolTip, "<html><head/><body><p>Default total volume calculated from the pizel information (or natural density for pdb file)</p></body></html>");
100    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").readOnly, false);
101    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").text, "216000.0");
102    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdCompute_QPushButton").enabled, true);
103    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdReset_QPushButton").enabled, true);
104    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdClose_QPushButton").enabled, true);
105    test.compare(waitForObjectExists(":GenericScatteringCalculator.cmdHelp_QPushButton").enabled, true);
106    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.cmdDrawpoints_QPushButton").enabled, false);
107    snooze(2)
108
109    clickButton(waitForObject(":groupBox_Datafile.cmdLoad_QPushButton"));
110    waitForObjectItem(":stackedWidget.listView_QListView", "test");
111    doubleClickItem(":stackedWidget.listView_QListView", "test", 43, 15, 0, Qt.LeftButton);
112    waitForObjectItem(":stackedWidget.listView_QListView", "coordinate\\_data");
113    doubleClickItem(":stackedWidget.listView_QListView", "coordinate\\_data", 42, 7, 0, Qt.LeftButton);
114    waitForObjectItem(":stackedWidget.listView_QListView", "A\\_Raw\\_Example-1\\.omf");
115    doubleClickItem(":stackedWidget.listView_QListView", "A\\_Raw\\_Example-1\\.omf", 36, 10, 0, Qt.LeftButton);
116    snooze(2)
117    test.compare(waitForObjectExists(":groupBox_Datafile.txtData_QLineEdit").text, "A_Raw_Example-1.omf");
118    test.compare(waitForObjectExists(":groupBox_Datafile.cbShape_QComboBox").enabled, false);
119    test.compare(waitForObjectExists(":groupBox_Datafile.cmdDraw_QPushButton").enabled, true);
120    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracIn_QLineEdit").text, "1.0");
121    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracIn_QLineEdit").enabled, false);
122    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").text, "1.0");
123    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpFracOut_QLineEdit").enabled, false);
124    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").enabled, false);
125    test.compare(waitForObjectExists(":groupBox_InputParam.txtUpTheta_QLineEdit").text, "0.0");
126    test.compare(waitForObjectExists(":groupBox_InputParam.txtBackground_QLineEdit").enabled, true);
127    test.compare(waitForObjectExists(":groupBox_InputParam.txtBackground_QLineEdit").text, "0.01");
128    test.compare(waitForObjectExists(":groupBox_InputParam.txtScale_QLineEdit").text, "1.02");
129    test.compare(waitForObjectExists(":groupBox_InputParam.txtScale_QLineEdit").enabled, true);
130    test.compare(waitForObjectExists(":groupBox_InputParam.txtSolventSLD_QLineEdit").enabled, true);
131    test.compare(waitForObjectExists(":groupBox_InputParam.txtSolventSLD_QLineEdit").text, "0.0");
132    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").enabled, true);
133    test.compare(waitForObjectExists(":groupBox_InputParam.txtTotalVolume_QLineEdit").text, "128000000.0");
134    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.txtNoPixels_QLineEdit").enabled, false);
135    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.txtNoPixels_QLineEdit").text, "16000");
136    test.compare(waitForObjectExists(":groupBox_5.txtMx_QLineEdit").text, "7.855e-09");
137    test.compare(waitForObjectExists(":groupBox_5.txtMx_QLineEdit").enabled, false);
138    test.compare(waitForObjectExists(":groupBox_5.txtMy_QLineEdit").enabled, false);
139    test.compare(waitForObjectExists(":groupBox_5.txtMy_QLineEdit").text, "4.5169e-08");
140    test.compare(waitForObjectExists(":groupBox_5.txtMz_QLineEdit").text, "9.9511e-10");
141    test.compare(waitForObjectExists(":groupBox_5.txtMz_QLineEdit").enabled, false);
142    test.compare(waitForObjectExists(":groupBox_5.txtNucl_QLineEdit").text, "0");
143    test.compare(waitForObjectExists(":groupBox_5.txtNucl_QLineEdit").enabled, true);
144    test.compare(waitForObjectExists(":groupBox_6.txtXnodes_QLineEdit").text, "40");
145    test.compare(waitForObjectExists(":groupBox_6.txtXnodes_QLineEdit").enabled, false);
146    test.compare(waitForObjectExists(":groupBox_6.txtYnodes_QLineEdit").enabled, false);
147    test.compare(waitForObjectExists(":groupBox_6.txtYnodes_QLineEdit").text, "40");
148    test.compare(waitForObjectExists(":groupBox_6.txtZnodes_QLineEdit").enabled, false);
149    test.compare(waitForObjectExists(":groupBox_6.txtZnodes_QLineEdit").text, "10");
150    test.compare(waitForObjectExists(":groupBox_Stepsize.txtXstepsize_QLineEdit").text, "20");
151    test.compare(waitForObjectExists(":groupBox_Stepsize.txtXstepsize_QLineEdit").enabled, false);
152    test.compare(waitForObjectExists(":groupBox_Stepsize.txtYstepsize_QLineEdit").enabled, false);
153    test.compare(waitForObjectExists(":groupBox_Stepsize.txtYstepsize_QLineEdit").text, "20");
154    test.compare(waitForObjectExists(":groupBox_Stepsize.txtZstepsize_QLineEdit").enabled, false);
155    test.compare(waitForObjectExists(":groupBox_Stepsize.txtZstepsize_QLineEdit").text, "20");
156    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.cmdDrawpoints_QPushButton").enabled, true);
157    test.compare(waitForObjectExists(":groupBox_SLDPixelInfo.cmdSave_QPushButton").enabled, true);
158    sendEvent("QMouseEvent", waitForObject(":groupBox_SLDPixelInfo.cmdSave_QPushButton"), QEvent.MouseButtonPress, 44, 5, Qt.LeftButton, 1, 0);
159    sendEvent("QMouseEvent", waitForObject(":groupBox_SLDPixelInfo.cmdSave_QPushButton"), QEvent.MouseButtonRelease, 44, 5, Qt.LeftButton, 0, 0);
160    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").windowTitle, "Save As");
161    test.compare(waitForObjectExists(":QFileDialog_QFileDialog").modal, true);
162    test.compare(waitForObjectExists(":fileNameEdit_QLineEdit").text, "sld_file");
163    test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").count, 1);
164    test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentText, "SLD file (*.sld)");
165    test.compare(waitForObjectExists(":QFileDialog.fileTypeCombo_QComboBox").currentIndex, 0);
166    sendEvent("QMouseEvent", waitForObject(":QFileDialog.Cancel_QPushButton"), QEvent.MouseButtonPress, 36, 12, Qt.LeftButton, 1, 0);
167    sendEvent("QMouseEvent", waitForObject(":QFileDialog.Cancel_QPushButton"), QEvent.MouseButtonRelease, 36, 12, Qt.LeftButton, 0, 0);
168    clickButton(waitForObject(":groupBox_SLDPixelInfo.cmdDrawpoints_QPushButton"));
169   
170}
Note: See TracBrowser for help on using the repository browser.