Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / table / splitTable.py
blob0292c452b187fc3806522bc0c2ef9348d3a9280b
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 uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
12 #Writer Split Table
14 class splitTable(UITestCase):
15 def test_split_table(self):
16 with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
17 #go to row 2
18 self.xUITest.executeCommand(".uno:GoDown")
19 self.xUITest.executeCommand(".uno:GoDown")
20 #dialog Split table, check Copy heading, OK -> verify 2 tables, 1st has 2 rows, second has 5 rows
21 with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog:
23 copyheading = xDialog.getChild("copyheading")
24 copyheading.executeAction("CLICK", tuple())
25 self.assertEqual(writer_doc.TextTables.getCount(), 2)
26 tables = writer_doc.getTextTables()
27 self.assertEqual(len(tables[0].getRows()), 2)
28 self.assertEqual(len(tables[1].getRows()), 5)
29 #undo -> verify 1 tables
30 self.xUITest.executeCommand(".uno:Undo")
31 self.assertEqual(writer_doc.TextTables.getCount(), 1)
33 #dialog Split table, check Custom heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows
34 with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
35 #go to row 2
36 self.xUITest.executeCommand(".uno:GoDown")
37 self.xUITest.executeCommand(".uno:GoDown")
38 with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog:
40 customheading = xDialog.getChild("customheading")
41 customheading.executeAction("CLICK", tuple())
42 self.assertEqual(writer_doc.TextTables.getCount(), 2)
43 tables = writer_doc.getTextTables()
44 self.assertEqual(len(tables[0].getRows()), 2)
45 self.assertEqual(len(tables[1].getRows()), 4)
46 #undo -> verify 1 tables
47 self.xUITest.executeCommand(".uno:Undo")
48 self.assertEqual(writer_doc.TextTables.getCount(), 1)
50 #dialog Split table, check No heading, OK -> verify 2 tables, 1st has 2 rows, second has 4 rows
51 with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
52 #go to row 2
53 self.xUITest.executeCommand(".uno:GoDown")
54 self.xUITest.executeCommand(".uno:GoDown")
55 with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog:
57 noheading = xDialog.getChild("noheading")
58 noheading.executeAction("CLICK", tuple())
59 self.assertEqual(writer_doc.TextTables.getCount(), 2)
60 tables = writer_doc.getTextTables()
61 self.assertEqual(len(tables[0].getRows()), 2)
62 self.assertEqual(len(tables[1].getRows()), 4)
63 #undo -> verify 1 tables
64 self.xUITest.executeCommand(".uno:Undo")
65 self.assertEqual(writer_doc.TextTables.getCount(), 1)
67 def test_tdf115572_remember_split_table_option(self):
68 with self.ui_test.load_file(get_url_for_data_file("splitTable.odt")) as writer_doc:
69 # Go to second row
70 self.xUITest.executeCommand(".uno:GoDown")
71 self.xUITest.executeCommand(".uno:GoDown")
73 # Split table using a non default option
74 with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog:
75 xRadioNoHeading = xDialog.getChild("noheading")
76 xRadioNoHeading.executeAction("CLICK", tuple())
78 # Reopen split table dialog and check preselection
79 self.xUITest.executeCommand(".uno:GoDown")
80 with self.ui_test.execute_dialog_through_command(".uno:SplitTable") as xDialog:
81 xRadioNoHeading = xDialog.getChild("noheading")
82 # Without the fix in place, this test would have failed with
83 # AssertionError: 'true' != 'false'
84 # i.e. the last used option in the split table dialog was not remembered
85 self.assertEqual("true", get_state_as_dict(xRadioNoHeading)["Checked"])
87 # vim: set shiftwidth=4 softtabstop=4 expandtab: