[Libreoffice-commits] core.git: uitest/impress_tests uitest/uitest
Xisco Fauli (via logerrit)
logerrit at kemper.freedesktop.org
Wed Dec 16 22:36:17 UTC 2020
uitest/impress_tests/drawinglayer.py | 50 +++++++++++++++++++++++++++++++++++
uitest/uitest/uihelper/common.py | 4 ++
2 files changed, 54 insertions(+)
New commits:
commit f6ae309370debfdba352d7dd0a28835d3448bbbf
Author: Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Dec 16 20:10:14 2020 +0100
Commit: Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Dec 16 23:35:28 2020 +0100
uitest: sd: Check Position and Size dialog after moving...
and resizing objects
Change-Id: I63ccc96c07a973b53bf448d3a3d2d4eeac406c4d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107853
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py
index e24d98b9571e..d4de9f32a7a4 100644
--- a/uitest/impress_tests/drawinglayer.py
+++ b/uitest/impress_tests/drawinglayer.py
@@ -7,6 +7,7 @@
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 ImpressDrawinglayerTest(UITestCase):
@@ -18,6 +19,8 @@ class ImpressDrawinglayerTest(UITestCase):
xCancelBtn = xTemplateDlg.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancelBtn)
+ change_measurement_unit(self, 'Centimeter')
+
xImpressDoc = self.xUITest.getTopFocusWindow()
document = self.ui_test.get_component()
@@ -26,6 +29,7 @@ class ImpressDrawinglayerTest(UITestCase):
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"}))
@@ -35,6 +39,28 @@ class ImpressDrawinglayerTest(UITestCase):
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.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+
+ self.ui_test.execute_dialog_through_command(".uno:Size")
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ 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'])
+
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ xEditWin.executeAction("DESELECT", tuple())
+ self.assertIsNone(document.CurrentSelection)
+
self.ui_test.close_doc()
def test_resize_object(self):
@@ -44,6 +70,8 @@ class ImpressDrawinglayerTest(UITestCase):
xCancelBtn = xTemplateDlg.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancelBtn)
+ change_measurement_unit(self, 'Centimeter')
+
xImpressDoc = self.xUITest.getTopFocusWindow()
document = self.ui_test.get_component()
@@ -62,6 +90,28 @@ class ImpressDrawinglayerTest(UITestCase):
self.assertEqual(12600, document.DrawPages[0].getByIndex(1).Size.Width)
self.assertEqual(4568, document.DrawPages[0].getByIndex(1).Size.Height)
+ self.assertIsNone(document.CurrentSelection)
+
+ xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object 1"}))
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+
+ self.ui_test.execute_dialog_through_command(".uno:Size")
+
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ self.assertEqual('12.6', get_state_as_dict(xDialog.getChild('MTR_FLD_WIDTH'))['Value'])
+ self.assertEqual('4.57', get_state_as_dict(xDialog.getChild('MTR_FLD_HEIGHT'))['Value'])
+ self.assertEqual('0.95', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_X'))['Value'])
+ self.assertEqual('3.84', get_state_as_dict(xDialog.getChild('MTR_FLD_POS_Y'))['Value'])
+ self.assertEqual('0', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value'])
+
+ xOK = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOK)
+
+ self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName())
+ xEditWin.executeAction("DESELECT", tuple())
+ self.assertIsNone(document.CurrentSelection)
+
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/uitest/uitest/uihelper/common.py b/uitest/uitest/uihelper/common.py
index cf3a277aa15b..7af57ea2fa92 100644
--- a/uitest/uitest/uihelper/common.py
+++ b/uitest/uitest/uihelper/common.py
@@ -37,6 +37,10 @@ def change_measurement_unit(UITestCase, unit):
elif 'metric' in xDialogOpt.getChildren():
xUnit = xDialogOpt.getChild("metric")
+ # Impress
+ elif 'units' in xDialogOpt.getChildren():
+ xUnit = xDialogOpt.getChild("units")
+
props = {"TEXT": unit}
actionProps = mkPropertyValues(props)
xUnit.executeAction("SELECT", actionProps)
More information about the Libreoffice-commits
mailing list