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/.
7 from uitest
.framework
import UITestCase
8 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
9 from uitest
.uihelper
.common
import get_state_as_dict
, type_text
11 from uitest
.debug
import sleep
12 from uitest
.uihelper
.common
import select_pos
14 class tdf115572(UITestCase
):
16 def insertTextIntoCell(self
, table
, cellName
, text
):
17 tableText
= table
.getCellByName( cellName
)
18 tableText
.setString( text
)
20 def test_tdf115572_table_format_gets_reset_deleting_row(self
):
21 self
.ui_test
.create_doc_in_start_center("writer")
22 document
= self
.ui_test
.get_component()
23 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
24 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
26 self
.ui_test
.execute_dialog_through_command(".uno:InsertTable")
27 xDialog
= self
.xUITest
.getTopFocusWindow()
28 xOkBtn
= xDialog
.getChild("ok")
29 self
.ui_test
.close_dialog_through_button(xOkBtn
)
30 #select font format - Bold and write text "abc"
31 self
.xUITest
.executeCommand(".uno:Bold")
32 tables
= document
.getTextTables()
33 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
34 #go to second row - arrow down
35 self
.xUITest
.executeCommand(".uno:GoDown")
37 self
.xUITest
.executeCommand(".uno:DeleteRows")
38 #now the cursor is in the second column - go left
39 self
.xUITest
.executeCommand(".uno:GoLeft")
40 self
.xUITest
.executeCommand(".uno:GoLeft")
41 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
42 self
.ui_test
.execute_dialog_through_command(".uno:FontDialog")
43 xDialog
= self
.xUITest
.getTopFocusWindow()
44 xTabs
= xDialog
.getChild("tabcontrol")
45 select_pos(xTabs
, "0")
46 xweststylelbcjk
= xDialog
.getChild("weststylelb-cjk")
47 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
48 xCloseBtn
= xDialog
.getChild("cancel")
49 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
51 self
.ui_test
.close_doc()
53 def test_tdf115572_table_format_gets_reset_deleting_column(self
):
54 self
.ui_test
.create_doc_in_start_center("writer")
55 document
= self
.ui_test
.get_component()
56 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
57 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
59 self
.ui_test
.execute_dialog_through_command(".uno:InsertTable")
60 xDialog
= self
.xUITest
.getTopFocusWindow()
61 xOkBtn
= xDialog
.getChild("ok")
62 self
.ui_test
.close_dialog_through_button(xOkBtn
)
63 #select font format - Bold and write text "abc"
64 self
.xUITest
.executeCommand(".uno:Bold")
65 tables
= document
.getTextTables()
66 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
68 self
.xUITest
.executeCommand(".uno:GoRight")
70 self
.xUITest
.executeCommand(".uno:DeleteColumns")
71 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
72 self
.ui_test
.execute_dialog_through_command(".uno:FontDialog")
73 xDialog
= self
.xUITest
.getTopFocusWindow()
74 xTabs
= xDialog
.getChild("tabcontrol")
75 select_pos(xTabs
, "0")
76 xweststylelbcjk
= xDialog
.getChild("weststylelb-cjk")
77 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
78 xCloseBtn
= xDialog
.getChild("cancel")
79 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
81 self
.ui_test
.close_doc()
82 # vim: set shiftwidth=4 softtabstop=4 expandtab: