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 tdf115573(UITestCase
):
16 def insertTextIntoCell(self
, table
, cellName
, text
):
17 tableText
= table
.getCellByName( cellName
)
18 tableText
.setString( text
)
20 def test_tdf115573_Table_loses_formatting_inserting_row_before(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:InsertRowsBefore")
39 self
.xUITest
.executeCommand(".uno:GoUp")
40 self
.xUITest
.executeCommand(".uno:GoUp")
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_tdf115573_Table_loses_formatting_inserting_row_after(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" )
67 #go to second row - arrow down
68 self
.xUITest
.executeCommand(".uno:GoDown")
70 self
.xUITest
.executeCommand(".uno:InsertRowsAfter")
72 self
.xUITest
.executeCommand(".uno:GoUp")
73 self
.xUITest
.executeCommand(".uno:GoUp")
74 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
75 self
.ui_test
.execute_dialog_through_command(".uno:FontDialog")
76 xDialog
= self
.xUITest
.getTopFocusWindow()
77 xTabs
= xDialog
.getChild("tabcontrol")
78 select_pos(xTabs
, "0")
79 xweststylelbcjk
= xDialog
.getChild("weststylelb-cjk")
80 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
81 xCloseBtn
= xDialog
.getChild("cancel")
82 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
84 self
.ui_test
.close_doc()
86 def test_tdf115573_Table_loses_formatting_inserting_column_left(self
):
87 self
.ui_test
.create_doc_in_start_center("writer")
88 document
= self
.ui_test
.get_component()
89 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
90 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
92 self
.ui_test
.execute_dialog_through_command(".uno:InsertTable")
93 xDialog
= self
.xUITest
.getTopFocusWindow()
94 xOkBtn
= xDialog
.getChild("ok")
95 self
.ui_test
.close_dialog_through_button(xOkBtn
)
96 #select font format - Bold and write text "abc"
97 self
.xUITest
.executeCommand(".uno:Bold")
98 tables
= document
.getTextTables()
99 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
101 self
.xUITest
.executeCommand(".uno:InsertColumnsBefore")
102 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
103 self
.ui_test
.execute_dialog_through_command(".uno:FontDialog")
104 xDialog
= self
.xUITest
.getTopFocusWindow()
105 xTabs
= xDialog
.getChild("tabcontrol")
106 select_pos(xTabs
, "0")
107 xweststylelbcjk
= xDialog
.getChild("weststylelb-cjk")
108 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
109 xCloseBtn
= xDialog
.getChild("cancel")
110 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
112 self
.ui_test
.close_doc()
114 def test_tdf115573_Table_loses_formatting_inserting_column_right(self
):
115 self
.ui_test
.create_doc_in_start_center("writer")
116 document
= self
.ui_test
.get_component()
117 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
118 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
120 self
.ui_test
.execute_dialog_through_command(".uno:InsertTable")
121 xDialog
= self
.xUITest
.getTopFocusWindow()
122 xOkBtn
= xDialog
.getChild("ok")
123 self
.ui_test
.close_dialog_through_button(xOkBtn
)
124 #select font format - Bold and write text "abc"
125 self
.xUITest
.executeCommand(".uno:Bold")
126 tables
= document
.getTextTables()
127 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
129 self
.xUITest
.executeCommand(".uno:InsertColumnsAfter")
130 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
131 self
.ui_test
.execute_dialog_through_command(".uno:FontDialog")
132 xDialog
= self
.xUITest
.getTopFocusWindow()
133 xTabs
= xDialog
.getChild("tabcontrol")
134 select_pos(xTabs
, "0")
135 xweststylelbcjk
= xDialog
.getChild("weststylelb-cjk")
136 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
137 xCloseBtn
= xDialog
.getChild("cancel")
138 self
.ui_test
.close_dialog_through_button(xCloseBtn
)
140 self
.ui_test
.close_doc()
141 # vim: set shiftwidth=4 softtabstop=4 expandtab: