1 ## Copyright (C) 2014-2017 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
18 ## email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #[tested functionality]
23 ENABLE_COLOR='#FF000000'
24 DISABLE_COLOR='#FFC0C0C0'
26 def checkPartActivatedState(scenario):
27 #[step] Check that Part is activated
28 allPartSetElements = [
31 "Constructions (4).Origin",
32 "Constructions (4).YOZ",
33 "Constructions (4).XOZ",
34 "Constructions (4).XOY",
37 for element in allPartSetElements:
38 test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario))
42 "Part\\_1.Parameters (0)",
43 "Part\\_1.Constructions (0)",
44 "Part\\_1.Bodies (0)"]
45 for element in partElements:
46 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario))
48 #[step] Check that Part tree is unfolded
49 test.compare(False, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario)
51 def checkPartDeactivatedState(scenario):
52 #[step] Check that Part id disabled and folded
54 "Part\\_1.Parameters (0)",
55 "Part\\_1.Constructions (0)",
56 "Part\\_1.Bodies (0)"]
57 for element in partElements:
58 test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario))
59 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").foregroundColor, "Part is enable after: %s" % scenario)
60 test.compare(True, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario)
62 #[step] Check that PartSet is enabled
63 allPartSetElements = [
66 "Constructions (4).Origin",
67 "Constructions (4).YOZ",
68 "Constructions (4).XOZ",
69 "Constructions (4).XOY",
72 for element in allPartSetElements:
73 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario))
76 source(findFile("scripts", "common.py"))
78 startApplication("salome_run.sh")
81 #[step] Check that default elements are enabled: Parameters (0), Constructions (4), Parts (0)
82 waitForObjectItem(":Object browser_XGUI_DataTree", "Constructions (4)")
83 clickItem(":Object browser_XGUI_DataTree", "Constructions (4)", -10, 10, 0, Qt.LeftButton)
85 allPartSetElements = [
88 "Constructions (4).Origin",
89 "Constructions (4).YOZ",
90 "Constructions (4).XOZ",
91 "Constructions (4).XOY",
93 for element in allPartSetElements:
94 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled by default" % element)
97 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
98 activateItem(waitForObjectItem(":Part_QMenu", "New part"))
100 checkPartActivatedState("Part creation")
102 #[step] Deactivate part by double click
103 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
104 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
106 checkPartDeactivatedState("Part deactivation by double click")
108 #[step] Activate part by double click
109 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
110 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
112 checkPartActivatedState("Part activation by double click")
114 #[step] Check that Activate is disabled in Part context menu
115 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 10, 10, 0)
116 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active Part")
118 #[step] Deactivate part by context menu on PartSet
119 openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
120 activateItem(waitForObjectItem(":_QMenu", "Activate"))
122 checkPartDeactivatedState("Part deactivation by context menu on PartSet")
124 #[step] Check that Activate is disabled in PartSet context menu
125 openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
126 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active PartSet")
128 #[step] Activate part by context menu on Part
129 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 104, 6, 0)
130 activateItem(waitForObjectItem(":_QMenu", "Activate"))
132 checkPartActivatedState("Part activation by context menu on Part")