Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests4 / tdf134439.py
blobd34c365dc55c91883e37216a6965c0507fc7a01d
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, get_url_for_data_file
11 from uitest.uihelper.common import select_by_text
13 class tdf134439(UITestCase):
15 def test_tdf134439(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf134439.odt")) as document:
19 self.assertEqual(document.CurrentController.PageCount, 3)
21 xCursor = document.CurrentController.ViewCursor
22 self.assertEqual("Chap 1", xCursor.PageStyleName)
24 xPageBreak = self.ui_test.wait_until_child_is_available('PageBreak')
25 with self.ui_test.execute_dialog_through_action(xPageBreak, "EDIT") as xDialog:
28 self.assertEqual("Page", get_state_as_dict(xDialog.getChild("comboBreakType"))["SelectEntryText"])
29 self.assertEqual("Before", get_state_as_dict(xDialog.getChild("comboBreakPosition"))["SelectEntryText"])
31 xPageStyle = xDialog.getChild("comboPageStyle")
32 self.assertEqual("Chap 2", get_state_as_dict(xPageStyle)["SelectEntryText"])
34 select_by_text(xPageStyle, "Chap 3")
36 self.assertEqual("Chap 3", get_state_as_dict(xPageStyle)["SelectEntryText"])
38 # tdf#116070: Without the fix in place, this test would have crashed here
40 # Without the fix in place, this test would have failed with
41 # AssertionError: 'Chap 1' != 'Chap 3'
42 self.assertEqual("Chap 1", xCursor.PageStyleName)
44 self.assertEqual(document.CurrentController.PageCount, 3)
46 xCursor.jumpToNextPage()
47 self.assertEqual("Chap 3", xCursor.PageStyleName)
49 self.xUITest.executeCommand(".uno:Undo")
51 self.assertEqual("Chap 2", xCursor.PageStyleName)
53 # vim: set shiftwidth=4 softtabstop=4 expandtab: