1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 from uitest
.framework
import UITestCase
8 from libreoffice
.uno
.propertyvalue
import mkPropertyValues
10 class tdf129346(UITestCase
):
13 self
.ui_test
.create_doc_in_start_center("impress")
14 xTemplateDlg
= self
.xUITest
.getTopFocusWindow()
15 xCancelBtn
= xTemplateDlg
.getChild("cancel")
16 self
.ui_test
.close_dialog_through_button(xCancelBtn
)
18 xToolkit
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.awt.Toolkit')
20 document
= self
.ui_test
.get_component()
21 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 1)
22 self
.xUITest
.executeCommand(".uno:DuplicatePage")
23 xToolkit
.processEventsToIdle()
24 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 2)
26 xDoc
= self
.xUITest
.getTopFocusWindow()
27 xEdit
= xDoc
.getChild("impress_win")
28 xEdit
.executeAction("TYPE", mkPropertyValues({"TEXT":"test"}))
30 self
.xUITest
.executeCommand(".uno:Undo")
31 xToolkit
.processEventsToIdle()
32 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 2)
34 self
.xUITest
.executeCommand(".uno:Undo")
35 xToolkit
.processEventsToIdle()
36 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 2)
38 self
.xUITest
.executeCommand(".uno:Undo")
39 xToolkit
.processEventsToIdle()
40 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 1)
42 self
.xUITest
.executeCommand(".uno:Redo")
43 xToolkit
.processEventsToIdle()
44 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 2)
46 self
.xUITest
.executeCommand(".uno:Redo")
48 xDoc
= self
.xUITest
.getTopFocusWindow()
49 xEdit
= xDoc
.getChild("impress_win")
50 xEdit
.executeAction("TYPE", mkPropertyValues({"TEXT":"test"}))
52 xToolkit
.processEventsToIdle()
53 #Without the accompanying fix in place, it would fail with AssertionError: 2 != 1
54 self
.assertEqual(document
.CurrentController
.getCurrentPage().Number
, 2)
55 self
.ui_test
.close_doc()
57 # vim: set shiftwidth=4 softtabstop=4 expandtab: