diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /uitest/impress_tests | |
parent | Initial commit. (diff) | |
download | libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.tar.xz libreoffice-cb75148ebd0135178ff46f89a30139c44f8d2040.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'uitest/impress_tests')
-rw-r--r-- | uitest/impress_tests/backgrounds.py | 144 | ||||
-rw-r--r-- | uitest/impress_tests/drawinglayer.py | 132 | ||||
-rw-r--r-- | uitest/impress_tests/layouts.py | 45 | ||||
-rw-r--r-- | uitest/impress_tests/start.py | 54 |
4 files changed, 375 insertions, 0 deletions
diff --git a/uitest/impress_tests/backgrounds.py b/uitest/impress_tests/backgrounds.py new file mode 100644 index 000000000..b1b2f950f --- /dev/null +++ b/uitest/impress_tests/backgrounds.py @@ -0,0 +1,144 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.framework import UITestCase +from uitest.uihelper.common import select_pos +from com.sun.star.awt.GradientStyle import LINEAR +from com.sun.star.drawing.HatchStyle import SINGLE +from com.sun.star.drawing.BitmapMode import REPEAT +from com.sun.star.drawing.RectanglePoint import MIDDLE_MIDDLE + +class ImpressBackgrounds(UITestCase): + + def checkDefaultBackground(self, btn): + document = self.ui_test.get_component() + if btn == 'btnnone': + self.assertEqual(document.DrawPages.getByIndex(0).Background, None) + elif btn == 'btncolor': + self.assertEqual( + hex(document.DrawPages.getByIndex(0).Background.FillColor), '0x729fcf') + self.assertEqual( + hex(document.DrawPages.getByIndex(0).Background.FillColor), '0x729fcf') + elif btn == 'btngradient': + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Style, LINEAR) + self.assertEqual( + hex(document.DrawPages.getByIndex(0).Background.FillGradient.StartColor), '0xdde8cb') + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Angle, 300) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.Border, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.XOffset, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.YOffset, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.StartIntensity, 100) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradient.EndIntensity, 100) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillGradientName, 'Pastel Bouquet') + elif btn == 'btnhatch': + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Style, SINGLE ) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Color, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Distance, 102) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatch.Angle, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillHatchName, 'Black 0 Degrees') + elif btn == 'btnbitmap': + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapMode, REPEAT) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetX, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetY, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapRectanglePoint, MIDDLE_MIDDLE) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapStretch, False) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapTile, True) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapOffsetX, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapOffsetY, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapLogicalSize, True) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapSizeX, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapSizeY, 0) + self.assertEqual(document.DrawPages.getByIndex(0).Background.FillBitmapName, 'Painted White') + elif btn == 'btnpattern': + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapMode, REPEAT) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetX, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapPositionOffsetY, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapRectanglePoint, MIDDLE_MIDDLE) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapStretch, True) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapTile, True) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapOffsetX, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapOffsetY, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapLogicalSize, True) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapSizeX, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapSizeY, 0) + self.assertEqual( + document.DrawPages.getByIndex(0).Background.FillBitmapName, '5 Percent') + + + def test_background_dialog(self): + + with 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) + + buttons = ['btnbitmap', 'btncolor', 'btngradient', 'btnhatch', 'btnpattern'] + for index, button in enumerate(buttons): + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: + + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xBtn = xPageSetupDlg.getChild(button) + xBtn.executeAction("CLICK", tuple()) + + # tdf#100024: Without the fix in place, this test would have crashed here + # changing the background to bitmap + + self.checkDefaultBackground(button) + + with self.ui_test.execute_dialog_through_command(".uno:PageSetup") as xPageSetupDlg: + + tabcontrol = xPageSetupDlg.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xBtn = xPageSetupDlg.getChild('btnnone') + xBtn.executeAction("CLICK", tuple()) + + + self.checkDefaultBackground('btnnone') + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/drawinglayer.py b/uitest/impress_tests/drawinglayer.py new file mode 100644 index 000000000..063211d41 --- /dev/null +++ b/uitest/impress_tests/drawinglayer.py @@ -0,0 +1,132 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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 ImpressDrawinglayerTest(UITestCase): + + def test_move_object(self): + with self.ui_test.create_doc_in_start_center("impress") as document: + + 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() + + 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']) + + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + 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: + + 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() + + 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"})) + + 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('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']) + + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + 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: + + xTemplateDlg = self.xUITest.getTopFocusWindow() + xCancelBtn = xTemplateDlg.getChild("close") + self.ui_test.close_dialog_through_button(xCancelBtn) + + xImpressDoc = self.xUITest.getTopFocusWindow() + + 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"})) + + 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('30', get_state_as_dict(xDialog.getChild('NF_ANGLE'))['Value']) + + self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) + xEditWin.executeAction("DESELECT", tuple()) + self.assertIsNone(document.CurrentSelection) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/layouts.py b/uitest/impress_tests/layouts.py new file mode 100644 index 000000000..22c75e504 --- /dev/null +++ b/uitest/impress_tests/layouts.py @@ -0,0 +1,45 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.framework import UITestCase +from libreoffice.uno.propertyvalue import mkPropertyValues + +class ImpressLayouts(UITestCase): + + def test_impress_layouts(self): + + with 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) + + layouts= (".uno:AssignLayout?WhatLayout:long=20", ".uno:AssignLayout?WhatLayout:long=19", + ".uno:AssignLayout?WhatLayout:long=0", ".uno:AssignLayout?WhatLayout:long=1", + ".uno:AssignLayout?WhatLayout:long=32", ".uno:AssignLayout?WhatLayout:long=3", + ".uno:AssignLayout?WhatLayout:long=12", ".uno:AssignLayout?WhatLayout:long=15", + ".uno:AssignLayout?WhatLayout:long=14", ".uno:AssignLayout?WhatLayout:long=16", + ".uno:AssignLayout?WhatLayout:long=18", ".uno:AssignLayout?WhatLayout:long=34", + ".uno:AssignLayout?WhatLayout:long=28", ".uno:AssignLayout?WhatLayout:long=27", + ".uno:AssignLayout?WhatLayout:long=29", ".uno:AssignLayout?WhatLayout:long=30") + + for i in layouts: + self.xUITest.executeCommand(i) + + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + + # There's a layout with 7 objects + for j in range(0,6): + xEditWin.executeAction("SELECT", mkPropertyValues({"OBJECT":"Unnamed Drawinglayer object " + str(j)})) + xEditWin.executeAction("DESELECT", tuple()) + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/uitest/impress_tests/start.py b/uitest/impress_tests/start.py new file mode 100644 index 000000000..cbf38b88b --- /dev/null +++ b/uitest/impress_tests/start.py @@ -0,0 +1,54 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.framework import UITestCase + +class SimpleImpressTest(UITestCase): + def test_start_impress(self): + + with 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) + + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + xEditWin.executeAction("SET", mkPropertyValues({"ZOOM": "200"})) + + self.assertEqual(get_state_as_dict(xEditWin)["Zoom"], "200") + + + def test_select_page(self): + + with 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) + + xImpressDoc = self.xUITest.getTopFocusWindow() + + xEditWin = xImpressDoc.getChild("impress_win") + + self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1") + + self.xUITest.executeCommand(".uno:InsertPage") + + self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "2") + + xEditWin.executeAction("GOTO", mkPropertyValues({"PAGE": "1"})) + + self.assertEqual(get_state_as_dict(xEditWin)["CurrentSlide"], "1") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |