Salome HOME
appying 2to3
[modules/hydro.git] / squish.suite / suit_polylines.suite / tst_case1 / test.py
1 """
2 This test case corresponds to HYDRO-002 (Polyline creation/edition and operations with it) scenario
3 """
4
5 import os
6 import tempfile
7 import shutil
8
9 def main():
10     # Prepare test data
11     global TEST_FILES_DIR
12     TEST_FILES_DIR = os.getenv("TEST_FILES_DIR")
13
14     global APPSETTINGS
15     APPSETTINGS = os.path.join(TEST_FILES_DIR, "SalomeApp.xml")
16
17     source(os.path.join(os.getenv("COMMON_SCRIPT_DIR"), "common_hydro.py"))
18
19     # Run test
20     os.system("killSalome.py") #@MZN
21     runCase()
22     
23     # Kill SALOME
24     os.system("killSalome.py")
25
26 def runCase():
27     S1() # Creating a new study
28     S2() # Create polyline using Addition and Detection modes
29     S3() # Edit polyline
30     S4() # Show/hide polyline
31     S5() # Delete polyline
32     S6() # Change local CS
33     
34 """
35 Creating a new study.
36 """
37 def S1():
38
39     # Title 1: Creating a new study
40     
41     # 1. Start the application
42     startApplication("runSalome.py --modules=HYDRO,GEOM,SMESH -r %s" % APPSETTINGS)
43     waitFor("object.exists(':SALOME_STD_TabDesktop')", 100000)
44       
45     # 2. File - New
46     activateMenuItem("File", "New")
47     
48     # 3. New study window appears including Object Browser and Python console
49     checkObjectBrowser()
50     checkPythonConsole()
51    
52     # 4. Select HYDRO in the list of modules, located in the toolbar
53     # 5. Graphics scene and OCC scene appear
54     activateHYDRO()
55
56     showTrihedron(False) # Hide trihedron
57
58     
59 """
60 Create polyline using Addition and Detection modes.
61 """
62 def S2():
63     
64     # Title 2: Create polyline using Addition and Detection modes
65     
66     # 1. HYDRO - Create polyline
67     activateMenuItem("HYDRO", "Create polyline")
68     fitAll() #@MZN
69     
70     # 2. "Create polyline" panel appears. Check that default name is "Polyline_1"
71     panel = waitForObject(":SALOME *.Create polyline_HYDROGUI_PolylineDlg")
72     test.compare(str(panel.windowTitle), "Create polyline")
73     
74     name_edit = waitForObject(":Create polyline.Name_QLineEdit")
75     test.compare(str(name_edit.text), "Polyline_1")
76     
77     # 3. Type name "MyPolyline" in the "Name" section
78     setInputFieldValue(name_edit, "MyPolyline")
79
80     # 4. Click "Insert new section" button
81     new_section_btn = waitForObject(":Sections.New section_QToolButton")
82     clickButton(new_section_btn)
83     
84     # 5. "Add element" panel appears. Check that default name is "Section_1":
85     add_panel = waitForObject(":Create polyline.Add element_QGroupBox")
86     test.compare(str(add_panel.title), "Add element")
87     
88     section_name_edit = waitForObject(":Add element.Name_QLineEdit")
89     test.compare(str(section_name_edit.text), "Section_1")
90     
91     # Click Cancel button - no changes in Sections list
92     sections_list_name = ":Sections.Sections_CurveCreator_TreeView"
93     waitFor("object.exists(':Sections.Sections_CurveCreator_TreeView')", 20000)
94     sections_list = findObject(sections_list_name)
95
96     test.compare(getTreeNames(sections_list), [])
97     clickButton(waitForObject(":Create polyline.Cancel_QPushButton"))
98     test.compare(getTreeNames(sections_list), [])
99         
100     # 7. Click "Insert new section" button
101     clickButton(new_section_btn)
102     
103     # 8. Click Add button
104     clickButton(waitForObject(":Add element.Add_QPushButton"))
105     
106     # 9. Click "Insert new section" button
107     clickButton(new_section_btn)
108         
109     # 10. Remove the tick in "Closed" checkbox
110     setButtonChecked(waitForObject(":Add element.Closed_QCheckBox"), False)
111     
112     # 11. Type name "Open_polyline"
113     setInputFieldValue(waitForObject(":Add element.Name_QLineEdit"), "Open_polyline")
114     
115     # 12. Click "Add" button
116     clickButton(waitForObject(":Add element.Add_QPushButton"))
117     
118     # 13. Click "Insert new section" button
119     clickButton(new_section_btn)
120     
121     # 14. As Type select Spline
122     selectComboBoxItem(waitForObject(":Add element.Type_QComboBox"), "Spline")
123     
124     # 15. Type name "Closed_spline"
125     setInputFieldValue(waitForObject(":Add element.Name_QLineEdit"), "Closed_spline")
126     
127     # 16. Click "Add" button
128     clickButton(waitForObject(":Add element.Add_QPushButton"))
129     
130     # 17. Click "Insert new section" button
131     clickButton(new_section_btn)
132     
133     # 18. As Type select Spline
134     selectComboBoxItem(waitForObject(":Add element.Type_QComboBox"), "Spline")
135     
136     # 19. Remove the tick in "Closed" checkbox
137     setButtonChecked(waitForObject(":Add element.Closed_QCheckBox"), False)
138    
139     # 20. Type name "Open_spline"
140     setInputFieldValue(waitForObject(":Add element.Name_QLineEdit"), "Open_spline")
141     
142     # 21. Click "Add" button
143     clickButton(waitForObject(":Add element.Add_QPushButton"))
144     
145     # 22. Double click on "Section_1" object
146     doubleClickObjectItem(sections_list_name, "Section_1")
147     
148     # 23. "Edit element" panel appears:
149     edit_element_panel = waitForObject(":Create polyline.Edit element_QGroupBox")
150     test.compare(str(edit_element_panel.title), "Edit element")
151     
152     # 24. Type new name "Closed_polyline" and click OK button
153     setInputFieldValue(waitForObject(":Edit element.Name_QLineEdit"), "Closed_polyline")
154     clickButton(waitForObject(":Edit element.Ok_QPushButton"))
155     
156     # 25. Check the list of sections, located inside "Create polyline" panel. each type of sections has own label:
157     sections_list.clearSelection()
158     test.vp("VP1")
159     
160     # 26. Select "Closed_polyline" and click "Addition mode" button
161     clickObjectItem(sections_list_name, "Closed_polyline")
162     clickButton(waitForObject(":Sections.Addition mode_QToolButton"))
163     
164     # 27. Create polyline consisting of 5 points
165     five_points = [(452, 134), (617, 71), (853, 100), (829, 193), (579, 172)]
166     addPolylinePoints(five_points)
167     
168     # 28. Select "Open_polyline" and create polyline in OCC viewer consisting form 3 points
169     clickObjectItem(sections_list_name, "Open_polyline")
170     
171     three_points = [(421, 280), (642, 243), (806, 295)]
172     addPolylinePoints(three_points)
173             
174     # 29. Select "Closed_spline" and create spline in OCC viewer consisting form 4 points
175     clickObjectItem(sections_list_name, "Closed_spline")
176     
177     four_points = [(422, 409), (537, 382), (770, 390), (751, 474)]
178     addPolylinePoints(four_points)
179
180     # 30. Select "Open_spline" and create spline in OCC viewer consisting form 6 points
181     clickObjectItem(sections_list_name, "Open_spline")
182     
183     six_points = [(377, 598), (436, 567), (535, 599), (622, 578), (679, 606), (772, 581)]
184     addPolylinePoints(six_points)
185     
186     # 31. Check the result:
187     test.vp("VP2") # OCC viewer
188     
189     sections_list.clearSelection()
190     test.vp("VP3")  # Sections list widget
191     
192     # 31. Click Undo button 10 times
193     for i in range(1, 11):
194         clickButton(waitForObject(":Sections.Undo_QToolButton"))
195         
196     # 33. Check that "Closed_spline" and "Open_spline" don't contain points now
197     #TODO: simplify
198     #waitFor("object.exists(':Sections.0_QModelIndex')", 20000)
199     #test.compare(findObject(":Sections.0_QModelIndex").text, "0")
200     #waitFor("object.exists(':Sections.Open_spline_QModelIndex')", 20000)
201     #test.compare(findObject(":Sections.Open_spline_QModelIndex").text, "Open_spline")
202     #waitFor("object.exists(':Sections.0_QModelIndex_2')", 20000)
203     #test.compare(findObject(":Sections.0_QModelIndex_2").row, 3)
204     #Test.compare(findObject(":Sections.0_QModelIndex_2").column, 1)
205     #test.compare(findObject(":Sections.0_QModelIndex_2").text, "0")
206     
207     # 34. Click Redo button 10 times
208     for i in range(1, 11):
209         clickButton(waitForObject(":Sections.Redo_QToolButton"))
210
211     # 35. Click Apply button
212     clickButton(waitForObject(":Create polyline.Apply_QPushButton"))
213     
214     # 36. "MyPolyline" object appears in Object Browser as a child of "POLYLINES" branch
215     checkOBItem("HYDRO", "POLYLINES", "MyPolyline")
216     
217     # CREATION OF POLYLINE WITH HELP OF DETECTION MODE: TO BE DONE
218
219
220 """
221 Edit polyline.
222 """
223 def S3():
224
225     # Title 3: Edit polyline
226     
227     # 1. Select "MyPolyline" in Object browser
228     # 2. Call its context menu - Edit polyline
229     activateOBContextMenuItem("HYDRO.POLYLINES", "MyPolyline", "Edit polyline")
230     
231     # 3. "Edit" polyline panel appears:
232     panel = waitForObject(":SALOME *.Edit polyline_HYDROGUI_PolylineDlg")
233     test.compare(str(panel.windowTitle), "Edit polyline")
234     
235     sections_list_name = ":Sections.Sections_CurveCreator_TreeView_2"
236     sections_list = waitForObject(sections_list_name)
237     
238     # 4. Type new name "Polyline_1"
239     setInputFieldValue(waitForObject(":Edit polyline.Name_QLineEdit"), "Polyline_1")
240     
241     # 5. Select "Open_polyline" section
242     clickObjectItem(sections_list, "Open_polyline")
243     
244     # 6. Click "Remove" button
245     mouseDrag(waitForObject(":SALOME_STD_TabDesktop"), 1649, 420, -64, 1, 1, Qt.LeftButton) #TODO: resize the panel in another way
246     clickButton(waitForObject(":Sections.Remove_QToolButton"))
247
248     # 7. "Open_polyline" object disappears from the list of sections
249     #TODO: check list of sections context
250     
251     # 8. Select "Closed_spline" and "Open_spline" objects in Sections panel
252     clickObjectItem(sections_list, "Closed_spline")
253     clickObjectItem(sections_list, "Open_spline", Qt.ControlModifier)
254     
255     # 9. Click "Join selected sections" button
256     clickButton(waitForObject(":Sections.Join_QToolButton"))
257     
258     # 10. New section, consisting from 10 points appears in the list of sections
259     #TODO: check than "Closed_spline" appears and consists of 10 points
260     
261     # 11. Click Undo button 2 times
262     clickButton(waitForObject(":Sections.Undo_QToolButton_2"))
263     clickButton(waitForObject(":Sections.Undo_QToolButton_2"))
264     
265     # 12. Check that all 4 sections are in the list like in step 3.3
266     sections_list.clearSelection()
267     test.vp("VP7") # Sections list widget
268     
269     # 13. Activate Modification mode by clicking corresponding button
270     clickButton(waitForObject(":Sections.Modification mode_QToolButton"))
271     
272     # 14. Select some point in OCC view and drag it to another position
273     occMouseClick(452, 137)
274     occMouseDrag(452, 137, 77, -115)
275     
276     # 15. Repeat previous step with each section
277     occMouseClick(642, 244)
278     occMouseDrag(642, 244, -180, 86)
279     occMouseClick(754, 477)
280     occMouseDrag(752, 477, 119, 37)
281     occMouseClick(619, 577)
282     occMouseDrag(621, 581, -15, 74)
283     
284     # 16. Click on the segment of the sector - new points have been created and appeared on the place, where you click
285     occMouseClick(10, 10) # clear point selection
286     
287     # Add 3 points to "Closed_polyline"
288     occMouseClick(723, 87)
289     occMouseClick(649, 180)
290     occMouseClick(841, 148)
291
292     occMouseClick(10, 10)  # clear point selection
293     test.vp("VP4")
294     
295     # 17. Check that the number of points, located in the modified sector increases after each point addition
296     #TODO: Check number of pointsin "Closed_polyline" increases from 5 to 8
297     
298     # 18. Add some points to each sector. Check the result - as old representations of sectors are shown as far as new representations:
299     occMouseClick(619, 315) # Add point to "Open_polyline"
300     occMouseClick(563, 503) # Add point to "Closed_spline"
301     occMouseClicks([(567, 629), (652, 631)]) # Add 2 points to "Open_spline"
302     
303     occMouseClick(10, 10) # clear point selection
304     test.vp("VP5")
305    
306     # 19. Click Apply button
307     clickButton(waitForObject(":Edit polyline.Apply_QPushButton"))
308
309     # 20. Modified object "Polyline_1" has appeared in Object browser and in OCC view
310     checkOBItemNotExists("HYDRO", "POLYLINES", "MyPolyline")
311     checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
312     
313     fitAll()
314     test.vp("VP6") # OCC view
315     
316     # 21. Select "MyPolyline" in Object browser
317     # 22. Call its context menu - Edit polyline
318     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Edit polyline")
319     
320     # 23. "Edit" polyline panel appears:
321     panel = waitForObject(":SALOME *.Edit polyline_HYDROGUI_PolylineDlg")
322     
323     waitFor("object.exists(':Sections.Sections_CurveCreator_TreeView')", 20000)
324     sections_list = findObject(sections_list_name)
325     
326     # 24. Activate Modification mode
327     clickButton(waitForObject(":Sections.Modification mode_QToolButton"))
328     
329     # 25. Select all points from "Closed_polyline" except 4 points on the right with the help of rectangle
330     occMouseDrag(513, 0, 195, 205)
331     # occMouseDrag(511, 11, 204, 196) #MZN
332        
333     # 26. Click Remove button
334     clickButton(waitForObject(":Sections.Remove_QToolButton"))
335     
336     # 27. Select remaining 4 points
337     occMouseDrag(730, 45, 240, 190)
338     #occMouseDrag(690, 63, 176, 152) #MZN
339     
340     # 28. Table with coordinates appears. Input following coordinates:
341     table_name = ":Sections_CurveCreator_TableView"
342     waitFor("object.exists(':Sections_CurveCreator_TableView')", 20000)
343     test.compare(findObject(table_name).visible, True)
344     
345     doubleClickObjectItem(table_name, "0/2")
346     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox"), "155")
347
348     doubleClickObjectItem(table_name, "0/3")
349     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_2"), "704")
350     
351     doubleClickObjectItem(table_name, "1/2")
352     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_3"), "340")
353     
354     doubleClickObjectItem(table_name, "1/3")
355     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_4"), "704")
356     
357     doubleClickObjectItem(table_name, "2/2")
358     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_5"), "340")
359     
360     doubleClickObjectItem(table_name, "2/3")
361     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_6"), "530")
362     
363     doubleClickObjectItem(table_name, "3/2")
364     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_7"), "155")
365     
366     doubleClickObjectItem(table_name, "3/3")
367     setInputFieldValue(waitForObject(":_QtxDoubleSpinBox_8"), "530")
368       
369     type(waitForObject(":_QtxDoubleSpinBox_8"), "<Tab>")
370     
371     # 29. Check the result:
372     occMouseClick(10, 10) # clear point selection
373     fitAll()
374     
375     test.vp("VP8")
376     
377     # 30. Select "Closed_spline" in Sections table, call context menu - Set open
378     openItemContextMenu(waitForObject(sections_list_name), "Closed\\_spline", 73, 12, 0)
379     activateItem(waitForObjectItem(":SALOME *_QMenu", "Set open"))
380     
381     # 31. Section has became open as in OCC viewer as far in Sections table
382     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Hide") # hide the edited polyline
383
384     test.vp("VP9") # OCC view
385     
386     sections_list.clearSelection()
387     test.vp("VP10") # Sections list
388     
389     # 32. Activate Modification mode
390     clickButton(waitForObject(":Sections.Modification mode_QToolButton"))
391     
392     # 33. Select "Closed_spline" section and call its context menu
393     # 34. Set polyline
394     openItemContextMenu(waitForObject(sections_list_name), "Closed\\_spline", 73, 12, 0)
395     activateItem(waitForObjectItem(":SALOME *_QMenu", "Set polyline"))
396     
397     # 35. Section has become polyline:
398     test.vp("VP11") # OCC view
399     
400     sections_list.clearSelection()
401     test.vp("VP12") # Sections list
402     
403     # 36. Click Cancel button in "Edit polyline" panel
404     clickButton(waitForObject(":Edit polyline.Cancel_QPushButton"))
405     
406     # 37. Select Polyline_1 in Object browser
407     # 38. Call context menu - Edit polyline
408     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Edit polyline")
409
410     fitAll()
411     test.vp("VP13")
412     test.vp("VP14")
413     
414     clickButton(waitForObject(":Edit polyline.Cancel_QPushButton"))
415     
416 """
417 Show/hide polyline.
418 """
419 def S4():
420
421     # Title 4: Show/hide polyline
422     
423     # 1. Select "POLYLINES" in Object browser, call context menu - "Create polyline"
424     activateOBContextMenuItem("HYDRO", "POLYLINES", "Create polyline")
425     
426     # 2. Create polyline, consisting from 1 closed polyline section, click Apply:
427     addPolylineSection(True)
428     addPolylinePoints([(515, 203), (661, 119), (759, 200), (814, 375), (630, 435), (449, 416)])
429    
430     clickButton(waitForObject(":Create polyline.Apply_QPushButton"))
431
432     # 3. Select Polyline_1 in Object browser
433     # 4. Call context menu - Show only
434     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Show only")
435         
436     # 5. Fit all
437     fitAll()
438     
439     # 6. Only Polyline_1 is shown in OCC viewer
440     deselectAll()
441     test.vp("VP6")
442         
443     # 7. Select Polyline_2 in Object browser
444     # 8. Call context menu - Show
445     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_2", "Show")
446         
447     # 9. Fit all
448     fitAll()
449     
450     # 10. Both polylines are shown in OCC view
451     deselectAll()
452     test.vp("VP15")
453     
454     # 11. Call context menu in OCC viewer - Hide all
455     occHideAll()
456     
457     # 12. Nothing is shown in OCC view
458     test.vp("vp_empty_occ_view")
459     
460     # 13. Call context menu in OCC viewer - Show all
461     occShowAll()
462     
463     # 14. Both polylines are shown in OCC view
464     test.vp("VP15")
465     
466     # 15. Alt + K
467     # type(waitForObject(":SALOME_STD_TabDesktop"), "<Alt+K>") #TODO: <Alt+K> doesn't work
468     activateMenuItem("Window", "New Window", "VTK 3D view")
469         
470     # 16. New VTK scene appears
471     waitFor("object.exists(':SALOME *.SVTK_RenderWindowInteractor_SVTK_RenderWindowInteractor')", 20000)
472     test.compare(findObject(":SALOME *.SVTK_RenderWindowInteractor_SVTK_RenderWindowInteractor").visible, True)
473     showTrihedron(False) # Hide trihedron
474     
475     # 17. Select Polyline_1 in Object browser
476     # 18. Call context menu - Show only
477     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Show only")
478     
479     # 19. Fit all
480     fitAll()
481     
482     # 20. Only Polyline_1 is shown in VTK viewer
483     test.vp("VP16")
484     
485     # 21. Select Polyline_2 in Object browser
486     # 22. Call context menu - Show
487     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_2", "Show")
488     
489     # 23. Fit all
490     fitAll()
491     
492     # 24. Both polylines are shown in VTK view
493     test.vp("VP17")
494     
495     # 25. Call context menu in VTK viewer - Hide all
496     vtkHideAll()
497     
498     # 26. Nothing is shown in VTK view
499     test.vp("vp_empty_vtk_view")
500     
501     # 27. Call context menu in VTK viewer -  Show all
502     vtkShowAll()
503     
504     # 28. Both of polylines are shown in VTK view
505     test.vp("VP18")
506
507
508 """
509 Delete polyline.
510 """
511 def S5():
512
513     # Title 5: Delete polyline
514     
515     # 0. Activate OCC 3D view
516     clickTab(waitForObject(":SALOME *_QtxWorkstackTabBar"), "OCC scene:1 - viewer:1")
517     
518     # 1. Select Polyline_1
519     # 2. Call context menu - Delete
520     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Delete")
521     
522     # 3. Delete objects" dialog appear
523     delete_dlg = waitForObject(":Delete objects_HYDROGUI_DeleteDlg")
524     test.compare(str(delete_dlg.windowTitle), "Delete objects")
525     objects_list_text = waitForObject(":Delete objects_QTextEdit")
526     test.compare(objects_list_text.plainText, "- Polyline_1")
527     
528     # 4. Click No
529     clickButton(waitForObject(":Delete objects.No_QPushButton"))
530     
531     # 5. Nothing happens
532     deselectAll()
533     
534     test.vp("VP15")
535     checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
536     
537     # 6. Select Polyline_1
538     # 7. Call context menu - Delete
539     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_1", "Delete")
540     
541     # 8. Delete objects" dialog appear
542     waitForObject(":Delete objects_HYDROGUI_DeleteDlg")
543     
544     # 9. Click Yes
545     clickButton(waitForObject(":Delete objects.Yes_QPushButton"))
546     
547     # 10. Polyline_1 disappears as from OCC view as far from Object browser
548     checkOBItemNotExists("HYDRO", "POLYLINES", "Polyline_1")
549     test.vp("VP19")
550     
551     # 11. Click Undo button
552     clickButton(waitForObject(":SALOME *.Undo_QToolButton"))
553     
554     # 12. Polyline_1 appears in OCC view and Object browser
555     test.vp("VP15")
556     checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
557     
558     # 13. Select Polyline_1 and Polyline_2
559     selectObjectBrowserItem("Polyline_1", "HYDRO.POLYLINES")
560     selectObjectBrowserItem("Polyline_2", "HYDRO.POLYLINES", modifier=Qt.ControlModifier)
561     
562     # 14. Click Delete button
563     type(waitForObject(":SALOME_STD_TabDesktop"), "<Del>")
564     
565     # 15. Delete objects dialog appears:
566     waitForObject(":Delete objects_HYDROGUI_DeleteDlg")
567     objects_list_text = waitForObject(":Delete objects_QTextEdit")
568     test.compare(objects_list_text.plainText, "- Polyline_1\n- Polyline_2")
569     
570     # 16. Click Yes
571     clickButton(waitForObject(":Delete objects.Yes_QPushButton"))
572     
573     # 17. Both polylines disappear from OCC view and Object browser
574     checkOBItemNotExists("HYDRO", "POLYLINES", "Polyline_1")
575     checkOBItemNotExists("HYDRO", "POLYLINES", "Polyline_2")
576     test.vp("vp_empty_occ_view")
577     
578     # 18. Click Undo button
579     clickButton(waitForObject(":SALOME *.Undo_QToolButton"))
580     
581     # 19. Polyline_1 and Polyline_2 appear in OCC view and Object browser
582     test.vp("VP15")
583     checkOBItem("HYDRO", "POLYLINES", "Polyline_1")
584     checkOBItem("HYDRO", "POLYLINES", "Polyline_2")
585
586
587 """
588 Change local CS.
589 """
590 def S6():
591
592     # Title 6: Change local CS
593     
594     # 1. Select Polyline_2
595     # 2. Call context menu - Show only
596     activateOBContextMenuItem("HYDRO.POLYLINES", "Polyline_2", "Show only")
597     
598     # 3. Check local and global coordinates of bottom vertex of polyline
599     occMouseClick(798, 438)
600     
601     lc1 = getLocalCoordinates()
602     gc1 = getGlobalCoordinates()
603     
604     test.verify(lc1 == gc1)
605     
606     # 4. HYDRO - Change local CS
607     activateMenuItem("HYDRO", "Change local CS")
608     
609     # 5. Local CS transformation panel appears. Check that default LX=0, LY=0
610     cs_panel = waitForObject(":SALOME *.Local CS transformation_HYDROGUI_LocalCSDlg")
611     test.compare(str(cs_panel.windowTitle), "Local CS transformation")
612     
613     lx_edit = waitForObject(":Local CS transformation.qt_spinbox_lineedit_QLineEdit")
614     test.compare(str(lx_edit.text), "0")
615     
616     ly_edit = waitForObject(":Local CS transformation.qt_spinbox_lineedit_QLineEdit_2")
617     test.compare(str(ly_edit.text), "0")
618        
619     # 6. Set LX=20000, LY=400
620     lx = 20000
621     ly = 400
622     
623     setInputFieldValue(lx_edit, lx)
624     setInputFieldValue(lx_edit, ly)
625     
626     # 7. Check local and global coordinates of bottom vertex of polyline. Difference between values
627     #    of local CS and global CS is equal to LX and LY
628     occMouseClick(798, 438)
629     
630     lc2 = getLocalCoordinates()
631     gc2 = getGlobalCoordinates()
632     
633     test.compare(gc2[0] - lc2[0], lx)
634     test.compare(gc2[1] - lc2[1], ly)
635     
636