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
.uihelper
.common
import get_state_as_dict
11 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
12 from uitest
.uihelper
.common
import change_measurement_unit
13 from uitest
.framework
import UITestCase
15 class Tdf82616(UITestCase
):
17 def test_tdf82616(self
):
18 with self
.ui_test
.create_doc_in_start_center("impress") as document
:
20 xTemplateDlg
= self
.xUITest
.getTopFocusWindow()
21 xCancelBtn
= xTemplateDlg
.getChild("close")
22 self
.ui_test
.close_dialog_through_button(xCancelBtn
)
24 with
change_measurement_unit(self
, 'Centimeter'):
26 xImpressDoc
= self
.xUITest
.getTopFocusWindow()
28 self
.assertIsNone(document
.CurrentSelection
)
30 xEditWin
= xImpressDoc
.getChild("impress_win")
31 xEditWin
.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
32 self
.assertEqual("com.sun.star.drawing.SvxShapeCollection", document
.CurrentSelection
.getImplementationName())
34 with self
.ui_test
.execute_dialog_through_command(".uno:Size") as xDialog
:
35 self
.assertEqual('25.2', get_state_as_dict(xDialog
.getChild('MTR_FLD_WIDTH'))['Value'])
36 self
.assertEqual('9.13', get_state_as_dict(xDialog
.getChild('MTR_FLD_HEIGHT'))['Value'])
37 self
.assertEqual('1.4', get_state_as_dict(xDialog
.getChild('MTR_FLD_POS_X'))['Value'])
38 self
.assertEqual('3.69', get_state_as_dict(xDialog
.getChild('MTR_FLD_POS_Y'))['Value'])
39 self
.assertEqual('0', get_state_as_dict(xDialog
.getChild('NF_ANGLE'))['Value'])
41 xEditWin
.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"}))
43 xHorizontalPos
= xImpressDoc
.getChild("horizontalpos")
44 self
.ui_test
.wait_until_property_is_updated(xHorizontalPos
, "Value", "1.4")
45 self
.assertEqual("1.4", get_state_as_dict(xHorizontalPos
)['Value'])
47 xVerticalPos
= xImpressDoc
.getChild("verticalpos")
48 self
.ui_test
.wait_until_property_is_updated(xVerticalPos
, "Value", "3.69")
49 self
.assertEqual("3.69", get_state_as_dict(xVerticalPos
)['Value'])
51 xDrawinglayerObject
= xEditWin
.getChild("Unnamed Drawinglayer object 1")
52 xDrawinglayerObject
.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"}))
54 with self
.ui_test
.execute_dialog_through_command(".uno:Size") as xDialog
:
55 self
.assertEqual('25.2', get_state_as_dict(xDialog
.getChild('MTR_FLD_WIDTH'))['Value'])
56 self
.assertEqual('9.13', get_state_as_dict(xDialog
.getChild('MTR_FLD_HEIGHT'))['Value'])
57 self
.assertEqual('-3.6', get_state_as_dict(xDialog
.getChild('MTR_FLD_POS_X'))['Value'])
58 self
.assertEqual('-6.32', get_state_as_dict(xDialog
.getChild('MTR_FLD_POS_Y'))['Value'])
59 self
.assertEqual('0', get_state_as_dict(xDialog
.getChild('NF_ANGLE'))['Value'])
61 # Without the fix in place, this test would have failed with
62 # AssertionError: '-3.6' != '0'
63 self
.ui_test
.wait_until_property_is_updated(xHorizontalPos
, "Value", "-3.6")
64 self
.assertEqual("-3.6", get_state_as_dict(xHorizontalPos
)['Value'])
66 self
.ui_test
.wait_until_property_is_updated(xVerticalPos
, "Value", "-6.32")
67 self
.assertEqual("-6.32", get_state_as_dict(xVerticalPos
)['Value'])
70 # vim: set shiftwidth=4 softtabstop=4 expandtab: