sc/Module_sc.mk                           |    1 
 sc/UITest_calc_tests.mk                   |   15 +++++
 sc/qa/uitest/calc_tests/data/tdf81351.ods |binary
 sc/qa/uitest/calc_tests/tdf81351.py       |   81 ++++++++++++++++++++++++++++++
 4 files changed, 97 insertions(+)

New commits:
commit 498deef48de6605193268fb8328fec1053c4ed3c
Author: Zdeněk Crhonek <zcrho...@gmail.com>
Date:   Sat Dec 30 11:03:53 2017 +0100

    uitest for tdf#81351
    
    Change-Id: Ieb9ea4d7c1ed9a65396046ea388bf9f6c3975a83
    Reviewed-on: https://gerrit.libreoffice.org/47190
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com>

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
Binary files /dev/null and b/sc/qa/uitest/calc_tests/data/tdf81351.ods 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:
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to