Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / sidebar / tdf133189.py
blobbc050cb7e1089eea3383aa7c8659fe9183f65c5f
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, select_pos
11 from uitest.uihelper.common import change_measurement_unit
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 class tdf133189(UITestCase):
15 def test_tdf133189(self):
16 with self.ui_test.create_doc_in_start_center("writer"):
18 xWriterDoc = self.xUITest.getTopFocusWindow()
19 xWriterEdit = xWriterDoc.getChild("writer_edit")
21 self.xUITest.executeCommand(".uno:Sidebar")
22 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
24 xPaperSize = xWriterEdit.getChild('papersize')
25 xPaperWidth = xWriterEdit.getChild('paperwidth')
26 xPaperHeight = xWriterEdit.getChild('paperheight')
27 xPaperOrient = xWriterEdit.getChild('paperorientation')
28 xPaperMargin = xWriterEdit.getChild('marginLB')
30 with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
31 tabcontrol = xDialog.getChild("tabcontrol")
32 select_pos(tabcontrol, "1")
34 xWidth = xDialog.getChild('spinWidth')
35 xHeight = xDialog.getChild('spinHeight')
37 props = {"VALUE": '8.0'}
38 actionProps = mkPropertyValues(props)
40 xWidth.executeAction("VALUE", actionProps)
41 xHeight.executeAction("VALUE", actionProps)
44 self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)")
45 self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)")
46 self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
47 self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
48 self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
49 self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
50 self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″")
51 self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″")
52 self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″")
53 self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″")
55 with change_measurement_unit(self, 'Centimeter'):
57 self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
58 # tdf#129267
59 self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)")
60 self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
61 self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
62 self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
63 self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
64 self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm")
65 self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm")
66 self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm")
67 self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm")
69 self.xUITest.executeCommand(".uno:Sidebar")
71 # vim: set shiftwidth=4 softtabstop=4 expandtab: