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 select_pos
11 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
12 from uitest
.uihelper
.common
import change_measurement_unit
13 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
15 #Writer Table Properties
17 class tdf134881(UITestCase
):
18 def test_tdf134881(self
):
19 with self
.ui_test
.load_file(get_url_for_data_file("tdf134881_colProportionalAdjust.odt")):
21 with
change_measurement_unit(self
, "Centimeter"):
23 #dialog Table Properties
24 with self
.ui_test
.execute_dialog_through_command(".uno:TableDialog") as xDialog
:
25 tabcontrol
= xDialog
.getChild("tabcontrol")
26 select_pos(tabcontrol
, "2") #columns
28 adaptcolumns
= xDialog
.getChild("adaptcolumns")
29 width1
= xDialog
.getChild("width1")
30 width2
= xDialog
.getChild("width2")
31 # Get the baseline. The first column is much shorter than the second.
32 self
.assertEqual((get_state_as_dict(width1
)["Text"])[0:3], "3.0")
33 self
.assertEqual((get_state_as_dict(width2
)["Text"])[0:4], "14.0")
34 # Set proportional adjust - so all columns are affected.
35 adaptcolumns
.executeAction("CLICK", tuple())
36 # Cut the second column in half.
37 width2
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
38 width2
.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
39 width2
.executeAction("TYPE", mkPropertyValues({"TEXT":"7"}))
40 width2
.executeAction("TYPE", mkPropertyValues({"KEYCODE": "RETURN"}))
42 # The first column should now be half it's original value, not zero (not 3 - 7)
43 self
.assertEqual((get_state_as_dict(width1
)["Text"])[0:2], "1.") #1.5
46 # vim: set shiftwidth=4 softtabstop=4 expandtab: