Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / qa / uitest / writer_tests7 / tdf156783.py
blob2ccdb7dcf6e193445b82c6b69e4cb42303960bf2
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
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
15 # Bug 156783 - crash fix: setting table border on a table without correct table cursor
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:
21 xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
23 # accept all tracked changes
24 self.xUITest.executeCommand(".uno:AcceptAllTrackedChanges")
26 # select all tables
27 self.xUITest.executeCommand(".uno:SelectAll")
28 self.xUITest.executeCommand(".uno:SelectAll")
29 self.xUITest.executeCommand(".uno:SelectAll")
31 # dialog Table Properties - Borders
32 with self.ui_test.execute_dialog_through_command(".uno:TableDialog", close_button="ok") as xDialog:
33 tabcontrol = xDialog.getChild("tabcontrol")
34 select_pos(tabcontrol, "3")
36 sync = xDialog.getChild("sync")
37 rightmf = xDialog.getChild("rightmf")
38 leftmf = xDialog.getChild("leftmf")
39 topmf = xDialog.getChild("topmf")
40 bottommf = xDialog.getChild("bottommf")
41 sync.executeAction("CLICK", tuple())
43 rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
44 rightmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
45 rightmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
46 leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
47 leftmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
48 leftmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
49 topmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
50 topmf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
51 topmf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
52 bottommf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
53 bottommf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
54 bottommf.executeAction("TYPE", mkPropertyValues({"TEXT":"72pt"}))
56 self.assertEqual(get_state_as_dict(rightmf)["Text"], u"72pt")
57 self.assertEqual(get_state_as_dict(leftmf)["Text"], u"72pt")
58 self.assertEqual(get_state_as_dict(topmf)["Text"], u"72pt")
59 self.assertEqual(get_state_as_dict(bottommf)["Text"], u"72pt")
61 # Without the fix in place, this test would have crashed here
63 # vim: set shiftwidth=4 softtabstop=4 expandtab: