summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdeněk Crhonek <zcrhonek@gmail.com>2017-12-30 11:03:53 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-01-27 20:34:55 +0100
commit498deef48de6605193268fb8328fec1053c4ed3c (patch)
tree5b17f7b485d0f29ec96e21863db77f9143731092
parentde9bcd167b059e00818304626c0cadaa330738a4 (diff)
uitest for tdf#81351
Change-Id: Ieb9ea4d7c1ed9a65396046ea388bf9f6c3975a83 Reviewed-on: https://gerrit.libreoffice.org/47190 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--sc/Module_sc.mk1
-rw-r--r--sc/UITest_calc_tests.mk15
-rw-r--r--sc/qa/uitest/calc_tests/data/tdf81351.odsbin0 -> 23737 bytes
-rw-r--r--sc/qa/uitest/calc_tests/tdf81351.py81
4 files changed, 97 insertions, 0 deletions
diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk
index 9015f886187f..ca37c6413780 100644
--- a/sc/Module_sc.mk
+++ b/sc/Module_sc.mk
@@ -176,6 +176,7 @@ $(eval $(call gb_Module_add_uicheck_targets,sc,\
UITest_hide_cols \
UITest_autofilter \
UITest_search_replace \
+ UITest_calc_tests \
))
endif
diff --git a/sc/UITest_calc_tests.mk b/sc/UITest_calc_tests.mk
new file mode 100644
index 000000000000..c9a4e5c3f44b
--- /dev/null
+++ b/sc/UITest_calc_tests.mk
@@ -0,0 +1,15 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
+$(eval $(call gb_UITest_UITest,calc_tests))
+
+$(eval $(call gb_UITest_add_modules,calc_tests,$(SRCDIR)/sc/qa/uitest,\
+ calc_tests/ \
+))
+# vim: set noet sw=4 ts=4:
diff --git a/sc/qa/uitest/calc_tests/data/tdf81351.ods b/sc/qa/uitest/calc_tests/data/tdf81351.ods
new file mode 100644
index 000000000000..7888ce008dc9
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/data/tdf81351.ods
Binary files differ
diff --git a/sc/qa/uitest/calc_tests/tdf81351.py b/sc/qa/uitest/calc_tests/tdf81351.py
new file mode 100644
index 000000000000..0886ab7b4b16
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/tdf81351.py
@@ -0,0 +1,81 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+
+from uitest.framework import UITestCase
+from libreoffice.calc.document import get_column
+from uitest.path import get_srcdir_url
+from libreoffice.calc.document import get_cell_by_position
+import time
+
+def get_url_for_data_file(file_name):
+ return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name
+
+class tdf81351(UITestCase):
+
+ def test_tdf81351(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods"))
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+ gridwin = xTopWindow.getChild("grid_window")
+
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"}))
+
+ self.xUITest.executeCommand(".uno:SortAscending")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"}))
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold")
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"}))
+
+ def test_tdf81351_comment4(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods"))
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+
+ gridwin = xTopWindow.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"}))
+
+
+ self.xUITest.executeCommand(".uno:SortAscending")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"}))
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste")
+
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Bold")
+
+ def test_sort_descending(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf81351.ods"))
+ xTopWindow = self.xUITest.getTopFocusWindow()
+ document = self.ui_test.get_component()
+
+ gridwin = xTopWindow.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:F5"}))
+
+ self.xUITest.executeCommand(".uno:SortDescending")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Undo")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B7"}))
+
+ self.xUITest.executeCommand(".uno:Undo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Paste")
+
+ self.xUITest.executeCommand(".uno:Redo")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 1).getString(), ".uno:Undo")
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab: