Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / fieldDialog / tdf143483.py
blob03eeceb7954a5aa2dd8664039d872d8f2f09477b
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, get_url_for_data_file
13 class Tdf143483(UITestCase):
15 def test_tdf143483(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf143483.odt")) as document:
19 self.xUITest.executeCommand(".uno:JumpToNextBookmark")
21 with self.ui_test.execute_dialog_through_command(".uno:FieldDialog") as xDialog:
23 xDoc = xDialog.getChild("type-doc")
24 self.assertEqual("Heading", get_state_as_dict(xDoc)['SelectEntryText'])
26 xFormat = xDialog.getChild("format-doc")
27 self.assertEqual("Heading contents", get_state_as_dict(xFormat)['SelectEntryText'])
29 xNext = xDialog.getChild("next")
30 xNext.executeAction("CLICK", tuple())
32 self.assertEqual("Heading", get_state_as_dict(xDoc)['SelectEntryText'])
33 self.assertEqual("Heading number", get_state_as_dict(xFormat)['SelectEntryText'])
35 xNext.executeAction("CLICK", tuple())
37 self.assertEqual("Heading", get_state_as_dict(xDoc)['SelectEntryText'])
38 self.assertEqual("Heading number and contents", get_state_as_dict(xFormat)['SelectEntryText'])
40 xNext.executeAction("CLICK", tuple())
42 self.assertEqual("Heading", get_state_as_dict(xDoc)['SelectEntryText'])
43 self.assertEqual("Heading number without separator", get_state_as_dict(xFormat)['SelectEntryText'])
45 xEnumeration = document.Text.createEnumeration()
46 self.assertEqual("Another title", xEnumeration.nextElement().String)
47 self.assertEqual("", xEnumeration.nextElement().String)
48 self.assertEqual("1. Another title", xEnumeration.nextElement().String)
50 # Without the fix in place, this test would have failed with
51 # AssertionError: '2. Chapter 1 -' != '2. Another title'
52 self.assertEqual("2. Chapter 1 -", xEnumeration.nextElement().String)
53 self.assertEqual("3. Chapter 1 - Another title", xEnumeration.nextElement().String)
54 self.assertEqual("4. 1", xEnumeration.nextElement().String)
56 # vim: set shiftwidth=4 softtabstop=4 expandtab: