1 # Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #[tested functionality]
22 ENABLE_COLOR='#FF000000'
23 DISABLE_COLOR='#FFC0C0C0'
25 def checkPartActivatedState(scenario):
26 #[step] Check that Part is activated
27 allPartSetElements = [
30 "Constructions (4).Origin",
31 "Constructions (4).YOZ",
32 "Constructions (4).XOZ",
33 "Constructions (4).XOY",
36 for element in allPartSetElements:
37 test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario))
41 "Part\\_1.Parameters (0)",
42 "Part\\_1.Constructions (0)",
43 "Part\\_1.Bodies (0)"]
44 for element in partElements:
45 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario))
47 #[step] Check that Part tree is unfolded
48 test.compare(False, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario)
50 def checkPartDeactivatedState(scenario):
51 #[step] Check that Part id disabled and folded
53 "Part\\_1.Parameters (0)",
54 "Part\\_1.Constructions (0)",
55 "Part\\_1.Bodies (0)"]
56 for element in partElements:
57 test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario))
58 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").foregroundColor, "Part is enable after: %s" % scenario)
59 test.compare(True, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario)
61 #[step] Check that PartSet is enabled
62 allPartSetElements = [
65 "Constructions (4).Origin",
66 "Constructions (4).YOZ",
67 "Constructions (4).XOZ",
68 "Constructions (4).XOY",
71 for element in allPartSetElements:
72 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario))
75 source(findFile("scripts", "common.py"))
77 startApplication("salome_run.sh")
80 #[step] Check that default elements are enabled: Parameters (0), Constructions (4), Parts (0)
81 waitForObjectItem(":Object browser_XGUI_DataTree", "Constructions (4)")
82 clickItem(":Object browser_XGUI_DataTree", "Constructions (4)", -10, 10, 0, Qt.LeftButton)
84 allPartSetElements = [
87 "Constructions (4).Origin",
88 "Constructions (4).YOZ",
89 "Constructions (4).XOZ",
90 "Constructions (4).XOY",
92 for element in allPartSetElements:
93 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled by default" % element)
96 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
97 activateItem(waitForObjectItem(":Part_QMenu", "New part"))
99 checkPartActivatedState("Part creation")
101 #[step] Deactivate part by double click
102 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
103 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
105 checkPartDeactivatedState("Part deactivation by double click")
107 #[step] Activate part by double click
108 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
109 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
111 checkPartActivatedState("Part activation by double click")
113 #[step] Check that Activate is disabled in Part context menu
114 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 10, 10, 0)
115 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active Part")
117 #[step] Deactivate part by context menu on PartSet
118 openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
119 activateItem(waitForObjectItem(":_QMenu", "Activate"))
121 checkPartDeactivatedState("Part deactivation by context menu on PartSet")
123 #[step] Check that Activate is disabled in PartSet context menu
124 openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
125 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active PartSet")
127 #[step] Activate part by context menu on Part
128 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 104, 6, 0)
129 activateItem(waitForObjectItem(":_QMenu", "Activate"))
131 checkPartActivatedState("Part activation by context menu on Part")