Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / findReplace / tdf137737.py
blob6e24a2ced4e7aebbbe3de66960aa2db4b19e95cd
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_url_for_data_file, get_state_as_dict
12 from libreoffice.uno.propertyvalue import mkPropertyValues
14 class tdf137737(UITestCase):
16 def test_tdf137737(self):
17 with self.ui_test.load_file(get_url_for_data_file("tdf137737.odt")) as writer_doc:
19 self.assertEqual(2, writer_doc.Endnotes.Count)
21 with self.ui_test.execute_modeless_dialog_through_command(".uno:SearchDialog", close_button="close") as xDialog:
22 xSearchterm = xDialog.getChild("searchterm")
23 xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
24 xSearchterm.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
25 xSearchterm.executeAction("TYPE", mkPropertyValues({"TEXT":"[:control:]"}))
27 xReplaceterm = xDialog.getChild("replaceterm")
28 xReplaceterm.executeAction("TYPE", mkPropertyValues({"TEXT":"A"}))
30 # Deselect similarity before selecting regex
31 xSimilarity = xDialog.getChild("similarity")
32 if get_state_as_dict(xSimilarity)['Selected'] == 'true':
33 xSimilarity.executeAction("CLICK", tuple())
35 xRegexp = xDialog.getChild("regexp")
36 xRegexp.executeAction("CLICK", tuple())
37 self.assertEqual("true", get_state_as_dict(xRegexp)['Selected'])
39 replaceall = xDialog.getChild("replaceall")
40 replaceall.executeAction("CLICK", tuple())
42 # Deselect regex button, otherwise it might affect other tests
43 xRegexp.executeAction("CLICK", tuple())
44 self.assertEqual("false", get_state_as_dict(xRegexp)['Selected'])
46 # Without the fix in place, this test would have failed with
47 # AssertionError: 0 != 1
48 self.assertEqual(0, writer_doc.Endnotes.Count)
50 # vim: set shiftwidth=4 softtabstop=4 expandtab: