Salome HOME
updated copyright message
[modules/shaper.git] / test.squish / suite_FEATURE_REVOLUTION / tst_revolution_006 / test.py
index 8df2f16ef83f87d71c4b09bb157c12be3245c572..5ca4b2e01512cad3c5f8aa1b499b9f8be0ef9cde 100644 (file)
+# Copyright (C) 2014-2023  CEA, EDF
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+
 def main():
-    #[project] NewGEOM
-    #[Scenario] Revolution_006
-    #[Topic] 'RevolutionCut by planes and offsets' functionality
-    #[Tested functionality] 
-    #[Summary description]
-    #[Expected results]
-    #[General comments]
-    
+    # [project] SHAPER
+    # [Scenario] Revolution_006
+    # [Topic] 'RevolutionCut by planes and offsets' functionality
+    # [Tested functionality]
+    # [Summary description]
+    # [Expected results]
+    # [General comments]
+
     source(findFile("scripts", "common.py"))
-    
-    #[section] Application start
-    #[step] Launch SALOME
+
+    # [section] Application start
+    # [step] Launch SALOME
     startApplication("salome_run.sh")
 
     set_defaults()
-    
-    #[step] Open 'for_revolution_003.hdf'
+
+    # [step] Open 'for_revolution_003.hdf'
     open(DATA_PATH + "/for_revolution_003.hdf")
-    
-    #[step] Activate NewGeom
-    clickButton(waitForObject(":SALOME*.NewGeom_QToolButton"))
-    
+
+    # [step] Activate SHAPER
+    clickButton(waitForObject(":SALOME*.Shaper_QToolButton"))
+
     # [step] Activate Part_1
     waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)")
     clickItem(":Object browser_XGUI_DataTree", "Part\\_1 (Not loaded)", 71, 10, 0, Qt.LeftButton)
     openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1 (Not loaded)", 70, 9, 0)
     activateItem(waitForObjectItem(":_QMenu", "Activate"))
-    
-    #[step] Fit all
+
+    # [step] Fit all [vp INIT]
     fit_all()
-    
-    #[step] Execute RevolutionFuse operation
+    test.vp("INIT")
+
+    # TODO(spo): remove: workaround for the bug given RevolutionCut sketch created when select axis_object then apply is disabled
+    waitForObjectItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1")
+    clickItem(":Object browser_XGUI_DataTree", "Part\\_1.Sketch\\_1", 10, 10, 0, Qt.LeftButton)
+    openItemContextMenu(waitForObject(":Object browser_XGUI_DataTree"), "Part\\_1.Sketch\\_1", 10, 10, 0)
+    activateItem(waitForObjectItem(":_QMenu", "Edit..."))
+    clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
+
+    # [step] Execute RevolutionFuse operation
     mouseClick(waitForObjectItem(":SALOME*_QMenuBar", "Features"))
     mouseClick(waitForObjectItem(":_QMenu", "RevolutionCut"))
-    
-    #[step] Select sketch face
+
+    # [step] Select sketch face
     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 287, 236, 0, Qt.LeftButton)
 
-    # [step] Create 2 circles
-    circle_create_in_view((650, 364), (671, 392))
-    circle_create_in_view((641, 114), (664, 141))
-    
-    #[step] Approve sketching
+    # [step] Click "Set plane view" in property panel [vp PLANE]
+    clickButton(waitForObject(":Sketcher plane.Set plane view_QPushButton"))
+    test.vp("PLANE")
+
+    # [step] Create 2 circles on the plane [vp CIRCLES]
+    activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch"))
+    activateItem(waitForObjectItem(":Sketch_QMenu", "Circle"))
+    mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 350, 0, Qt.LeftButton)
+    mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 690, 350, 0, Qt.LeftButton)
+    clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
+
+    activateItem(waitForObjectItem(":SALOME*_QMenuBar", "Sketch"))
+    activateItem(waitForObjectItem(":Sketch_QMenu", "Circle"))
+    mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 650, 110, 0, Qt.LeftButton)
+    mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 700, 110, 0, Qt.LeftButton)
+    clickButton(waitForObject(":Boolean.property_panel_ok_QToolButton"))
+
+    test.vp("CIRCLES")
+
+    # [step] Approve sketching
     clickButton(waitForObject(":Sketch.property_panel_ok_QToolButton"))
-    
+
     # [step] Select axis for revolution
-    mouseClick(waitForObject(":Revolution_QLineEdit_3"), 103, 11, 0, Qt.LeftButton)
+    mouseClick(waitForObject(":Revolution_QLineEdit_3"), 10, 10, 0, Qt.LeftButton)
     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 750, 237, 0, Qt.LeftButton)
-    
-    #[step] Select method 'by planes and offsets'
+
+    # [step] Select method 'by planes and offsets'
     clickButton(waitForObject(":Revolution_QToolButton_5"))
-    
-    #[step] Select face 'To'
-    mouseClick(waitForObject(":To_QLineEdit_4"), 82, 14, 0, Qt.LeftButton)
+
+    # [step] Select face 'To': front face
+    mouseClick(waitForObject(":To_QLineEdit_4"), 10, 10, 0, Qt.LeftButton)
     mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 334, 352, 0, Qt.LeftButton)
-    
-    #[step] Select face 'From'
+
+    # [step] Select face 'From': back face
     mouseClick(waitForObject(":From_QLineEdit_4"), 117, 10, 0, Qt.LeftButton)
-    type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
-    mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 507, 436, -473, -110, 67108866, Qt.RightButton)
-    sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonPress, 359, 293, Qt.LeftButton, 1, 0)
-    sendEvent("QMouseEvent", waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), QEvent.MouseButtonRelease, 359, 293, Qt.LeftButton, 0, 0)
-    
-    #[step] Ok
+    clickButton(waitForObject(":SALOME*.-OY_QToolButton"))
+    mouseClick(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 334, 352, 0, Qt.LeftButton)
+
+    # [step] Apply the feature
     clickButton(waitForObject(":RevolutionCut.property_panel_ok_QToolButton"))
-    
-    #[step] Rotate the model
-    type(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), "<Control>")
-    mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 85, 45, 376, 233, 67108866, Qt.RightButton)
-    mouseDrag(waitForObject(":SALOME*.3D View Operations_OCCViewer_ViewPort3d"), 202, 241, 75, -75, 67108866, Qt.RightButton)
 
-    #[step] Fit all
-    fit_all()
-    
-    #[check] Check that operation has been executed successfully    
-    test.vp("VP1")
+    # [step] Click 'Reset view' toolbar button
+    clickButton(waitForObject(":SALOME*.Reset_QToolButton_2"))
+    mouseClick(waitForObject(":SALOME*_OCCViewer_ViewPort3d"), 10, 450, 0, Qt.LeftButton)  # close tool bar extension bar
+
+    # [check] Check that operation has been executed successfully
+
+    #fit_all()
+    test.vp("REVOLUTION_CUT")
 
     # [step] Close application without saving
     close_application()