From 5692bafd2f43c25e9ef52f3b1eda1ca3d8556bf1 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Wed, 17 Feb 2021 10:41:32 +0100 Subject: tdf#82616: sd: Add UItest Change-Id: I84c148f98517cd4f7cb07f268b71bf2ac7e18322 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111031 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sd/qa/uitest/impress_tests/tdf82616.py | 66 ++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sd/qa/uitest/impress_tests/tdf82616.py (limited to 'sd') diff --git a/sd/qa/uitest/impress_tests/tdf82616.py b/sd/qa/uitest/impress_tests/tdf82616.py new file mode 100644 index 000000000000..d8c4cb1bdcfc --- /dev/null +++ b/sd/qa/uitest/impress_tests/tdf82616.py @@ -0,0 +1,66 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +from uitest.uihelper.common import get_state_as_dict +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import change_measurement_unit +from uitest.framework import UITestCase + +class Tdf82616(UITestCase): + + def test_tdf82616(self): + self.ui_test.create_doc_in_start_center("impress") + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + change_measurement_unit(self, 'Centimeter') + + xImpressDoc = self.xUITest.getTopFocusWindow() + + document = self.ui_test.get_component() + self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) + self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) + self.assertEqual(1400, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(3685, document.DrawPages[0].getByIndex(1).Position.Y) + + self.assertIsNone(document.CurrentSelection) + + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"})) + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + + xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "PosSizePropertyPanel"})) + + xHorizontalPos = xImpressDoc.getChild("horizontalpos") + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "1.4") + self.assertEqual("1.4", get_state_as_dict(xHorizontalPos)['Value']) + + xVerticalPos = xImpressDoc.getChild("verticalpos") + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "3.69") + self.assertEqual("3.69", get_state_as_dict(xVerticalPos)['Value']) + + xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1") + xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "-5000", "Y":"-10000"})) + + self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X) + self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y) + self.assertEqual(-3600, document.DrawPages[0].getByIndex(1).Position.X) + self.assertEqual(-6315, document.DrawPages[0].getByIndex(1).Position.Y) + + # Without the fix in place, this test would have failed with + # AssertionError: '-3.6' != '0' + self.ui_test.wait_until_property_is_updated(xHorizontalPos, "Value", "-3.6") + self.assertEqual("-3.6", get_state_as_dict(xHorizontalPos)['Value']) + + self.ui_test.wait_until_property_is_updated(xVerticalPos, "Value", "-6.32") + self.assertEqual("-6.32", get_state_as_dict(xVerticalPos)['Value']) + + self.ui_test.close_doc() + +# vim: set shiftwidth=4 softtabstop=4 expandtab: -- cgit