1 #[tested functionality]
3 ENABLE_COLOR='#FF000000'
4 DISABLE_COLOR='#FFC0C0C0'
6 def checkPartActivatedState(scenario):
7 #[step] Check that Part is activated
11 "Constructions (4).Origin",
12 "Constructions (4).YOZ",
13 "Constructions (4).XOZ",
14 "Constructions (4).XOY",
17 for element in allPartSetElements:
18 test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario))
22 "Part\\_1.Parameters (0)",
23 "Part\\_1.Constructions (0)",
24 "Part\\_1.Bodies (0)"]
25 for element in partElements:
26 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario))
28 #[step] Check that Part tree is unfolded
29 test.compare(False, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario)
31 def checkPartDeactivatedState(scenario):
32 #[step] Check that Part id disabled and folded
34 "Part\\_1.Parameters (0)",
35 "Part\\_1.Constructions (0)",
36 "Part\\_1.Bodies (0)"]
37 for element in partElements:
38 test.compare(DISABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is disabled after: %s" % (element, scenario))
39 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").foregroundColor, "Part is enable after: %s" % scenario)
40 test.compare(True, waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1").collapsed, "Part is unfolded after: %s" % scenario)
42 #[step] Check that PartSet is enabled
43 allPartSetElements = [
46 "Constructions (4).Origin",
47 "Constructions (4).YOZ",
48 "Constructions (4).XOZ",
49 "Constructions (4).XOY",
52 for element in allPartSetElements:
53 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled after: %s" % (element, scenario))
55 def findMenuItem(menuObject, item):
56 for child in object.children(menuObject):
57 if child.text == item:
62 source(findFile("scripts", "common.py"))
64 startApplication("salome_run.sh")
67 #[step] Check that default elements are enabled: Parameters (0), Constructions (4), Parts (0)
68 waitForObjectItem(":Object browser_XGUI_DataTree", "Constructions (4)")
69 clickItem(":Object browser_XGUI_DataTree", "Constructions (4)", -10, 10, 0, Qt.LeftButton)
71 allPartSetElements = [
74 "Constructions (4).Origin",
75 "Constructions (4).YOZ",
76 "Constructions (4).XOZ",
77 "Constructions (4).XOY",
79 for element in allPartSetElements:
80 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled by default" % element)
83 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
84 activateItem(waitForObjectItem(":Part_QMenu", "New part"))
86 checkPartActivatedState("Part creation")
88 #[step] Deactivate part by double click
89 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
90 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
92 checkPartDeactivatedState("Part deactivation by double click")
94 #[step] Activate part by double click
95 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
96 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
98 checkPartActivatedState("Part activation by double click")
100 #[step] Check that Activate is disabled in Part context menu
101 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 10, 10, 0)
102 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active Part")
104 #[step] Deactivate part by context menu on PartSet
105 openContextMenu(waitForObject(":Object browser_QLineEdit"), 10, 10, 0)
106 activateItem(waitForObjectItem(":_QMenu", "Activate"))
108 checkPartDeactivatedState("Part deactivation by context menu on PartSet")
110 #[step] Check that Activate is disabled in PartSet context menu
111 openContextMenu(waitForObject(":Object browser_QLineEdit"), 10, 10, 0)
112 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active PartSet")
114 #[step] Activate part by context menu on Part
115 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 104, 6, 0)
116 activateItem(waitForObjectItem(":_QMenu", "Activate"))
118 checkPartActivatedState("Part activation by context menu on Part")