Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / sort.py
blob6ae06c5ecef22d0ff42a3ef1e2b3c741bc7d142d
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest.framework import UITestCase
8 from libreoffice.uno.propertyvalue import mkPropertyValues
9 from uitest.uihelper.common import get_state_as_dict, type_text
10 import time
11 from uitest.debug import sleep
12 #Tools -Sort dialog + tdf81292
14 class WriterSort(UITestCase):
16 def test_sort(self):
17 self.ui_test.create_doc_in_start_center("writer")
18 document = self.ui_test.get_component()
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
22 type_text(xWriterEdit, "a")
23 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
24 type_text(xWriterEdit, "c")
25 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
26 type_text(xWriterEdit, "v")
28 selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
29 #Tools - Sort
30 self.ui_test.execute_dialog_through_command(".uno:SortDialog")
31 xDialog = self.xUITest.getTopFocusWindow()
32 xDown = xDialog.getChild("down1")
33 xDown.executeAction("CLICK", tuple())
34 xOK = xDialog.getChild("ok")
35 self.ui_test.close_dialog_through_button(xOK)
36 #check
37 self.assertEqual(document.Text.String[0:1], "v")
39 self.ui_test.close_doc()
41 def test_sort_numerical(self):
42 self.ui_test.create_doc_in_start_center("writer")
43 document = self.ui_test.get_component()
44 xWriterDoc = self.xUITest.getTopFocusWindow()
45 xWriterEdit = xWriterDoc.getChild("writer_edit")
47 type_text(xWriterEdit, "1;2;3")
48 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
49 type_text(xWriterEdit, "2;8;3")
51 selection = self.xUITest.executeCommand(".uno:SelectAll") #select whole text
52 #Tools - Sort
53 self.ui_test.execute_dialog_through_command(".uno:SortDialog")
54 xDialog = self.xUITest.getTopFocusWindow()
55 xDown = xDialog.getChild("down1")
56 xcolsb1 = xDialog.getChild("colsb1")
57 xtypelb1 = xDialog.getChild("typelb1")
58 xcharacter = xDialog.getChild("character")
59 xseparator = xDialog.getChild("separator")
60 xDown.executeAction("CLICK", tuple())
61 props = {"TEXT": "Numerical"}
62 actionProps = mkPropertyValues(props)
63 xtypelb1.executeAction("SELECT", actionProps)
64 xcharacter.executeAction("CLICK", tuple())
65 xseparator.executeAction("TYPE", mkPropertyValues({"TEXT":";"}))
66 xOK = xDialog.getChild("ok")
67 self.ui_test.close_dialog_through_button(xOK)
68 #check
69 self.assertEqual(document.Text.String[0:5], "2;8;3")
71 self.ui_test.close_doc()
72 # vim: set shiftwidth=4 softtabstop=4 expandtab: