:Add element.Add_QPushButton {container=':Create polyline.Add element_QGroupBox' text='Add' type='QPushButton' unnamed='1' visible='1'}
:Add element.Closed_QCheckBox {container=':Create polyline.Add element_QGroupBox' leftWidget=':Add element.Closed_QLabel' type='QCheckBox' unnamed='1' visible='1'}
:Add element.Closed_QLabel {container=':Create polyline.Add element_QGroupBox' text='Closed' type='QLabel' unnamed='1' visible='1'}
+:Add element.Name_QLabel {container=':Create polyline.Add element_QGroupBox' text='Name' type='QLabel' unnamed='1' visible='1'}
+:Add element.Name_QLineEdit {container=':Create polyline.Add element_QGroupBox' leftWidget=':Add element.Name_QLabel' type='QLineEdit' unnamed='1' visible='1'}
:Add element.Type_QComboBox {container=':Create polyline.Add element_QGroupBox' leftWidget=':Add element.Type_QLabel' type='QComboBox' unnamed='1' visible='1'}
:Add element.Type_QLabel {container=':Create polyline.Add element_QGroupBox' text='Type' type='QLabel' unnamed='1' visible='1'}
:BATHYMETRIES.IGN_pts_utiles_L2e_1_QModelIndex {column='0' container=':HYDRO.BATHYMETRIES_QModelIndex' text='IGN_pts_utiles_L2e_1' type='QModelIndex'}
:Create polyline.Add element_QGroupBox {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' title='Add element' type='QGroupBox' unnamed='1' visible='1'}
:Create polyline.Apply_QPushButton {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' text='Apply' type='QPushButton' unnamed='1' visible='1'}
:Create polyline.Cancel_QPushButton {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' text='Cancel' type='QPushButton' unnamed='1' visible='1'}
+:Create polyline.Edit element_QGroupBox {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' title='Edit element' type='QGroupBox' unnamed='1' visible='1'}
:Create polyline.Name_QLabel {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' text='Name' type='QLabel' unnamed='1' visible='1'}
:Create polyline.Name_QLineEdit {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' leftWidget=':Create polyline.Name_QLabel' type='QLineEdit' unnamed='1' visible='1'}
:Create polyline.Sections_QGroupBox {container=':SALOME *.Create polyline_HYDROGUI_PolylineDlg' title='Sections' type='QGroupBox' unnamed='1' visible='1'}
:Delete objects.Yes_QPushButton {text='Yes' type='QPushButton' unnamed='1' visible='1' window=':Delete objects_HYDROGUI_DeleteDlg'}
:Delete objects_HYDROGUI_DeleteDlg {type='HYDROGUI_DeleteDlg' unnamed='1' visible='1' windowTitle='Delete objects'}
:Delete objects_QTextEdit {type='QTextEdit' unnamed='1' visible='1' window=':Delete objects_HYDROGUI_DeleteDlg'}
+:Edit element.Name_QLabel {container=':Create polyline.Edit element_QGroupBox' text='Name' type='QLabel' unnamed='1' visible='1'}
+:Edit element.Name_QLineEdit {container=':Create polyline.Edit element_QGroupBox' leftWidget=':Edit element.Name_QLabel' type='QLineEdit' unnamed='1' visible='1'}
+:Edit element.Ok_QPushButton {container=':Create polyline.Edit element_QGroupBox' text='Ok' type='QPushButton' unnamed='1' visible='1'}
+:Edit polyline.Apply_QPushButton {container=':SALOME *.Edit polyline_HYDROGUI_PolylineDlg' text='Apply' type='QPushButton' unnamed='1' visible='1'}
+:Edit polyline.Cancel_QPushButton {container=':SALOME *.Edit polyline_HYDROGUI_PolylineDlg' text='Cancel' type='QPushButton' unnamed='1' visible='1'}
+:Edit polyline.Name_QLabel {container=':SALOME *.Edit polyline_HYDROGUI_PolylineDlg' text='Name' type='QLabel' unnamed='1' visible='1'}
+:Edit polyline.Name_QLineEdit {container=':SALOME *.Edit polyline_HYDROGUI_PolylineDlg' leftWidget=':Edit polyline.Name_QLabel' type='QLineEdit' unnamed='1' visible='1'}
+:Edit polyline.Sections_QGroupBox {container=':SALOME *.Edit polyline_HYDROGUI_PolylineDlg' title='Sections' type='QGroupBox' unnamed='1' visible='1'}
:Edit_QMenu {title='Edit' type='QMenu' unnamed='1' visible='1'}
:Exit.Ok_QPushButton {text='Ok' type='QPushButton' unnamed='1' visible='1' window=':Exit_SalomeApp_ExitDlg'}
:Exit_SalomeApp_ExitDlg {type='SalomeApp_ExitDlg' unnamed='1' visible='1' windowTitle='Exit'}
:Import bathymetry from file.File name_QLabel {container=':Import bathymetry.Import bathymetry from file_QGroupBox' text='File name' type='QLabel' unnamed='1' visible='1'}
:Import bathymetry from file.File name_QLineEdit {container=':Import bathymetry.Import bathymetry from file_QGroupBox' leftWidget=':Import bathymetry from file.File name_QLabel' type='QLineEdit' unnamed='1' visible='1'}
:Import bathymetry from file_QToolButton {container=':Import bathymetry.Import bathymetry from file_QGroupBox' type='QToolButton' unnamed='1' visible='1'}
+:Import bathymetry from file_SUIT_FileDlg {name='QFileDialog' type='SUIT_FileDlg' visible='1' windowTitle='Import bathymetry from file'}
:Import bathymetry.Apply_QPushButton {container=':SALOME *.Import bathymetry_HYDROGUI_ImportBathymetryDlg' text='Apply' type='QPushButton' unnamed='1' visible='1'}
:Import bathymetry.Bathymetry name_QGroupBox {container=':SALOME *.Import bathymetry_HYDROGUI_ImportBathymetryDlg' title='Bathymetry name' type='QGroupBox' unnamed='1' visible='1'}
:Import bathymetry.Cancel_QPushButton {container=':SALOME *.Import bathymetry_HYDROGUI_ImportBathymetryDlg' occurrence='2' text='Cancel' type='QPushButton' unnamed='1' visible='1'}
:Import bathymetry.toParentButton_QToolButton {container=':SALOME *.Import bathymetry_HYDROGUI_ImportBathymetryDlg' name='toParentButton' type='QToolButton' visible='1'}
:Insufficient input data.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Insufficient input data_QMessageBox'}
:Insufficient input data_QMessageBox {type='QMessageBox' unnamed='1' visible='1' windowTitle='Insufficient input data'}
+:Local CS transformation.Apply_QPushButton {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' text='Apply' type='QPushButton' unnamed='1' visible='1'}
+:Local CS transformation.LX_QLabel {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' text='LX' type='QLabel' unnamed='1' visible='1'}
+:Local CS transformation.LX_QtxDoubleSpinBox {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' leftWidget=':Local CS transformation.LX_QLabel' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:Local CS transformation.LY_QLabel {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' text='LY' type='QLabel' unnamed='1' visible='1'}
+:Local CS transformation.LY_QtxDoubleSpinBox {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' leftWidget=':Local CS transformation.LY_QLabel' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:Local CS transformation.qt_spinbox_lineedit_QLineEdit {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' name='qt_spinbox_lineedit' type='QLineEdit' visible='1'}
+:Local CS transformation.qt_spinbox_lineedit_QLineEdit_2 {container=':SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg' name='qt_spinbox_lineedit' occurrence='2' type='QLineEdit' visible='1'}
:New Window_QMenu {title='New Window' type='QMenu' unnamed='1' visible='1'}
:Object Browser_QtxTreeView {container=':SALOME *.Object Browser_QtxDockWidget' type='QtxTreeView' unnamed='1' visible='1'}
:Parameters.Polyline_QComboBox {container=':Create immersible zone.Parameters_QGroupBox' leftWidget=':Parameters.Polyline_QLabel' type='QComboBox' unnamed='1' visible='1'}
:SALOME *.Create immersible zone_HYDROGUI_ImmersibleZoneDlg {type='HYDROGUI_ImmersibleZoneDlg' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Create immersible zone'}
:SALOME *.Create immersible zone_QToolButton {text='Create immersible zone' type='QToolButton' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *.Create polyline_HYDROGUI_PolylineDlg {type='HYDROGUI_PolylineDlg' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Create polyline'}
+:SALOME *.Edit polyline_HYDROGUI_PolylineDlg {type='HYDROGUI_PolylineDlg' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Edit polyline'}
:SALOME *.Fit All_QToolButton {text='Fit All' type='QToolButton' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *.HYDRO_QToolButton {text='HYDRO' type='QToolButton' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *.Import bathymetry_HYDROGUI_ImportBathymetryDlg {type='HYDROGUI_ImportBathymetryDlg' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Import bathymetry'}
+:SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg {type='HYDROGUI_LocalCSDlg' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Local CS transformation'}
:SALOME *.OCC scene:1 - viewer:1_OCCViewer_ViewFrame {type='OCCViewer_ViewFrame' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='OCC scene:1 - viewer:1'}
:SALOME *.Object Browser_QtxDockWidget {name='objectBrowserDock' type='QtxDockWidget' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Object Browser'}
:SALOME *.Python Console_QtxDockWidget {name='pythonConsoleDock' type='QtxDockWidget' visible='1' window=':SALOME_STD_TabDesktop' windowTitle='Python Console'}
:SALOME *.SVTK_RenderWindowInteractor_SVTK_RenderWindowInteractor {name='SVTK_RenderWindowInteractor' type='SVTK_RenderWindowInteractor' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *.Show/Hide trihedron_QToolButton {text='Show/Hide trihedron' type='QToolButton' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *.Undo_QToolButton {text='Undo' type='QToolButton' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
+:SALOME *.Zoom_QToolButton {text='Zoom' type='QToolButton' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *_GraphicsView_ViewPort {type='GraphicsView_ViewPort' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
+:SALOME *_QMenu {type='QMenu' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *_QSizeGrip {type='QSizeGrip' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
+:SALOME *_QStatusBar {type='QStatusBar' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME *_QtxWorkstackTabBar {type='QtxWorkstackTabBar' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME_QMenuBar {type='QMenuBar' unnamed='1' visible='1' window=':SALOME_STD_TabDesktop'}
:SALOME_STD_TabDesktop {type='STD_TabDesktop' unnamed='1' visible='1' windowTitle?='SALOME *'}
+:Sections.0_QModelIndex {column='1' container=':Sections.Sections_CurveCreator_TreeView' text='0' type='QModelIndex'}
+:Sections.0_QModelIndex_2 {column='1' container=':Sections.Sections_CurveCreator_TreeView' occurrence='2' text='0' type='QModelIndex'}
:Sections.Addition mode_QToolButton {container=':Create polyline.Sections_QGroupBox' text='Addition mode' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Detection mode_QToolButton {container=':Create polyline.Sections_QGroupBox' text='Detection mode' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Join_QToolButton {container=':Edit polyline.Sections_QGroupBox' text='Join' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Modification mode_QToolButton {container=':Edit polyline.Sections_QGroupBox' text='Modification mode' type='QToolButton' unnamed='1' visible='1'}
:Sections.New section_QToolButton {container=':Create polyline.Sections_QGroupBox' text='New section' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Open_spline_QModelIndex {column='0' container=':Sections.Sections_CurveCreator_TreeView' text='Open_spline' type='QModelIndex'}
+:Sections.Redo_QToolButton {container=':Create polyline.Sections_QGroupBox' text='Redo' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Redo_QToolButton_2 {container=':Edit polyline.Sections_QGroupBox' text='Redo' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Remove_QToolButton {container=':Edit polyline.Sections_QGroupBox' text='Remove' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Sections_CurveCreator_TreeView {aboveWidget=':Sections.Sections_QToolBar' container=':Create polyline.Sections_QGroupBox' type='CurveCreator_TreeView' unnamed='1' visible='1'}
+:Sections.Sections_CurveCreator_TreeView_2 {aboveWidget=':Sections.Sections_QToolBar_2' container=':Edit polyline.Sections_QGroupBox' type='CurveCreator_TreeView' unnamed='1' visible='1'}
+:Sections.Sections_QToolBar {container=':Create polyline.Sections_QGroupBox' type='QToolBar' unnamed='1' visible='1' windowTitle='Sections'}
+:Sections.Sections_QToolBar_2 {container=':Edit polyline.Sections_QGroupBox' type='QToolBar' unnamed='1' visible='1' windowTitle='Sections'}
+:Sections.Undo_QToolButton {container=':Create polyline.Sections_QGroupBox' text='Undo' type='QToolButton' unnamed='1' visible='1'}
+:Sections.Undo_QToolButton_2 {container=':Edit polyline.Sections_QGroupBox' text='Undo' type='QToolButton' unnamed='1' visible='1'}
+:Sections.qt_toolbar_ext_button_QToolBarExtension {container=':Create polyline.Sections_QGroupBox' name='qt_toolbar_ext_button' type='QToolBarExtension' visible='1'}
+:Sections.qt_toolbar_ext_button_QToolBarExtension_2 {container=':Edit polyline.Sections_QGroupBox' name='qt_toolbar_ext_button' type='QToolBarExtension' visible='1'}
+:Sections_CurveCreator_TableView {container=':Edit polyline.Sections_QGroupBox' type='CurveCreator_TableView' unnamed='1' visible='1'}
:Select Color.Basic colors_QLabel {text='Basic colors' type='QLabel' unnamed='1' visible='1' window=':Select Color_QColorDialog'}
:Select Color.OK_QPushButton {text='OK' type='QPushButton' unnamed='1' visible='1' window=':Select Color_QColorDialog'}
:Select Color_QColorDialog {type='QColorDialog' unnamed='1' visible='1' windowTitle='Select Color'}
:Window_QMenu {title='Window' type='QMenu' unnamed='1' visible='1'}
:Zone name.Name_QLabel {container=':Create immersible zone.Zone name_QGroupBox' text='Name' type='QLabel' unnamed='1' visible='1'}
:Zone name.Name_QLineEdit {container=':Create immersible zone.Zone name_QGroupBox' leftWidget=':Zone name.Name_QLabel' type='QLineEdit' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox {columnIndex='2' container=':Sections_CurveCreator_TableView' rowIndex='0' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_2 {columnIndex='3' container=':Sections_CurveCreator_TableView' rowIndex='0' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_3 {columnIndex='2' container=':Sections_CurveCreator_TableView' rowIndex='1' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_4 {columnIndex='3' container=':Sections_CurveCreator_TableView' rowIndex='1' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_5 {columnIndex='2' container=':Sections_CurveCreator_TableView' rowIndex='2' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_6 {columnIndex='3' container=':Sections_CurveCreator_TableView' rowIndex='2' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_7 {columnIndex='2' container=':Sections_CurveCreator_TableView' rowIndex='3' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
+:_QtxDoubleSpinBox_8 {columnIndex='3' container=':Sections_CurveCreator_TableView' rowIndex='3' type='QtxDoubleSpinBox' unnamed='1' visible='1'}
:_QtxMenu {type='QtxMenu' unnamed='1' visible='1'}
:fileNameEdit_QLineEdit {buddy=':Import bathymetry.File name:_QLabel' name='fileNameEdit' type='QLineEdit' visible='1'}
:frame.stackedWidget_QStackedWidget {container=':splitter.frame_QFrame' name='stackedWidget' type='QStackedWidget' visible='1'}
--- /dev/null
+"""
+This test case corresponds to HYDRO-002 (Polyline creation/edition and operations with it) scenario
+"""
+
+import os
+import tempfile
+import shutil
+
+def main():
+ # Prepare test data
+ global TEST_FILES_DIR
+ TEST_FILES_DIR = os.getenv("TEST_FILES_DIR")
+
+ global APPSETTINGS
+ APPSETTINGS = os.path.join(TEST_FILES_DIR, "SalomeApp.xml")
+
+ source(os.path.join(os.getenv("COMMON_SCRIPT_DIR"), "common_hydro.py"))
+
+ # Run test
+ os.system("killSalome.py") #@MZN
+ runCase()
+
+ # Kill SALOME
+ os.system("killSalome.py")
+
+def runCase():
+ S1() # Creating a new study
+ S2() # Create polyline using Addition and Detection modes
+ S3() # Edit polyline
+ S4() # Show/hide polyline
+ S5() # Delete polyline
+ S6() # Change local CS
+
+"""
+Creating a new study.
+"""
+def S1():
+
+ # Title 1: Creating a new study
+
+ # 1. Start the application
+ startApplication("runSalome.py --modules=HYDRO,GEOM,SMESH -r %s" % APPSETTINGS)
+ waitFor("object.exists(':SALOME_STD_TabDesktop')", 100000)
+
+ # 2. File - New
+ activateMenuItem("File", "New")
+
+ # 3. New study window appears including Object Browser and Python console
+ checkObjectBrowser()
+ checkPythonConsole()
+
+ # 4. Select HYDRO in the list of modules, located in the toolbar
+ # 5. Graphics scene and OCC scene appear
+ activateHYDRO()
+
+ showTrihedron(False) # Hide trihedron
+
+
+"""
+Create polyline using Addition and Detection modes.
+"""
+def S2():
+
+ # Title 2: Create polyline using Addition and Detection modes
+
+ # 1. HYDRO - Create polyline
+ activateMenuItem("HYDRO", "Create polyline")
+ fitAll() #@MZN
+
+ # 2. "Create polyline" panel appears. Check that default name is "Polyline_1"
+ panel = waitForObject(":SALOME *.Create polyline_HYDROGUI_PolylineDlg")
+ test.compare(str(panel.windowTitle), "Create polyline")
+
+ name_edit = waitForObject(":Create polyline.Name_QLineEdit")
+ test.compare(str(name_edit.text), "Polyline_1")
+
+ # 3. Type name "MyPolyline" in the "Name" section
+ setInputFieldValue(name_edit, "MyPolyline")
+
+ # 4. Click "Insert new section" button
+ new_section_btn = waitForObject(":Sections.New section_QToolButton")
+ clickButton(new_section_btn)
+
+ # 5. "Add element" panel appears. Check that default name is "Section_1":
+ add_panel = waitForObject(":Create polyline.Add element_QGroupBox")
+ test.compare(str(add_panel.title), "Add element")
+
+ section_name_edit = waitForObject(":Add element.Name_QLineEdit")
+ test.compare(str(section_name_edit.text), "Section_1")
+
+ # Click Cancel button - no changes in Sections list
+ sections_list_name = ":Sections.Sections_CurveCreator_TreeView"
+ waitFor("object.exists(':Sections.Sections_CurveCreator_TreeView')", 20000)
+ sections_list = findObject(sections_list_name)
+
+ test.compare(getTreeNames(sections_list), [])
+ clickButton(waitForObject(":Create polyline.Cancel_QPushButton"))
+ test.compare(getTreeNames(sections_list), [])
+
+ # 7. Click "Insert new section" button
+ clickButton(new_section_btn)
+
+ # 8. Click Add button
+ clickButton(waitForObject(":Add element.Add_QPushButton"))
+
+ # 9. Click "Insert new section" button
+ clickButton(new_section_btn)
+
+ # 10. Remove the tick in "Closed" checkbox
+ setButtonChecked(waitForObject(":Add element.Closed_QCheckBox"), False)
+
+ # 11. Type name "Open_polyline"
+ setInputFieldValue(waitForObject(":Add element.Name_QLineEdit"), "Open_polyline")
+
+ # 12. Click "Add" button
+ clickButton(waitForObject(":Add element.Add_QPushButton"))
+
+ # 13. Click "Insert new section" button
+ clickButton(new_section_btn)
+
+ # 14. As Type select Spline
+ selectComboBoxItem(waitForObject(":Add element.Type_QComboBox"), "Spline")
+
+ # 15. Type name "Closed_spline"
+ setInputFieldValue(waitForObject(":Add element.Name_QLineEdit"), "Closed_spline")
+
+ # 16. Click "Add" button
+ clickButton(waitForObject(":Add element.Add_QPushButton"))
+
+ # 17. Click "Insert new section" button
+ clickButton(new_section_btn)
+
+ # 18. As Type select Spline
+ selectComboBoxItem(waitForObject(":Add element.Type_QComboBox"), "Spline")
+
+ # 19. Remove the tick in "Closed" checkbox
+ setButtonChecked(waitForObject(":Add element.Closed_QCheckBox"), False)
+
+ # 20. Type name "Open_spline"
+ setInputFieldValue(waitForObject(":Add element.Name_QLineEdit"), "Open_spline")
+
+ # 21. Click "Add" button
+ clickButton(waitForObject(":Add element.Add_QPushButton"))
+
+ # 22. Double click on "Section_1" object
+ doubleClickObjectItem(sections_list_name, "Section_1")
+
+ # 23. "Edit element" panel appears:
+ edit_element_panel = waitForObject(":Create polyline.Edit element_QGroupBox")
+ test.compare(str(edit_element_panel.title), "Edit element")
+
+ # 24. Type new name "Closed_polyline" and click OK button
+ setInputFieldValue(waitForObject(":Edit element.Name_QLineEdit"), "Closed_polyline")
+ clickButton(waitForObject(":Edit element.Ok_QPushButton"))
+
+ # 25. Check the list of sections, located inside "Create polyline" panel. each type of sections has own label:
+ sections_list.clearSelection()
+ test.vp("VP1")
+
+ # 26. Select "Closed_polyline" and click "Addition mode" button
+ clickObjectItem(sections_list_name, "Closed_polyline")
+ clickButton(waitForObject(":Sections.Addition mode_QToolButton"))
+
+ # 27. Create polyline consisting of 5 points
+ five_points = [(452, 134), (617, 71), (853, 100), (829, 193), (579, 172)]
+ addPolylinePoints(five_points)
+
+ # 28. Select "Open_polyline" and create polyline in OCC viewer consisting form 3 points
+ clickObjectItem(sections_list_name, "Open_polyline")
+
+ three_points = [(421, 280), (642, 243), (806, 295)]
+ addPolylinePoints(three_points)
+
+ # 29. Select "Closed_spline" and create spline in OCC viewer consisting form 4 points
+ clickObjectItem(sections_list_name, "Closed_spline")
+
+ four_points = [(422, 409), (537, 382), (770, 390), (751, 474)]
+ addPolylinePoints(four_points)
+
+ # 30. Select "Open_spline" and create spline in OCC viewer consisting form 6 points
+ clickObjectItem(sections_list_name, "Open_spline")
+
+ six_points = [(377, 598), (436, 567), (535, 599), (622, 578), (679, 606), (772, 581)]
+ addPolylinePoints(six_points)
+
+ # 31. Check the result:
+ test.vp("VP2") # OCC viewer
+
+ sections_list.clearSelection()
+ test.vp("VP3") # Sections list widget
+
+ # 31. Click Undo button 10 times
+ for i in xrange(1, 11):
+ clickButton(waitForObject(":Sections.Undo_QToolButton"))
+
+ # 33. Check that "Closed_spline" and "Open_spline" don't contain points now
+ #TODO: simplify
+ #waitFor("object.exists(':Sections.0_QModelIndex')", 20000)
+ #test.compare(findObject(":Sections.0_QModelIndex").text, "0")
+ #waitFor("object.exists(':Sections.Open_spline_QModelIndex')", 20000)
+ #test.compare(findObject(":Sections.Open_spline_QModelIndex").text, "Open_spline")
+ #waitFor("object.exists(':Sections.0_QModelIndex_2')", 20000)
+ #test.compare(findObject(":Sections.0_QModelIndex_2").row, 3)
+ #Test.compare(findObject(":Sections.0_QModelIndex_2").column, 1)
+ #test.compare(findObject(":Sections.0_QModelIndex_2").text, "0")
+
+ # 34. Click Redo button 10 times
+ for i in xrange(1, 11):
+ clickButton(waitForObject(":Sections.Redo_QToolButton"))
+
+ # 35. Click Apply button
+ clickButton(waitForObject(":Create polyline.Apply_QPushButton"))
+
+ # 36. "MyPolyline" object appears in Object Browser as a child of "POLYLINES" branch
+ checkOBItem("HYDRO", "POLYLINES", "MyPolyline")
+
+ # CREATION OF POLYLINE WITH HELP OF DETECTION MODE: TO BE DONE
+
+
+"""
+Edit polyline.
+"""
+def S3():
+
+ # Title 3: Edit polyline
+
+ # 1. Select "MyPolyline" in Object browser
+ # 2. Call its context menu - Edit polyline
+ activateOBContextMenuItem("HYDRO.POLYLINES", "MyPolyline", "Edit polyline")
+
+ # 3. "Edit" polyline panel appears:
+ panel = waitForObject(":SALOME *.Edit polyline_HYDROGUI_PolylineDlg")
+ test.compare(str(panel.windowTitle), "Edit polyline")
+
+ sections_list_name = ":Sections.Sections_CurveCreator_TreeView_2"
+ sections_list = waitForObject(sections_list_name)
+
+ # 4. Type new name "Polyline_1"
+ setInputFieldValue(waitForObject(":Edit polyline.Name_QLineEdit"), "Polyline_1")
+
+ # 5. Select "Open_polyline" section
+ clickObjectItem(sections_list, "Open_polyline")
+
+ # 6. Click "Remove" button
+ mouseDrag(waitForObject(":SALOME_STD_TabDesktop"), 1649, 420, -64, 1, 1, Qt.LeftButton) #TODO: resize the panel in another way
+ clickButton(waitForObject(":Sections.Remove_QToolButton"))
+
+ # 7. "Open_polyline" object disappears from the list of sections
+ #TODO: check list of sections context
+
+ # 8. Select "Closed_spline" and "Open_spline" objects in Sections panel
+ clickObjectItem(sections_list, "Closed_spline")
+ clickObjectItem(sections_list, "Open_spline", Qt.ControlModifier)
+
+ # 9. Click "Join selected sections" button
+ clickButton(waitForObject(":Sections.Join_QToolButton"))
+
+ # 10. New section, consisting from 10 points appears in the list of sections
+ #TODO: check than "Closed_spline" appears and consists of 10 points
+
+ # 11. Click Undo button 2 times
+ clickButton(waitForObject(":Sections.Undo_QToolButton_2"))
+ clickButton(waitForObject(":Sections.Undo_QToolButton_2"))
+
+ # 12. Check that all 4 sections are in the list like in step 3.3
+ sections_list.clearSelection()
+ test.vp("VP7") # Sections list widget
+
+ # 13. Activate Modification mode by clicking corresponding button
+ clickButton(waitForObject(":Sections.Modification mode_QToolButton"))
+
+ # 14. Select some point in OCC view and drag it to another position
+ occMouseClick(452, 137)
+ occMouseDrag(452, 137, 77, -115)
+
+ # 15. Repeat previous step with each section
+ occMouseClick(642, 244)
+ occMouseDrag(642, 244, -180, 86)
+ occMouseClick(754, 477)
+ occMouseDrag(752, 477, 119, 37)
+ occMouseClick(619, 577)
+ occMouseDrag(621, 581, -15, 74)
+
+ # 16. Click on the segment of the sector - new points have been created and appeared on the place, where you click
+ occMouseClick(10, 10) # clear point selection
+
+ # Add 3 points to "Closed_polyline"
+ occMouseClick(723, 87)
+ occMouseClick(649, 180)
+ occMouseClick(841, 148)
+
+ occMouseClick(10, 10) # clear point selection
+ test.vp("VP4")
+
+ # 17. Check that the number of points, located in the modified sector increases after each point addition
+ #TODO: Check number of pointsin "Closed_polyline" increases from 5 to 8
+
+ # 18. Add some points to each sector. Check the result - as old representations of sectors are shown as far as new representations:
+ occMouseClick(619, 315) # Add point to "Open_polyline"
+ occMouseClick(563, 503) # Add point to "Closed_spline"
+ occMouseClicks([(567, 629), (652, 631)]) # Add 2 points to "Open_spline"
+
+ occMouseClick(10, 10) # clear point selection
+ test.vp("VP5")
+
+ # 19. Click Apply button
+ clickButton(waitForObject(":Edit polyline.Apply_QPushButton"))
+
+ # 20. Modified object "Polyline_1" has appeared in Object browser and in OCC view
+ checkOBItemNotExists("HYDRO", "POLYLINES", "MyPolyline")
+ checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
+
+ fitAll()
+ test.vp("VP6") # OCC view
+
+ # 21. Select "MyPolyline" in Object browser
+ # 22. Call its context menu - Edit polyline
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Edit polyline")
+
+ # 23. "Edit" polyline panel appears:
+ panel = waitForObject(":SALOME *.Edit polyline_HYDROGUI_PolylineDlg")
+
+ waitFor("object.exists(':Sections.Sections_CurveCreator_TreeView')", 20000)
+ sections_list = findObject(sections_list_name)
+
+ # 24. Activate Modification mode
+ clickButton(waitForObject(":Sections.Modification mode_QToolButton"))
+
+ # 25. Select all points from "Closed_polyline" except 4 points on the right with the help of rectangle
+ occMouseDrag(513, 0, 195, 205)
+ # occMouseDrag(511, 11, 204, 196) #MZN
+
+ # 26. Click Remove button
+ clickButton(waitForObject(":Sections.Remove_QToolButton"))
+
+ # 27. Select remaining 4 points
+ occMouseDrag(730, 45, 240, 190)
+ #occMouseDrag(690, 63, 176, 152) #MZN
+
+ # 28. Table with coordinates appears. Input following coordinates:
+ table_name = ":Sections_CurveCreator_TableView"
+ waitFor("object.exists(':Sections_CurveCreator_TableView')", 20000)
+ test.compare(findObject(table_name).visible, True)
+
+ doubleClickObjectItem(table_name, "0/2")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox"), "155")
+
+ doubleClickObjectItem(table_name, "0/3")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_2"), "704")
+
+ doubleClickObjectItem(table_name, "1/2")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_3"), "340")
+
+ doubleClickObjectItem(table_name, "1/3")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_4"), "704")
+
+ doubleClickObjectItem(table_name, "2/2")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_5"), "340")
+
+ doubleClickObjectItem(table_name, "2/3")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_6"), "530")
+
+ doubleClickObjectItem(table_name, "3/2")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_7"), "155")
+
+ doubleClickObjectItem(table_name, "3/3")
+ setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_8"), "530")
+
+ type(waitForObject(":_QtxDoubleSpinBox_8"), "<Tab>")
+
+ # 29. Check the result:
+ occMouseClick(10, 10) # clear point selection
+ fitAll()
+
+ test.vp("VP8")
+
+ # 30. Select "Closed_spline" in Sections table, call context menu - Set open
+ openItemContextMenu(waitForObject(sections_list_name), "Closed\\_spline", 73, 12, 0)
+ activateItem(waitForObjectItem(":SALOME *_QMenu", "Set open"))
+
+ # 31. Section has became open as in OCC viewer as far in Sections table
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Hide") # hide the edited polyline
+
+ test.vp("VP9") # OCC view
+
+ sections_list.clearSelection()
+ test.vp("VP10") # Sections list
+
+ # 32. Activate Modification mode
+ clickButton(waitForObject(":Sections.Modification mode_QToolButton"))
+
+ # 33. Select "Closed_spline" section and call its context menu
+ # 34. Set polyline
+ openItemContextMenu(waitForObject(sections_list_name), "Closed\\_spline", 73, 12, 0)
+ activateItem(waitForObjectItem(":SALOME *_QMenu", "Set polyline"))
+
+ # 35. Section has become polyline:
+ test.vp("VP11") # OCC view
+
+ sections_list.clearSelection()
+ test.vp("VP12") # Sections list
+
+ # 36. Click Cancel button in "Edit polyline" panel
+ clickButton(waitForObject(":Edit polyline.Cancel_QPushButton"))
+
+ # 37. Select Polyline_1 in Object browser
+ # 38. Call context menu - Edit polyline
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Edit polyline")
+
+ fitAll()
+ test.vp("VP13")
+ test.vp("VP14")
+
+ clickButton(waitForObject(":Edit polyline.Cancel_QPushButton"))
+
+"""
+Show/hide polyline.
+"""
+def S4():
+
+ # Title 4: Show/hide polyline
+
+ # 1. Select "POLYLINES" in Object browser, call context menu - "Create polyline"
+ activateOBContextMenuItem("HYDRO", "POLYLINES", "Create polyline")
+
+ # 2. Create polyline, consisting from 1 closed polyline section, click Apply:
+ addPolylineSection(True)
+ addPolylinePoints([(515, 203), (661, 119), (759, 200), (814, 375), (630, 435), (449, 416)])
+
+ clickButton(waitForObject(":Create polyline.Apply_QPushButton"))
+
+ # 3. Select Polyline_1 in Object browser
+ # 4. Call context menu - Show only
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Show only")
+
+ # 5. Fit all
+ fitAll()
+
+ # 6. Only Polyline_1 is shown in OCC viewer
+ deselectAll()
+ test.vp("VP6")
+
+ # 7. Select Polyline_2 in Object browser
+ # 8. Call context menu - Show
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_2", "Show")
+
+ # 9. Fit all
+ fitAll()
+
+ # 10. Both polylines are shown in OCC view
+ deselectAll()
+ test.vp("VP15")
+
+ # 11. Call context menu in OCC viewer - Hide all
+ occHideAll()
+
+ # 12. Nothing is shown in OCC view
+ test.vp("vp_empty_occ_view")
+
+ # 13. Call context menu in OCC viewer - Show all
+ occShowAll()
+
+ # 14. Both polylines are shown in OCC view
+ test.vp("VP15")
+
+ # 15. Alt + K
+ # type(waitForObject(":SALOME_STD_TabDesktop"), "<Alt+K>") #TODO: <Alt+K> doesn't work
+ activateMenuItem("Window", "New Window", "VTK 3D view")
+
+ # 16. New VTK scene appears
+ waitFor("object.exists(':SALOME *.SVTK_RenderWindowInteractor_SVTK_RenderWindowInteractor')", 20000)
+ test.compare(findObject(":SALOME *.SVTK_RenderWindowInteractor_SVTK_RenderWindowInteractor").visible, True)
+ showTrihedron(False) # Hide trihedron
+
+ # 17. Select Polyline_1 in Object browser
+ # 18. Call context menu - Show only
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Show only")
+
+ # 19. Fit all
+ fitAll()
+
+ # 20. Only Polyline_1 is shown in VTK viewer
+ test.vp("VP16")
+
+ # 21. Select Polyline_2 in Object browser
+ # 22. Call context menu - Show
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_2", "Show")
+
+ # 23. Fit all
+ fitAll()
+
+ # 24. Both polylines are shown in VTK view
+ test.vp("VP17")
+
+ # 25. Call context menu in VTK viewer - Hide all
+ vtkHideAll()
+
+ # 26. Nothing is shown in VTK view
+ test.vp("vp_empty_vtk_view")
+
+ # 27. Call context menu in VTK viewer - Show all
+ vtkShowAll()
+
+ # 28. Both of polylines are shown in VTK view
+ test.vp("VP18")
+
+
+"""
+Delete polyline.
+"""
+def S5():
+
+ # Title 5: Delete polyline
+
+ # 0. Activate OCC 3D view
+ clickTab(waitForObject(":SALOME *_QtxWorkstackTabBar"), "OCC scene:1 - viewer:1")
+
+ # 1. Select Polyline_1
+ # 2. Call context menu - Delete
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Delete")
+
+ # 3. Delete objects" dialog appear
+ delete_dlg = waitForObject(":Delete objects_HYDROGUI_DeleteDlg")
+ test.compare(str(delete_dlg.windowTitle), "Delete objects")
+ objects_list_text = waitForObject(":Delete objects_QTextEdit")
+ test.compare(objects_list_text.plainText, "- Polyline_1")
+
+ # 4. Click No
+ clickButton(waitForObject(":Delete objects.No_QPushButton"))
+
+ # 5. Nothing happens
+ deselectAll()
+
+ test.vp("VP15")
+ checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
+
+ # 6. Select Polyline_1
+ # 7. Call context menu - Delete
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Delete")
+
+ # 8. Delete objects" dialog appear
+ waitForObject(":Delete objects_HYDROGUI_DeleteDlg")
+
+ # 9. Click Yes
+ clickButton(waitForObject(":Delete objects.Yes_QPushButton"))
+
+ # 10. Polyline_1 disappears as from OCC view as far from Object browser
+ checkOBItemNotExists("HYDRO", "POLYLINES", "Polyline_1")
+ test.vp("VP19")
+
+ # 11. Click Undo button
+ clickButton(waitForObject(":SALOME *.Undo_QToolButton"))
+
+ # 12. Polyline_1 appears in OCC view and Object browser
+ test.vp("VP15")
+ checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
+
+ # 13. Select Polyline_1 and Polyline_2
+ selectObjectBrowserItem("Polyline_1", "HYDRO.POLYLINES")
+ selectObjectBrowserItem("Polyline_2", "HYDRO.POLYLINES", modifier=Qt.ControlModifier)
+
+ # 14. Click Delete button
+ type(waitForObject(":SALOME_STD_TabDesktop"), "<Del>")
+
+ # 15. Delete objects dialog appears:
+ waitForObject(":Delete objects_HYDROGUI_DeleteDlg")
+ objects_list_text = waitForObject(":Delete objects_QTextEdit")
+ test.compare(objects_list_text.plainText, "- Polyline_1\n- Polyline_2")
+
+ # 16. Click Yes
+ clickButton(waitForObject(":Delete objects.Yes_QPushButton"))
+
+ # 17. Both polylines disappear from OCC view and Object browser
+ checkOBItemNotExists("HYDRO", "POLYLINES", "Polyline_1")
+ checkOBItemNotExists("HYDRO", "POLYLINES", "Polyline_2")
+ test.vp("vp_empty_occ_view")
+
+ # 18. Click Undo button
+ clickButton(waitForObject(":SALOME *.Undo_QToolButton"))
+
+ # 19. Polyline_1 and Polyline_2 appear in OCC view and Object browser
+ test.vp("VP15")
+ checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
+ checkOBItem("HYDRO", "POLYLINES", "Polyline_2")
+
+
+"""
+Change local CS.
+"""
+def S6():
+
+ # Title 6: Change local CS
+
+ # 1. Select Polyline_2
+ # 2. Call context menu - Show only
+ activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_2", "Show only")
+
+ # 3. Check local and global coordinates of bottom vertex of polyline
+ occMouseClick(798, 438)
+
+ lc1 = getLocalCoordinates()
+ gc1 = getGlobalCoordinates()
+
+ test.verify(lc1 == gc1)
+
+ # 4. HYDRO - Change local CS
+ activateMenuItem("HYDRO", "Change local CS")
+
+ # 5. Local CS transformation panel appears. Check that default LX=0, LY=0
+ cs_panel = waitForObject(":SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg")
+ test.compare(str(cs_panel.windowTitle), "Local CS transformation")
+
+ lx_edit = waitForObject(":Local CS transformation.qt_spinbox_lineedit_QLineEdit")
+ test.compare(str(lx_edit.text), "0")
+
+ ly_edit = waitForObject(":Local CS transformation.qt_spinbox_lineedit_QLineEdit_2")
+ test.compare(str(ly_edit.text), "0")
+
+ # 6. Set LX=20000, LY=400
+ lx = 20000
+ ly = 400
+
+ setInputFieldValue(lx_edit, lx)
+ setInputFieldValue(lx_edit, ly)
+
+ # 7. Check local and global coordinates of bottom vertex of polyline. Difference between values
+ # of local CS and global CS is equal to LX and LY
+ occMouseClick(798, 438)
+
+ lc2 = getLocalCoordinates()
+ gc2 = getGlobalCoordinates()
+
+ test.compare(gc2[0] - lc2[0], lx)
+ test.compare(gc2[1] - lc2[1], ly)
+
+