Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / fieldDialog / tdf146462.py
blob076b274dd7d04895b9beddb500c8e14671931e5f
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, type_text
12 from uitest.uihelper.common import select_pos
14 class Tdf146462(UITestCase):
16 def test_tdf146462(self):
18 with self.ui_test.create_doc_in_start_center("writer"):
19 xWriterDoc = self.xUITest.getTopFocusWindow()
20 xWriterEdit = xWriterDoc.getChild("writer_edit")
22 type_text(xWriterEdit, "Header")
24 self.xUITest.executeCommand(".uno:StyleApply?Style:string=Heading%201&FamilyName:string=ParagraphStyles")
26 with self.ui_test.execute_modeless_dialog_through_command(".uno:InsertField", close_button="cancel") as xDialog:
27 xTab = xDialog.getChild("tabcontrol")
28 select_pos(xTab, "1")
30 xType = xDialog.getChild("type-ref")
31 xType.getChild('2').executeAction("SELECT", tuple())
32 self.assertEqual("Headings", get_state_as_dict(xType)['SelectEntryText'])
34 xFormat = xDialog.getChild("format-ref")
35 self.assertEqual("Page number (unstyled)", get_state_as_dict(xFormat)['SelectEntryText'])
37 xSelect = xDialog.getChild("selecttip")
39 # Without the fix in place, this test would have failed with
40 # AssertionError: 'Header' != ''
41 self.assertEqual("Header", get_state_as_dict(xSelect)['SelectEntryText'])
42 self.assertEqual("1", get_state_as_dict(xSelect)['Children'])
44 # vim: set shiftwidth=4 softtabstop=4 expandtab: