[Libreoffice-commits] core.git: sc/qa

Zdeněk Crhonek zcrhonek at gmail.com
Tue May 22 14:18:44 UTC 2018


 sc/qa/uitest/calc_tests/data/tdf89958.ods |binary
 sc/qa/uitest/calc_tests/tdf89958.py       |   71 ++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

New commits:
commit 3a45af979605e2a1103304b0b52d328d39851fba
Author: Zdeněk Crhonek <zcrhonek at gmail.com>
Date:   Mon May 21 16:08:27 2018 +0200

    uitest for bug tdf89958
    
    Change-Id: I174c4c641d992e78056003fc8f4b9a24ea1c1b93
    Reviewed-on: https://gerrit.libreoffice.org/54639
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Zdenek Crhonek <zcrhonek at gmail.com>

diff --git a/sc/qa/uitest/calc_tests/data/tdf89958.ods b/sc/qa/uitest/calc_tests/data/tdf89958.ods
new file mode 100644
index 000000000000..5a48917db0b7
Binary files /dev/null and b/sc/qa/uitest/calc_tests/data/tdf89958.ods differ
diff --git a/sc/qa/uitest/calc_tests/tdf89958.py b/sc/qa/uitest/calc_tests/tdf89958.py
new file mode 100644
index 000000000000..d08148fbd647
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/tdf89958.py
@@ -0,0 +1,71 @@
+# -*- 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 uitest.uihelper.common import select_pos
+from uitest.uihelper.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+import org.libreoffice.unotest
+import pathlib
+#Bug 89958 - Data->Filter->Standard Filter, condition "does not end with" does filter too much
+def get_url_for_data_file(file_name):
+    return pathlib.Path(org.libreoffice.unotest.makeCopyFromTDOC(file_name)).as_uri()
+
+class tdf89958(UITestCase):
+    def test_td89958_standard_filter(self):
+        calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf89958.ods"))
+        xCalcDoc = self.xUITest.getTopFocusWindow()
+        gridwin = xCalcDoc.getChild("grid_window")
+        document = self.ui_test.get_component()
+        #select A1-> Column .uno:SelectColumn
+        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+        self.xUITest.executeCommand(".uno:SelectColumn")
+
+        #Menu: Data->Filter->Standard Filter ...
+        #Field Name "Column A", Condition "Does not end with", Value: "CTORS"
+        self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
+        xDialog = self.xUITest.getTopFocusWindow()
+        xfield1 = xDialog.getChild("field1")
+        xval1 = xDialog.getChild("val1")
+        xcond1 = xDialog.getChild("cond1")
+
+        props = {"TEXT": "Column A"}
+        actionProps = mkPropertyValues(props)
+        xfield1.executeAction("SELECT", actionProps)
+        props2 = {"TEXT": "Does not end with"}
+        actionProps2 = mkPropertyValues(props2)
+        xcond1.executeAction("SELECT", actionProps2)
+        xval1.executeAction("TYPE", mkPropertyValues({"TEXT":"CTORS"}))
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
+
+        #Expected behaviours: A2 is not filtered as it does not end with "CTORS".
+        gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A1"}))
+        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+        gridWinState = get_state_as_dict(gridwin)
+        self.assertEqual(gridWinState["CurrentRow"], "1")
+        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"}))
+        gridWinState = get_state_as_dict(gridwin)
+        self.assertEqual(gridWinState["CurrentRow"], "3")
+#        #reopen filter and verify - doesn't works
+#        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+#        gridwin.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+#        self.ui_test.execute_modeless_dialog_through_command(".uno:DataFilterStandardFilter")
+#        xDialog = self.xUITest.getTopFocusWindow()
+#        xfield1 = xDialog.getChild("field1")
+#        xval1 = xDialog.getChild("val1")
+#        xcond1 = xDialog.getChild("cond1")
+#        self.assertEqual(get_state_as_dict(xfield1)["SelectEntryText"], "Column A")
+#        self.assertEqual(get_state_as_dict(xval1)["Text"], "CTORS")
+#        self.assertEqual(get_state_as_dict(xcond1)["SelectEntryText"], "Does not end with")
+#        xCancelBtn = xDialog.getChild("cancel")
+#        self.ui_test.close_dialog_through_button(xCancelBtn)
+
+        self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
\ No newline at end of file


More information about the Libreoffice-commits mailing list