summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2022-02-28 20:00:53 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-02-28 22:42:10 +0100
commit30c302cf489571ef13579c1ecd27c276945138d0 (patch)
tree29c598839c0196acdc4430b3c00aef9eb7349af0 /uitest
parent907a3c0248834f13441ec8c1239b3ca5c016aa5a (diff)
uitest: fix sporadic UITest_impress_demo failures
Revert 9158d2d2f19cf7bccba12d2ad4cb340e882b51cc < blind fix for UITest_impress_demo failed > and 99d2ee15ad6fae7073a53f7df8868300328a36e7 < blind fix for UITest_impress_demo failures > Instead of asserting the shapes' properties directly, Use the Position and Size dialog Change-Id: Ie9aec0dbd1f1fc2ccab0993b428c8ac17938b3b5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130724 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest')
-rw-r--r--uitest/impress_tests/drawinglayer.py81
-rw-r--r--uitest/uitest/uihelper/common.py3
2 files changed, 31 insertions, 53 deletions
diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py
index acd1dbffe6fc..063211d413c6 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -25,32 +25,25 @@ class ImpressDrawinglayerTest(UITestCase):
xImpressDoc = self.xUITest.getTopFocusWindow()
- 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)
-
-
- xEditWin = xImpressDoc.getChild("impress_win")
- xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
- xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"}))
-
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
- self.assertEqual(1400, document.DrawPages[0].getByIndex(0).Position.X)
- self.assertEqual(628, document.DrawPages[0].getByIndex(0).Position.Y)
- self.assertEqual(2400, document.DrawPages[0].getByIndex(1).Position.X)
- self.assertEqual(4685, 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())
with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog:
self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+
+ xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
+ xDrawinglayerObject.executeAction("MOVE", mkPropertyValues({"X": "1000", "Y":"1000"}))
+
+ with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog:
+ self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
self.assertEqual('2.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
self.assertEqual('4.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
@@ -59,7 +52,6 @@ class ImpressDrawinglayerTest(UITestCase):
xEditWin.executeAction("DESELECT", tuple())
self.assertIsNone(document.CurrentSelection)
-
def test_resize_object(self):
with self.ui_test.create_doc_in_start_center("impress") as document:
@@ -71,26 +63,22 @@ class ImpressDrawinglayerTest(UITestCase):
xImpressDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertAlmostEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height,delta=1)
+ 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())
+
+ with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog:
+ self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
xDrawinglayerObject.executeAction("RESIZE", mkPropertyValues({"X": "500", "Y":"4000", "FRAC_X": "0.5", "FRAC_Y": "0.5"}))
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertAlmostEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height,delta=1)
-
- self.assertIsNone(document.CurrentSelection)
-
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
@@ -105,7 +93,6 @@ class ImpressDrawinglayerTest(UITestCase):
xEditWin.executeAction("DESELECT", tuple())
self.assertIsNone(document.CurrentSelection)
-
def test_rotate_object(self):
with self.ui_test.create_doc_in_start_center("impress") as document:
@@ -115,28 +102,22 @@ class ImpressDrawinglayerTest(UITestCase):
xImpressDoc = self.xUITest.getTopFocusWindow()
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertAlmostEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height,delta=1)
- self.assertEqual(0, document.DrawPages[0].getByIndex(1).RotateAngle)
+ 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())
+
+ with self.ui_test.execute_dialog_through_command(".uno:Size") as xDialog:
+ self.assertEqual('25.2', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('9.13', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('1.4', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('3.69', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
xDrawinglayerObject = xEditWin.getChild("Unnamed Drawinglayer object 1")
xDrawinglayerObject.executeAction("ROTATE", mkPropertyValues({"X": "500", "Y":"4000", "ANGLE": "3000"}))
- xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
- self.assertEqual(25199, document.DrawPages[0].getByIndex(0).Size.Width)
- self.assertEqual(2629, document.DrawPages[0].getByIndex(0).Size.Height)
- self.assertEqual(25199, document.DrawPages[0].getByIndex(1).Size.Width)
- self.assertAlmostEqual(9134, document.DrawPages[0].getByIndex(1).Size.Height,delta=1)
- self.assertEqual(3000, document.DrawPages[0].getByIndex(1).RotateAngle)
-
- self.assertIsNone(document.CurrentSelection)
-
xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py
index 2ae70399dfb1..ffdf90d48db8 100644
--- a/uitest/uitest/uihelper/common.py
+++ b/uitest/uitest/uihelper/common.py
@@ -55,7 +55,4 @@ def change_measurement_unit(UITestCase, unit):
xApplyBtn.executeAction("CLICK", tuple())
UITestCase.assertEqual(unit, get_state_as_dict(xUnit)['SelectEntryText'])
- xToolkit = UITestCase.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
- xToolkit.processEventsToIdle()
-
# vim: set shiftwidth=4 softtabstop=4 expandtab: