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
13 class tdf51352(UITestCase
):
15 def test_convert_nested_table_to_text_tdf51352(self
):
17 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
18 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
19 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
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 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable"):
25 #-put the cursor inside first cell top left for example
26 #-insert an inner table (by default 2x2) inside this cell
27 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable"):
29 #3. Select the first table
30 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
31 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
32 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
33 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
34 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RIGHT"}))
35 self
.assertEqual(document
.TextTables
.getCount(), 2)
36 #4. From menu "Table->Convert->Table to Text
37 with self
.ui_test
.execute_dialog_through_command(".uno:ConvertTableToText"):
39 self
.assertEqual(document
.TextTables
.getCount(), 0)
41 self
.xUITest
.executeCommand(".uno:Undo")
42 self
.assertEqual(document
.TextTables
.getCount(), 2)
43 self
.xUITest
.executeCommand(".uno:Redo")
44 self
.assertEqual(document
.TextTables
.getCount(), 0)
46 # vim: set shiftwidth=4 softtabstop=4 expandtab: