Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / sidebar / tdf135590.py
blob20bd7a9fb1526d6a658c3f7f62b1b98c24b4a0ad
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 uitest.uihelper.common import select_by_text
13 from libreoffice.uno.propertyvalue import mkPropertyValues
15 class tdf135590(UITestCase):
16 def test_tdf135590(self):
17 with self.ui_test.create_doc_in_start_center("writer"):
19 with change_measurement_unit(self, 'Centimeter'):
21 with self.ui_test.execute_dialog_through_command(".uno:InsertEnvelope") as xDialog:
24 tabcontrol = xDialog.getChild("tabcontrol")
25 select_pos(tabcontrol, "1")
27 xWidth = xDialog.getChild('width')
28 xHeight = xDialog.getChild('height')
29 xFormat = xDialog.getChild("format")
31 select_by_text(xFormat, "C6 Envelope")
33 self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
34 self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
37 # A new document is created
38 xWriterDoc = self.xUITest.getTopFocusWindow()
39 xWriterEdit = xWriterDoc.getChild("writer_edit")
41 with self.ui_test.execute_dialog_through_command(".uno:PageDialog") as xDialog:
42 tabcontrol = xDialog.getChild("tabcontrol")
43 select_pos(tabcontrol, "1")
45 xWidth = xDialog.getChild('spinWidth')
46 xHeight = xDialog.getChild('spinHeight')
47 xFormatList = xDialog.getChild("comboPageFormat")
49 # Without the fix in place, this test would have failed with
50 # AssertionError: '16.2' != '11.4'
51 self.assertEqual("16.2", get_state_as_dict(xWidth)['Value'])
52 self.assertEqual("11.4", get_state_as_dict(xHeight)['Value'])
53 self.assertEqual("User", get_state_as_dict(xFormatList)['SelectEntryText'])
56 self.xUITest.executeCommand(".uno:Sidebar")
57 xWriterEdit.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PageStylesPanel"}))
59 xPaperSize = xWriterEdit.getChild('papersize')
60 self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
61 self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
63 xPaperHeight = xWriterEdit.getChild('paperheight')
64 self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "11.40 cm")
65 self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "11.40 cm")
67 xPaperWidth = xWriterEdit.getChild('paperwidth')
68 self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "16.20 cm")
69 self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "16.20 cm")
71 self.xUITest.executeCommand(".uno:Sidebar")
73 # vim: set shiftwidth=4 softtabstop=4 expandtab: