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/.
9 from uitest
.framework
import UITestCase
10 from uitest
.uihelper
.common
import get_state_as_dict
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import select_pos
14 # Bug 134452 - Applying a table style caused the loss of break/pagedesc props of the table
17 class tdf134452(UITestCase
):
18 def test_tdf134452(self
):
19 with self
.ui_test
.create_doc_in_start_center("writer"):
20 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
21 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
22 xWriterEdit
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
23 with self
.ui_test
.execute_dialog_through_command(".uno:InsertTable") as xDialog
:
24 formatlbinstable
= xDialog
.getChild("formatlbinstable")
25 entry
= formatlbinstable
.getChild("1")
26 entry
.executeAction("SELECT", tuple())
27 #setting the break and pageDesc properties
28 with self
.ui_test
.execute_dialog_through_command(".uno:TableDialog") as xDialog
:
29 tabcontrol
= xDialog
.getChild("tabcontrol")
30 select_pos(tabcontrol
, "1")
31 xbreak
= xDialog
.getChild("break")
32 xbreak
.executeAction("CLICK", tuple())
33 self
.assertEqual("true", get_state_as_dict(xbreak
)["Selected"])
34 xpagestyle
= xDialog
.getChild("pagestyle")
35 xpagestyle
.executeAction("CLICK", tuple())
36 self
.assertEqual("true", get_state_as_dict(xpagestyle
)["Selected"])
38 #applying table style on the table
39 #without the fix, break and pageDesc properties would be overridden and lost
40 document
= self
.ui_test
.get_component()
41 tables
= document
.getTextTables()
42 tables
[0].setPropertyValue("TableTemplateName", "Box List Red")
44 with self
.ui_test
.execute_dialog_through_command(".uno:TableDialog") as xDialog
:
45 tabcontrol
= xDialog
.getChild("tabcontrol")
46 select_pos(tabcontrol
, "1")
47 xbreak
= xDialog
.getChild("break")
48 self
.assertEqual("true", get_state_as_dict(xbreak
)["Selected"])
49 xpagestyle
= xDialog
.getChild("pagestyle")
50 self
.assertEqual("true", get_state_as_dict(xpagestyle
)["Selected"])
51 # vim: set shiftwidth=4 softtabstop=4 expandtab: