| 1 |
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- |
| 2 |
# |
| 3 |
# This file is part of the LibreOffice project. |
| 4 |
# |
| 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/. |
| 8 |
# |
| 9 |
|
| 10 |
from uitest.framework import UITestCase |
| 11 |
from libreoffice.uno.propertyvalue import mkPropertyValues |
| 12 |
from uitest.uihelper.common import get_state_as_dict |
| 13 |
|
| 14 |
class Tdf137637(UITestCase): |
| 15 |
|
| 16 |
def test_tdf137637(self): |
| 17 |
with self.ui_test.create_doc_in_start_center("impress") as document: |
| 18 |
|
| 19 |
xTemplateDlg = self.xUITest.getTopFocusWindow() |
| 20 |
xCancelBtn = xTemplateDlg.getChild("close") |
| 21 |
self.ui_test.close_dialog_through_button(xCancelBtn) |
| 22 |
|
| 23 |
# Insert shape with Ctrl key |
| 24 |
xArgs = mkPropertyValues({"KeyModifier": 8192}) |
| 25 |
self.xUITest.executeCommandWithParameters(".uno:BasicShapes.rectangle", xArgs) |
| 26 |
|
| 27 |
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) |
| 28 |
|
| 29 |
xImpressDoc = self.xUITest.getTopFocusWindow() |
| 30 |
|
| 31 |
xEditWin = xImpressDoc.getChild("impress_win") |
| 32 |
|
| 33 |
xEditWin.executeAction("SIDEBAR", mkPropertyValues({"PANEL": "SdCustomAnimationPanel"})) |
| 34 |
|
| 35 |
# Without the fix in place, this test would have failed with |
| 36 |
# AttributeError: 'NoneType' object has no attribute 'getImplementationName' |
| 37 |
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) |
| 38 |
|
| 39 |
xAnimationList = xImpressDoc.getChild("custom_animation_list") |
| 40 |
self.assertEqual('0', get_state_as_dict(xAnimationList)['Children']) |
| 41 |
|
| 42 |
xAddBtn = xImpressDoc.getChild("add_effect") |
| 43 |
xAddBtn.executeAction("CLICK", tuple()) |
| 44 |
|
| 45 |
self.assertEqual('1', get_state_as_dict(xAnimationList)['Children']) |
| 46 |
|
| 47 |
self.xUITest.executeCommand(".uno:Undo") |
| 48 |
|
| 49 |
# tdf#135033: Without the fix in place, this test would have failed with |
| 50 |
# AssertionError: '0' != '1' |
| 51 |
self.assertEqual('0', get_state_as_dict(xAnimationList)['Children']) |
| 52 |
|
| 53 |
# tdf#145030: Without the fix in place, this test would have failed with |
| 54 |
# AttributeError: 'NoneType' object has no attribute 'getImplementationName' |
| 55 |
self.assertEqual("com.sun.star.drawing.SvxShapeCollection", document.CurrentSelection.getImplementationName()) |
| 56 |
|
| 57 |
# vim: set shiftwidth=4 softtabstop=4 expandtab: |