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