cool#10630 lok doc sign: fix Impress sign line when picking a certificate
[LibreOffice.git] / sw / qa / uitest / writer_tests5 / columns.py
blob8da22cef4178e29fee07fb258a44e80e90e7b043
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, get_url_for_data_file
11 from uitest.uihelper.common import change_measurement_unit
12 from libreoffice.uno.propertyvalue import mkPropertyValues
13 #uitest sw / Columns dialog
15 class columns(UITestCase):
16 def test_columns(self):
17 with self.ui_test.create_doc_in_start_center("writer"):
19 with change_measurement_unit(self, "Centimeter"):
21 #dialog Columns
22 with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog:
24 colsnf = xDialog.getChild("colsnf")
25 colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
26 colsnf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
27 colsnf.executeAction("TYPE", mkPropertyValues({"TEXT":"2"}))
28 colsnf.executeAction("UP", tuple())
29 colsnf.executeAction("DOWN", tuple())
30 spacing1mf = xDialog.getChild("spacing1mf")
31 spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
32 spacing1mf.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
33 spacing1mf.executeAction("TYPE", mkPropertyValues({"TEXT":"1"}))
34 autowidth = xDialog.getChild("autowidth")
35 autowidth.executeAction("CLICK", tuple())
36 #verify
37 with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
38 colsnf = xDialog.getChild("colsnf")
39 spacing1mf = xDialog.getChild("spacing1mf")
40 autowidth = xDialog.getChild("autowidth")
42 self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
43 self.assertEqual(get_state_as_dict(spacing1mf)["Text"], "1.00 cm")
44 self.assertEqual(get_state_as_dict(autowidth)["Selected"], "false")
46 def test_tdf150293_separator_width_unit_conversion(self):
47 with self.ui_test.load_file(get_url_for_data_file("section-columns-separator.fodt")):
49 #dialog Columns
50 with self.ui_test.execute_dialog_through_command(".uno:FormatColumns") as xDialog:
51 linewidthmf = xDialog.getChild("linewidthmf")
53 # Without the fix in place, this test would have failed with
54 # AssertionError: '0.45 pt' != '0.25 pt'
55 self.assertEqual(get_state_as_dict(linewidthmf)["Text"], "0.25 pt")
57 # Set it to 0.5 pt
58 linewidthmf.executeAction("UP", tuple())
59 self.assertEqual(get_state_as_dict(linewidthmf)["Text"], "0.50 pt")
61 # save and reload: the new value of line width must roundtrip unchanged
62 self.xUITest.executeCommand('.uno:Save')
63 self.xUITest.executeCommand('.uno:Reload')
65 with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
66 linewidthmf = xDialog.getChild("linewidthmf")
68 # Without the fix in place, this test would have failed with
69 # AssertionError: '0.55 pt' != '0.50 pt'
70 self.assertEqual(get_state_as_dict(linewidthmf)["Text"], "0.50 pt")
73 # vim: set shiftwidth=4 softtabstop=4 expandtab: