Salome HOME
updated copyright message
[modules/shaper.git] / test.squish / suite_FEATURE_PARAMETERS / tst_903 / test.py
1 # Copyright (C) 2014-2023  CEA, EDF
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 email : webmaster.salome@opencascade.com
18 #
19
20 #[tested functionality] Add parameter
21 #[tested functionality] Use wrong parameter name
22 #[tested functionality] Error notification in header
23 #[tested functionality] Error notification in widget
24
25 def main():
26     source(findFile("scripts", "common.py"))
27
28     startApplication("salome_run.sh")
29
30     activate_SHAPER()
31
32     #[step] Click menu Part->Parameter
33     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
34     activateItem(waitForObjectItem(":Part_QMenu", "Parameter"))
35     mouseClick(waitForObject(":Parameter_QLineEdit"), 79, 8, 0, Qt.LeftButton)
36     #[step] Check that feature ToolTip is: Model_FeatureValidator: Attribute "expression" is not initialized.
37     waitFor("object.exists(':Parameter_QFrame')", 20000)
38     test.compare(str(findObject(":Parameter_QFrame").toolTip), "Model_FeatureValidator: Attribute \"expression\" is not initialized.")
39     #[step] Check that name tooltip is: Errors:\nvariable - Parameters_VariableValidator: Incorrect variable name.
40     waitFor("object.exists(':Parameter_QLineEdit')", 20000)
41     test.compare(str(findObject(":Parameter_QLineEdit").toolTip), 'Errors:\nvariable - Parameters_VariableValidator: Attribute "variable" value is empty.')
42     #[step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: Expression is empty.
43     waitFor("object.exists(':Parameter_ExpressionEditor')", 20000)
44     test.compare(str(findObject(":Parameter_ExpressionEditor").toolTip), 'Errors:\nexpression - Parameters_ExpressionValidator: Attribute "expression" is not initialized.')
45
46     #[step] Enter variable name 'a'
47     type(waitForObject(":Parameter_QLineEdit"), "a")
48     mouseClick(waitForObject(":Parameter_ExpressionEditor"), 97, 31, 0, Qt.LeftButton)
49
50     #[step] Enter variable expression '100+b'
51     type(waitForObject(":Parameter_ExpressionEditor"), "100+b")
52     type(waitForObject(":Parameter_ExpressionEditor"), "<Return>")
53
54     #[step] Check that expression tooltip is: Errors:\nexpression - Parameters_ExpressionValidator: name 'b' is not defined
55     waitFor("object.exists(':Parameter_ExpressionEditor')", 20000)
56     test.compare(str(findObject(":Parameter_ExpressionEditor").toolTip), "Errors:\nexpression - Parameters_ExpressionValidator: Result is empty.")
57     #[step] Check that result message is: Error: unexpected EOF while parsing (<string>, line 0)
58     waitFor("object.exists(':Parameter.Result_QLabel')", 20000)
59     test.compare(str(findObject(":Parameter.Result_QLabel").text), "Error: name 'b' is not defined")
60
61     #[step] Check that feature ToolTip is: expression - Parameters_ExpressionValidator: name 'b' is not defined
62     waitFor("object.exists(':Parameter_QFrame')", 20000)
63     test.compare(str(findObject(":Parameter_QFrame").toolTip), "expression - Parameters_ExpressionValidator: Result is empty.")
64
65     #[step] Check that apply button is grey [vp VP_APPLY_GREY]
66     test.vp("VP_APPLY_GREY")
67
68     close_application()