summaryrefslogtreecommitdiff
path: root/sc/qa/uitest
diff options
context:
space:
mode:
authorAhmed ElShreif <aelshreif7@gmail.com>2020-06-24 18:59:32 +0200
committerAhmed ElShreif <aelshreif7@gmail.com>2020-07-08 16:47:39 +0200
commita480b32fb7a381fc17d51c2ccd0e8c4455d38792 (patch)
tree0ed8bc3ea843c328a8665880b0520f949b5fe921 /sc/qa/uitest
parente1690504c27081ff5b212f20a80468a1c703c09a (diff)
uitest : Add demo for Calc-comments
This patch test the support that added to this patch: https://gerrit.libreoffice.org/c/core/+/96837 Change-Id: If7444813f65bd90d62d0eb3504dcfc588c3f4e32 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97074 Tested-by: Jenkins Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc/qa/uitest')
-rw-r--r--sc/qa/uitest/calc_tests/Comments.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests/Comments.py b/sc/qa/uitest/calc_tests/Comments.py
new file mode 100644
index 000000000000..52d1f2a1d666
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/Comments.py
@@ -0,0 +1,49 @@
+# -*- 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 uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.debug import sleep
+
+class Comments(UITestCase):
+ def test_comment(self):
+ calc_doc = self.ui_test.create_doc_in_start_center("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ # Select Cell D8
+ gridwin.executeAction("SELECT", mkPropertyValues({"TABLE": "0"}))
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D8"}))
+
+ # Create comment and open it's window
+ gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""}))
+
+ # Write text in the Comment Window
+ gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "First Comment"}))
+
+ # Close Comment Window
+ gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""}))
+
+ # Check on the comment text
+ self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "First Comment")
+
+ # Check on comment in another cell
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+ gridwin.executeAction("COMMENT", mkPropertyValues({"OPEN": ""}))
+ gridwin.executeAction("TYPE", mkPropertyValues({"TEXT": "Second Comment"}))
+ gridwin.executeAction("COMMENT", mkPropertyValues({"CLOSE":""}))
+ self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Second Comment")
+
+ # Write Comment without opening Comment window
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B5"}))
+ gridwin.executeAction("COMMENT", mkPropertyValues({"SETTEXT": "Third Comment"}))
+ self.assertEqual(get_state_as_dict(gridwin)["CurrentCellCommentText"], "Third Comment")
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: \ No newline at end of file