Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / table / tableToText.py
blob0816cda7e6078ffe94824ac5aea5bf1f98309745
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 from uitest.framework import UITestCase
10 from libreoffice.uno.propertyvalue import mkPropertyValues
11 from uitest.uihelper.common import get_url_for_data_file
13 #Writer Table to text
15 class tableToText(UITestCase):
16 def test_table_to_text(self):
17 with self.ui_test.load_file(get_url_for_data_file("tableToText.odt")) as writer_doc:
18 #dialog Table to text - Tabs; verify
19 with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
20 tabs = xDialog.getChild("tabs")
21 tabs.executeAction("CLICK", tuple())
22 #verify
23 self.assertEqual(writer_doc.Text.String[0:3], "a\ta")
24 self.assertEqual(writer_doc.TextTables.getCount(), 0)
25 #undo
26 self.xUITest.executeCommand(".uno:Undo")
27 self.assertEqual(writer_doc.TextTables.getCount(), 1)
29 #dialog Table to text - Paragraph; verify
30 with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
31 paragraph = xDialog.getChild("paragraph")
32 paragraph.executeAction("CLICK", tuple())
33 #verify
34 self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:4], "a\na\n")
35 self.assertEqual(writer_doc.TextTables.getCount(), 0)
36 #undo
37 self.xUITest.executeCommand(".uno:Undo")
38 self.assertEqual(writer_doc.TextTables.getCount(), 1)
40 #dialog Table to text - Semicolons; verify
41 with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
42 semicolons = xDialog.getChild("semicolons")
43 semicolons.executeAction("CLICK", tuple())
44 #verify
45 self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a;a\n;\n")
46 self.assertEqual(writer_doc.TextTables.getCount(), 0)
47 #undo
48 self.xUITest.executeCommand(".uno:Undo")
49 self.assertEqual(writer_doc.TextTables.getCount(), 1)
51 #dialog Table to text - other; verify
52 with self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText") as xDialog:
53 other = xDialog.getChild("other")
54 other.executeAction("CLICK", tuple())
55 othered = xDialog.getChild("othered")
56 othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
57 othered.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
58 othered.executeAction("TYPE", mkPropertyValues({"TEXT":":"}))
59 #verify
60 self.assertEqual(writer_doc.Text.String.replace('\r\n', '\n')[0:6], "a:a\n:\n")
61 self.assertEqual(writer_doc.TextTables.getCount(), 0)
62 #undo
63 self.xUITest.executeCommand(".uno:Undo")
64 self.assertEqual(writer_doc.TextTables.getCount(), 1)
66 # vim: set shiftwidth=4 softtabstop=4 expandtab: