# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- # # This file is part of the LibreOffice project. # # 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 uitest.uihelper.common import get_state_as_dict from libreoffice.uno.propertyvalue import mkPropertyValues #test comments
class Comments(UITestCase):
def test_comments_features(self):
with self.ui_test.create_doc_in_start_center("writer"):
# adding new Comment
self.xUITest.executeCommand(".uno:InsertAnnotation")
# wait until the comment is available
xComment1 = self.ui_test.wait_until_child_is_available('Comment1')
xEditView1 = xComment1.getChild("editview")
xEditView1.executeAction("TYPE", mkPropertyValues({"TEXT": "This is the First Comment"}))
self.assertEqual(get_state_as_dict(xComment1)["Text"], "This is the First Comment" )
self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "false" )
self.assertEqual(get_state_as_dict(xComment1)["Author"], "Unknown Author" )
self.assertEqual(get_state_as_dict(xComment1)["ReadOnly"], "false" )
# test Resolve Comment
xComment1.executeAction("RESOLVE", mkPropertyValues({}))
self.assertEqual(get_state_as_dict(xComment1)["Resolved"], "true" )
# test Select text from Comment
xComment1.executeAction("SELECT", mkPropertyValues({"FROM": "0", "TO": "4"}))
self.assertEqual(get_state_as_dict(xComment1)["SelectedText"], "This" )
# test Hide then Show Comment
xComment1.executeAction("HIDE", mkPropertyValues({}))
self.assertEqual(get_state_as_dict(xComment1)["Visible"], "false" )
xComment1.executeAction("SHOW", mkPropertyValues({}))
self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
# test delete Comment
xComment1.executeAction("DELETE", mkPropertyValues({}))
self.assertTrue("Comment1"notin xMainWindow.getChildren())
def test_multi_comments(self):
with self.ui_test.create_doc_in_start_center("writer"):
# Check that they all are Visible
self.assertEqual(get_state_as_dict(xComment1)["Visible"], "true" )
self.assertEqual(get_state_as_dict(xComment2)["Visible"], "true" )
self.assertEqual(get_state_as_dict(xComment3)["Visible"], "true" )
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.