Kaydet (Commit) b448f3cb authored tarafından Zdeněk Crhonek's avatar Zdeněk Crhonek Kaydeden (comit) Markus Mohrhard

uitest for bug tdf#113284

Change-Id: If4e9875344da2525b5f7bdb658ad0096d923ead7
Reviewed-on: https://gerrit.libreoffice.org/51285Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst caeb7930
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from uitest.framework import UITestCase
from libreoffice.uno.propertyvalue import mkPropertyValues
from uitest.uihelper.common import get_state_as_dict
import time
from uitest.path import get_srcdir_url
from uitest.debug import sleep
def get_url_for_data_file(file_name):
return get_srcdir_url() + "/sw/qa/uitest/writer_tests/data/" + file_name
class tdf113284(UITestCase):
def test_tdf113284(self):
writer_doc = self.ui_test.load_file(get_url_for_data_file("tdf113284.odt"))
document = self.ui_test.get_component()
xWriterDoc = self.xUITest.getTopFocusWindow()
xWriterEdit = xWriterDoc.getChild("writer_edit")
sleep(2) #we need this sleep,because without this is pagecount counted without index. Load index takes time probably.
xPageCount = document.CurrentController.PageCount
self.ui_test.execute_dialog_through_command(".uno:GotoPage")
xDialog = self.xUITest.getTopFocusWindow()
xPageText = xDialog.getChild("page")
xPageText.executeAction("TYPE", mkPropertyValues({"TEXT":str(xPageCount)})) # goto last page
xOkBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOkBtn)
self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], str(xPageCount))
self.ui_test.execute_dialog_through_command(".uno:EditCurIndex") #open index dialog
xDiagIndex = self.xUITest.getTopFocusWindow()
xCancBtn = xDiagIndex.getChild("cancel")
self.ui_test.close_dialog_through_button(xCancBtn) # close dialog
#page count is not constant
#self.assertEqual(get_state_as_dict(xWriterEdit)["CurrentPage"], "66") #page 66 start of the Index
#pagecount unchanged
self.assertEqual(document.CurrentController.PageCount, xPageCount)
self.ui_test.close_doc()
# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment