| 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 |
|
| 13 |
class tdf130586(UITestCase): |
| 14 |
|
| 15 |
def test_run(self): |
| 16 |
with self.ui_test.create_doc_in_start_center("impress") as document: |
| 17 |
xTemplateDlg = self.xUITest.getTopFocusWindow() |
| 18 |
xCancelBtn = xTemplateDlg.getChild("close") |
| 19 |
self.ui_test.close_dialog_through_button(xCancelBtn) |
| 20 |
|
| 21 |
xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit') |
| 22 |
|
| 23 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) |
| 24 |
|
| 25 |
# Insert a new slide |
| 26 |
self.xUITest.executeCommand(".uno:InsertPage") |
| 27 |
xToolkit.processEventsToIdle() |
| 28 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) |
| 29 |
|
| 30 |
# Change layout on slide 2 |
| 31 |
self.xUITest.executeCommand(".uno:AssignLayout?WhatLayout:long=1") |
| 32 |
xToolkit.processEventsToIdle() |
| 33 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) |
| 34 |
|
| 35 |
# Undo x2 (undo layout change, then undo insert slide) |
| 36 |
self.xUITest.executeCommand(".uno:Undo") |
| 37 |
xToolkit.processEventsToIdle() |
| 38 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) |
| 39 |
|
| 40 |
self.xUITest.executeCommand(".uno:Undo") |
| 41 |
xToolkit.processEventsToIdle() |
| 42 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 1) |
| 43 |
|
| 44 |
# Redo x2 (redo insert slide, then redo layout change) |
| 45 |
self.xUITest.executeCommand(".uno:Redo") |
| 46 |
xToolkit.processEventsToIdle() |
| 47 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) |
| 48 |
|
| 49 |
self.xUITest.executeCommand(".uno:Redo") |
| 50 |
xToolkit.processEventsToIdle() |
| 51 |
# Without the fix, this would fail with AssertionError: 2 != 1 |
| 52 |
self.assertEqual(document.CurrentController.getCurrentPage().Number, 2) |
| 53 |
|
| 54 |
# vim: set shiftwidth=4 softtabstop=4 expandtab: |