Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sw / qa / uitest / writer_tests / tdf113284.py
blob11c867ecea140fa9a1c8b1027c13429c22eb45d1
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 from uitest.framework import UITestCase
7 from libreoffice.uno.propertyvalue import mkPropertyValues
8 from uitest.uihelper.common import get_state_as_dict
9 import org.libreoffice.unotest
10 import pathlib
11 import time
12 from uitest.debug import sleep
14 def get_url_for_data_file(file_name):
15 return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
17 class tdf113284(UITestCase):
19 def test_tdf113284(self):
20 writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf113284.odt"))
21 document = self.ui_test.get_component()
22 xWriterDoc = self.xUITest.getTopFocusWindow()
23 xWriterEdit = xWriterDoc.getChild("writer_edit")
25 sleep(2) #we need this sleep,because without this is pagecount counted without index. Load index takes time probably.
26 xPageCount = document.CurrentController.PageCount
27 self.ui_test.execute_dialog_through_command(".uno:GotoPage")
28 xDialog = self.xUITest.getTopFocusWindow()
29 xPageText = xDialog.getChild("page")
30 xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
31 xOkBtn = xDialog.getChild("ok")
32 self.ui_test.close_dialog_through_button(xOkBtn)
34 self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
35 self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
36 xDiagIndex = self.xUITest.getTopFocusWindow()
37 xCancBtn = xDiagIndex.getChild("cancel")
38 self.ui_test.close_dialog_through_button(xCancBtn) # close dialog
40 #page count is not constant
41 #self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
42 #pagecount unchanged
43 self.assertEqual(document.CurrentController.PageCount, xPageCount)
45 self.ui_test.close_doc()
46 # vim: set shiftwidth=4 softtabstop=4 expandtab: