Salome HOME
Update copyrights
[modules/shaper.git] / test.squish / suite_FEATURE_PARAMETERS / tst_474 / test.py
1 # Copyright (C) 2014-2019  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 email : webmaster.salome@opencascade.com
18 #
19
20 #[tested functionality] 1. Add parameter 2. Calculate parameter 3. Delete parameter
21
22 def main():
23     source(findFile("scripts", "common.py"))
24
25     startApplication("salome_run.sh")
26
27     activate_SHAPER()
28
29     #[step] Create parameter 'aa = 4'
30     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
31     activateItem(waitForObjectItem(":Part_QMenu", "Parameter"))
32     type(waitForObject(":Parameter_QLineEdit"), "aa")
33     type(waitForObject(":Parameter_ExpressionEditor"), "4")
34     type(waitForObject(":Parameter_ExpressionEditor"), "<Return>")
35     clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton"))
36
37     # check the new parameter
38     waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1).aa = 4")
39
40     clickButton(waitForObject(":SALOME*.New part_QToolButton"))
41
42     activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
43     activateItem(waitForObjectItem(":Part_QMenu", "Parameter"))
44     type(waitForObject(":Parameter_QLineEdit"), "bb")
45     type(waitForObject(":Parameter_ExpressionEditor"), "aa+1")
46     type(waitForObject(":Parameter_ExpressionEditor"), "<Return>")
47     clickButton(waitForObject(":Parameter.property_panel_ok_QToolButton"))
48
49     # check the new parameter
50     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1).bb = 5")
51
52     openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
53     activateItem(waitForObjectItem(":_QMenu", "Activate"))
54
55     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Parameters (1).aa = 4", 10, 10, 0)
56     activateItem(waitForObjectItem(":_QMenu", "Delete"))
57     waitFor("object.exists(':Delete features._QLabel')", 20000)
58
59     an_expected = """Selected parameters are used in the following features: bb.
60 These features will be deleted.
61 Or parameters could be replaced by their values.
62 Would you like to continue?"""
63     test.compare(str(findObject(":Delete features._QLabel").text), an_expected)
64     clickButton(waitForObject(":Delete features.No_QPushButton"))
65
66     # nothing is deleted
67     waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1).aa = 4")
68     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Parameters (1).bb = 5")
69
70     close_application()