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))
56 source(findFile("scripts", "common.py"))
58 startApplication("salome_run.sh")
61 #[step] Check that default elements are enabled: Parameters (0), Constructions (4), Parts (0)
62 waitForObjectItem(":Object browser_XGUI_DataTree", "Constructions (4)")
63 clickItem(":Object browser_XGUI_DataTree", "Constructions (4)", -10, 10, 0, Qt.LeftButton)
65 allPartSetElements = [
68 "Constructions (4).Origin",
69 "Constructions (4).YOZ",
70 "Constructions (4).XOZ",
71 "Constructions (4).XOY",
73 for element in allPartSetElements:
74 test.compare(ENABLE_COLOR, waitForObjectItem(":Object browser_XGUI_DataTree", element).foregroundColor, "%s is enabled by default" % element)
77 activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Part"))
78 activateItem(waitForObjectItem(":Part_QMenu", "New part"))
80 checkPartActivatedState("Part creation")
82 #[step] Deactivate part by double click
83 waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1")
84 doubleClickItem(":Object browser_XGUI_DataTree", "Part\\_1", 10, 10, 0, Qt.LeftButton)
86 checkPartDeactivatedState("Part deactivation by double click")
88 #[step] Activate 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 checkPartActivatedState("Part activation by double click")
94 #[step] Check that Activate is disabled in Part context menu
95 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 10, 10, 0)
96 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active Part")
98 #[step] Deactivate part by context menu on PartSet
99 openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
100 activateItem(waitForObjectItem(":_QMenu", "Activate"))
102 checkPartDeactivatedState("Part deactivation by context menu on PartSet")
104 #[step] Check that Activate is disabled in PartSet context menu
105 openContextMenu(waitForObject(":Object browser.Part set_XGUI_ActiveDocLbl"), 10, 10, 0)
106 test.compare(False, findMenuItem(waitForObject(":_QMenu"), "Activate").enabled, "Activate is disabled on active PartSet")
108 #[step] Activate part by context menu on Part
109 openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1", 104, 6, 0)
110 activateItem(waitForObjectItem(":_QMenu", "Activate"))
112 checkPartActivatedState("Part activation by context menu on Part")