Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / table / insertTableDialog.py
blob727334c31295339b2fb9d4c5ab673e48f4d8904b
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/.
10 from uitest.framework import UITestCase
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import get_state_as_dict
14 class WriterInsertTableDialog(UITestCase):
16 def insertTextIntoCell(self, table, cellName, text ):
17 tableText = table.getCellByName( cellName )
18 tableText.setString( text )
20 def test_tdf104158(self):
22 with self.ui_test.create_doc_in_start_center("writer") as document:
24 with self.ui_test.execute_dialog_through_command(".uno:InsertTable") as xDialog:
26 xNameEdit = xDialog.getChild("nameedit")
28 xNameEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
29 xNameEdit.executeAction("TYPE", mkPropertyValues({"TEXT": "Test3"}))
31 xColSpin = xDialog.getChild("colspin")
32 xColSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
33 xColSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
35 xRowSpin = xDialog.getChild("rowspin")
36 xRowSpin.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
37 xRowSpin.executeAction("TYPE", mkPropertyValues({"TEXT": "2"}))
39 self.assertEqual(get_state_as_dict(xNameEdit)["Text"], "Test3")
40 self.assertEqual(get_state_as_dict(xColSpin)["Text"], "2")
41 self.assertEqual(get_state_as_dict(xRowSpin)["Text"], "2")
44 tables = document.getTextTables()
46 self.assertEqual(tables[0].getName(), "Test3")
47 self.assertEqual(len(tables[0].getRows()), 2)
48 self.assertEqual(len(tables[0].getColumns()), 2)
50 with self.ui_test.execute_dialog_through_command(".uno:TableNumberFormatDialog"):
51 pass
54 def test_cancel_button_insert_table_dialog(self):
55 with self.ui_test.create_doc_in_start_center("writer") as document:
56 with self.ui_test.execute_dialog_through_command(".uno:InsertTable", close_button="cancel"):
57 pass
59 tables = document.getTextTables()
60 self.assertEqual(len(tables), 0)
63 # vim: set shiftwidth=4 softtabstop=4 expandtab: