Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests6 / tdf144691.py
blob14e8a62a4b5aa3feef69ca259dd39619141e68a4
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
12 from uitest.uihelper.common import select_by_text
14 class tdf144691(UITestCase):
16 def test_tdf144691(self):
18 with self.ui_test.create_doc_in_start_center("writer"):
20 with self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog") as xDialog:
21 xPages = xDialog.getChild("pages")
22 xLanguageEntry = xPages.getChild('2')
23 xLanguageEntry.executeAction("EXPAND", tuple())
24 xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
25 xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple())
27 xWesternLanguage = xDialog.getChild("westernlanguage")
29 defaultLanguage = get_state_as_dict(xWesternLanguage)['SelectEntryText']
31 try:
32 # Select another language
33 select_by_text(xWesternLanguage, "Tajik")
34 self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText'])
36 xApply = xDialog.getChild("apply")
37 xApply.executeAction("CLICK", tuple())
39 # Without the fix in place, this test would have failed with
40 # AssertionError: 'Tajik' != 'English (USA)'
41 self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText'])
42 finally:
43 # Select the default language
44 select_by_text(xWesternLanguage, defaultLanguage)
45 self.assertEqual(defaultLanguage, get_state_as_dict(xWesternLanguage)['SelectEntryText'])
47 # vim: set shiftwidth=4 softtabstop=4 expandtab: