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 uitest
.uihelper
.common
import get_state_as_dict
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 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
23 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable"):
25 #select font format - Bold and write text "abc"
26 self
.xUITest
.executeCommand(".uno:Bold")
27 tables
= document
.getTextTables()
28 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
29 #go to second row - arrow down
30 self
.xUITest
.executeCommand(".uno:GoDown")
32 self
.xUITest
.executeCommand(".uno:InsertRowsBefore")
34 self
.xUITest
.executeCommand(".uno:GoUp")
35 self
.xUITest
.executeCommand(".uno:GoUp")
36 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
37 with self
.ui_test
.execute_dialog_through_command(".uno:FontDialog", close_button
="cancel") as xDialog
:
38 xTabs
= xDialog
.getChild("tabcontrol")
39 select_pos(xTabs
, "0")
40 xweststylelbcjk
= xDialog
.getChild("cbWestStyle")
41 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
44 def test_tdf115573_Table_loses_formatting_inserting_row_after(self
):
45 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
47 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable"):
49 #select font format - Bold and write text "abc"
50 self
.xUITest
.executeCommand(".uno:Bold")
51 tables
= document
.getTextTables()
52 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
53 #go to second row - arrow down
54 self
.xUITest
.executeCommand(".uno:GoDown")
56 self
.xUITest
.executeCommand(".uno:InsertRowsAfter")
58 self
.xUITest
.executeCommand(".uno:GoUp")
59 self
.xUITest
.executeCommand(".uno:GoUp")
60 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
61 with self
.ui_test
.execute_dialog_through_command(".uno:FontDialog", close_button
="cancel") as xDialog
:
62 xTabs
= xDialog
.getChild("tabcontrol")
63 select_pos(xTabs
, "0")
64 xweststylelbcjk
= xDialog
.getChild("cbWestStyle")
65 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
68 def test_tdf115573_Table_loses_formatting_inserting_column_left(self
):
69 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
71 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable"):
73 #select font format - Bold and write text "abc"
74 self
.xUITest
.executeCommand(".uno:Bold")
75 tables
= document
.getTextTables()
76 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
78 self
.xUITest
.executeCommand(".uno:InsertColumnsBefore")
79 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
80 with self
.ui_test
.execute_dialog_through_command(".uno:FontDialog", close_button
="cancel") as xDialog
:
81 xTabs
= xDialog
.getChild("tabcontrol")
82 select_pos(xTabs
, "0")
83 xweststylelbcjk
= xDialog
.getChild("cbWestStyle")
84 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
87 def test_tdf115573_Table_loses_formatting_inserting_column_right(self
):
88 with self
.ui_test
.create_doc_in_start_center("writer") as document
:
90 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable"):
92 #select font format - Bold and write text "abc"
93 self
.xUITest
.executeCommand(".uno:Bold")
94 tables
= document
.getTextTables()
95 self
.insertTextIntoCell(tables
[0], "A1", "abc" )
97 self
.xUITest
.executeCommand(".uno:InsertColumnsAfter")
98 #check the format of the text (should be still bold) Format-Character-Font-Style-Bold
99 with self
.ui_test
.execute_dialog_through_command(".uno:FontDialog", close_button
="cancel") as xDialog
:
100 xTabs
= xDialog
.getChild("tabcontrol")
101 select_pos(xTabs
, "0")
102 xweststylelbcjk
= xDialog
.getChild("cbWestStyle")
103 self
.assertEqual(get_state_as_dict(xweststylelbcjk
)["Text"], "Bold")
105 # vim: set shiftwidth=4 softtabstop=4 expandtab: