Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / test.squish / suite_FEATURE_PARAMETERS / tst_903 / test.py
1 ## Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 ##
3 ## This library is free software; you can redistribute it and/or
4 ## modify it under the terms of the GNU Lesser General Public
5 ## License as published by the Free Software Foundation; either
6 ## version 2.1 of the License, or (at your option) any later version.
7 ##
8 ## This library is distributed in the hope that it will be useful,
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 ## Lesser General Public License for more details.
12 ##
13 ## You should have received a copy of the GNU Lesser General Public
14 ## License along with this library; if not, write to the Free Software
15 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 ##
17 ## See http:##www.salome-platform.org/ or
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 ##
20
21 #[tested functionality] Add parameter
22 #[tested functionality] Use wrong parameter name
23 #[tested functionality] Error notification in header
24 #[tested functionality] Error notification in widget
25
26 def main():
27     source(findFile("scripts", "common.py"))
28
29     startApplication("salome_run.sh")
30
31     activate_SHAPER()
32
33     #[step] Click menu Part->Parameter
34     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
35     activateItem(waitForObjectItem(":Part_QMenu", "Parameter"))
36     mouseClick(waitForObject(":Parameter_QLineEdit"), 79, 8, 0, Qt.LeftButton)
37     #[step] Check that feature ToolTip is: Model_FeatureValidator: Attribute "expression" is not initialized.
38     waitFor("object.exists(':Parameter_QFrame')", 20000)
39     test.compare(str(findObject(":Parameter_QFrame").toolTip), "Model_FeatureValidator: Attribute \"expression\" is not initialized.")
40     #[step] Check that name tooltip is: Errors:\nvariable - Parameters_VariableValidator: Incorrect variable name.
41     waitFor("object.exists(':Parameter_QLineEdit')", 20000)
42     test.compare(str(findObject(":Parameter_QLineEdit").toolTip), 'Errors:\nvariable - Parameters_VariableValidator: Attribute "variable" value is empty.')
43     #[step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: Expression is empty.
44     waitFor("object.exists(':Parameter_ExpressionEditor')", 20000)
45     test.compare(str(findObject(":Parameter_ExpressionEditor").toolTip), 'Errors:\nexpression - Parameters_ExpressionValidator: Attribute "expression" is not initialized.')
46
47     #[step] Enter variable name 'a'
48     type(waitForObject(":Parameter_QLineEdit"), "a")
49     mouseClick(waitForObject(":Parameter_ExpressionEditor"), 97, 31, 0, Qt.LeftButton)
50
51     #[step] Enter variable expression '100+b'
52     type(waitForObject(":Parameter_ExpressionEditor"), "100+b")
53     type(waitForObject(":Parameter_ExpressionEditor"), "<Return>")
54
55     #[step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: name 'b' is not defined
56     waitFor("object.exists(':Parameter_ExpressionEditor')", 20000)
57     test.compare(str(findObject(":Parameter_ExpressionEditor").toolTip), "Errors:\nexpression - Parameters_ExpressionValidator: Result is empty.")
58     #[step] Check that result message is: Error: unexpected EOF while parsing (<string>, line 0)
59     waitFor("object.exists(':Parameter.Result_QLabel')", 20000)
60     test.compare(str(findObject(":Parameter.Result_QLabel").text), "Error: name 'b' is not defined")
61
62     #[step] Check that feature ToolTip is: expression - Parameters_ExpressionValidator: name 'b' is not defined
63     waitFor("object.exists(':Parameter_QFrame')", 20000)
64     test.compare(str(findObject(":Parameter_QFrame").toolTip), "expression - Parameters_ExpressionValidator: Result is empty.")
65
66     #[step] Check that apply button is grey [vp VP_APPLY_GREY]
67     test.vp("VP_APPLY_GREY")
68
69     close_application()