Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / qa / uitest / impress_tests2 / tdf130440.py
blob73fe44b31b5859c2a7fcfc320241369df055fb3a
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
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/.
10 from uitest.framework import UITestCase
11 from libreoffice.uno.propertyvalue import mkPropertyValues
13 class tdf129346(UITestCase):
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)
21 xToolkit = self.xContext.ServiceManager.createInstance('com.sun.star.awt.Toolkit')
23 self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
24 self.xUITest.executeCommand(".uno:DuplicatePage")
25 xToolkit.processEventsToIdle()
26 self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
28 xDoc = self.xUITest.getTopFocusWindow()
29 xEdit = xDoc.getChild("impress_win")
30 # Type "test" into the text box
31 xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"}))
32 # Go to Page 1, which also forces to end edit box
33 xEdit.executeAction("GOTO", mkPropertyValues({"PAGE": "1"}))
34 xToolkit.processEventsToIdle()
36 # We should be at Page 1
37 self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
39 # Undo sends us to Page 2 and undo-es the text edit
40 self.xUITest.executeCommand(".uno:Undo")
41 xToolkit.processEventsToIdle()
42 self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
44 # Undo sends us to page 1 and undo-es command ".uno:DuplicatePage"
45 self.xUITest.executeCommand(".uno:Undo")
46 xToolkit.processEventsToIdle()
47 self.assertEqual(document.CurrentController.getCurrentPage().Number, 1)
49 # Redo ".uno:DuplicatePage" - we go to Page 2
50 self.xUITest.executeCommand(".uno:Redo")
51 xToolkit.processEventsToIdle()
52 self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
54 # Redo text edit
55 self.xUITest.executeCommand(".uno:Redo")
57 xDoc = self.xUITest.getTopFocusWindow()
58 xEdit = xDoc.getChild("impress_win")
59 xEdit.executeAction("TYPE", mkPropertyValues({"TEXT":"test"}))
61 xToolkit.processEventsToIdle()
62 #Without the accompanying fix in place, it would fail with AssertionError: 2 != 1
63 self.assertEqual(document.CurrentController.getCurrentPage().Number, 2)
65 # vim: set shiftwidth=4 softtabstop=4 expandtab: