Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / tdf51352.py
bloba8ed1ceadf725dd6d2c177de06baa6d004a283bc
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/.
8 from uitest.framework import UITestCase
9 from libreoffice.uno.propertyvalue import mkPropertyValues
10 from uitest.debug import sleep
12 class tdf51352(UITestCase):
14 def test_convert_nested_table_to_text_tdf51352(self):
16 self.ui_test.create_doc_in_start_center("writer")
17 xWriterDoc = self.xUITest.getTopFocusWindow()
18 xWriterEdit = xWriterDoc.getChild("writer_edit")
19 document = self.ui_test.get_component()
20 #1. New a text document
21 #2. Insert a table and then in one cell create another table
22 #-insert a table (by default 2x2)
23 self.ui_test.execute_dialog_through_command(".uno:InsertTable")
24 xDialog = self.xUITest.getTopFocusWindow()
25 xOkBtn = xDialog.getChild("ok")
26 xOkBtn.executeAction("CLICK", tuple())
27 #-put the cursor inside first cell top left for example
28 #-insert a inner table (by default 2x2) inside this cell
29 self.ui_test.execute_dialog_through_command(".uno:InsertTable")
30 xDialog = self.xUITest.getTopFocusWindow()
31 xOkBtn = xDialog.getChild("ok")
32 xOkBtn.executeAction("CLICK", tuple())
33 #3. Select the first table
34 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
35 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
36 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
37 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
38 xWriterEdit.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
39 self.assertEqual(document.TextTables.getCount(), 2)
40 #4. From menu "Table->Covert->Table to Text
41 self.ui_test.execute_dialog_through_command(".uno:ConvertTableToText")
42 xDialog = self.xUITest.getTopFocusWindow()
43 xOkBtn = xDialog.getChild("ok")
44 xOkBtn.executeAction("CLICK", tuple())
45 self.assertEqual(document.TextTables.getCount(), 0)
46 #5. Undo/Redo
47 self.xUITest.executeCommand(".uno:Undo")
48 self.assertEqual(document.TextTables.getCount(), 2)
49 self.xUITest.executeCommand(".uno:Redo")
50 self.assertEqual(document.TextTables.getCount(), 0)
51 self.ui_test.close_doc()
52 # vim: set shiftwidth=4 softtabstop=4 expandtab: