Debian Codegraph @

sw/qa/uitest/writer_tests8/tdf156783.py

raw symbols SCIP
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 #
3 # This file is part of the LibreOffice project.
4 #
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/.
8 #
9 from uitest.framework import UITestCase
10 from uitest.uihelper.common import get_state_as_dict
11 from libreoffice.uno.propertyvalue import mkPropertyValues
12 from uitest.uihelper.common import select_pos
13 from uitest.uihelper.common import get_url_for_data_file
14
15 # Bug 156783 - crash fix: setting table border on a table without correct table cursor
16
17 class tdf156783(UITestCase):
18 def test_tdf156783(self):
19 with self.ui_test.load_file(get_url_for_data_file("TC-table-del-add.docx")) as self.document:
20
21 # accept all tracked changes
22 self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
23
24 # select all tables
25 self.xUITest.executeCommand(".uno:SelectAll")
26 self.xUITest.executeCommand(".uno:SelectAll")
27 self.xUITest.executeCommand(".uno:SelectAll")
28
29 # dialog Table Properties - Borders
30 with self.ui_test.execute_dialog_through_command(".uno:TableDialog", close_button="ok") as xDialog:
31 tabcontrol = xDialog.getChild("tabcontrol")
32 select_pos(tabcontrol, "3")
33
34 sync = xDialog.getChild("sync")
35 rightmf = xDialog.getChild("rightmf")
36 leftmf = xDialog.getChild("leftmf")
37 topmf = xDialog.getChild("topmf")
38 bottommf = xDialog.getChild("bottommf")
39 sync.executeAction("CLICK", tuple())
40
41 rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
42 rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
43 rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
44 leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
45 leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
46 leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
47 topmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
48 topmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
49 topmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
50 bottommf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
51 bottommf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
52 bottommf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
53
54 self.assertEqual(get_state_as_dict(rightmf)["Text"], u"72pt")
55 self.assertEqual(get_state_as_dict(leftmf)["Text"], u"72pt")
56 self.assertEqual(get_state_as_dict(topmf)["Text"], u"72pt")
57 self.assertEqual(get_state_as_dict(bottommf)["Text"], u"72pt")
58
59 # Without the fix in place, this test would have crashed here
60
61 # vim: set shiftwidth=4 softtabstop=4 expandtab: