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
12 from uitest
.uihelper
.common
import get_state_as_dict
, get_url_for_data_file
14 class tdf113284(UITestCase
):
16 def test_tdf113284(self
):
17 with self
.ui_test
.load_file(get_url_for_data_file("tdf113284.odt")) as writer_doc
:
18 xWriterDoc
= self
.xUITest
.getTopFocusWindow()
19 xWriterEdit
= xWriterDoc
.getChild("writer_edit")
21 xToolkit
= self
.xContext
.ServiceManager
.createInstance('com.sun.star.awt.Toolkit')
22 xToolkit
.processEventsToIdle()
24 xPageCount
= writer_doc
.CurrentController
.PageCount
25 with self
.ui_test
.execute_dialog_through_command(".uno:GotoPage") as xDialog
:
26 xPageText
= xDialog
.getChild("page")
27 xPageText
.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount
)})) # goto last page
29 xToolkit
.processEventsToIdle()
31 self
.assertEqual(get_state_as_dict(xWriterEdit
)["CurrentPage"], str(xPageCount
))
32 with self
.ui_test
.execute_dialog_through_command(".uno:EditCurIndex", close_button
="cancel"):
35 #page count is not constant
36 #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
38 self
.assertEqual(writer_doc
.CurrentController
.PageCount
, xPageCount
)
40 # vim: set shiftwidth=4 softtabstop=4 expandtab: