Salome HOME
f5bca22a8471be7b875130f514ec3696071bde6d
[modules/shaper.git] / test.squish / suite_STANDALONE / tst_818 / test.py
1 # Copyright (C) 2014-2023  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 import re
21
22 def main():
23     source(findFile("scripts", "common.py"))
24
25     startApplication("linux_run.sh")
26     set_defaults()
27
28     #[step] Create parameter 'a = 100'
29     parameter_create("a", "100")
30
31     #[step] Create sketch with line (0,0) - (a, 0)
32     sketch_create(help_points("XY_plane"), lambda: line_create((0, 0), ("a", 0)))
33
34     #[step] Activate context menu for parameter 'a' and click 'Delete'
35     waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1)")
36     clickItem(":Object browser_XGUI_DataTree", "Parameters (1)", -10, 10, 0, Qt.LeftButton)
37     waitForObjectItem(":Object browser_XGUI_DataTree", "Parameters (1).a = 100")
38     clickItem(":Object browser_XGUI_DataTree", "Parameters (1).a = 100", 10, 10, 0, Qt.LeftButton)
39     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Parameters (1).a = 100", 10, 10, 0)
40
41     activateItem(waitForObjectItem(":_QMenu", "Delete"))
42
43     #[check] Message box with "Selected features are used in the following features: SketchLine_1. These features will be deleted.\nAlso these features will be deleted: Sketch_1.\nWould you like to continue?" should appear
44     waitFor("object.exists(':Delete features.Label_QLabel')", 20000)
45
46     an_expected = """Selected parameters are used in the following features: SketchLine_1.
47 These features will be deleted.
48 (Also these features will be deleted: Sketch_1)
49 Or parameters could be replaced by their values.
50 Would you like to continue?"""
51     test.compare(str(findObject(":Delete features.Label_QLabel").text), an_expected)
52
53     #[step] Click 'Yes' and close application
54     clickButton(waitForObject(":Delete features.Yes_QPushButton"))