Get the style color and number just once
[LibreOffice.git] / sw / qa / uitest / writer_tests4 / tdf128192.py
blob3c5f72c3beef17172d9504aa1245566ffcef1ba0
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 libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
14 #Bug 128192 - Fix Tools/AutoCorrect/Apply to apply for all styles
16 class tdf128192(UITestCase):
18 def test_tdf128192(self):
19 with self.ui_test.load_file(get_url_for_data_file("tdf128192.odt")):
20 MainWindow = self.xUITest.getTopFocusWindow()
21 writer_edit = MainWindow.getChild("writer_edit")
23 # perform Tools/AutoCorrect/Apply on the whole document
24 self.xUITest.executeCommand(".uno:SelectAll")
25 self.xUITest.executeCommand(".uno:AutoFormatApply")
27 # test for each style whether "Replace dashes" works in AutoCorrect
28 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "9", "START_POS": "14"}))
29 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
31 self.xUITest.executeCommand(".uno:GoUp")
32 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "19", "START_POS": "24"}))
33 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
35 self.xUITest.executeCommand(".uno:GoUp")
36 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "12", "START_POS": "17"}))
37 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
39 self.xUITest.executeCommand(".uno:GoUp")
40 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
41 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
43 self.xUITest.executeCommand(".uno:GoUp")
44 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
45 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
47 self.xUITest.executeCommand(".uno:GoUp")
48 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
49 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
51 self.xUITest.executeCommand(".uno:GoUp")
52 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "11", "START_POS": "16"}))
53 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
55 self.xUITest.executeCommand(".uno:GoUp")
56 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "16", "START_POS": "11"}))
57 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
59 self.xUITest.executeCommand(".uno:GoUp")
60 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "25", "START_POS": "30"}))
61 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
63 self.xUITest.executeCommand(".uno:GoUp")
64 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "10", "START_POS": "15"}))
65 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
67 self.xUITest.executeCommand(".uno:GoUp")
68 writer_edit.executeAction("SELECT", mkPropertyValues({"END_POS": "7", "START_POS": "12"}))
69 self.assertEqual(get_state_as_dict(writer_edit)["SelectedText"], "A – B")
72 # vim: set shiftwidth=4 softtabstop=4 expandtab: