summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest
diff options
context:
space:
mode:
Diffstat (limited to 'sc/qa/uitest')
-rw-r--r--sc/qa/uitest/autofilter2/tdf159420.py126
-rw-r--r--sc/qa/uitest/data/tdf129701.odsbin0 -> 23138 bytes
-rw-r--r--sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py70
3 files changed, 196 insertions, 0 deletions
diff --git a/sc/qa/uitest/autofilter2/tdf159420.py b/sc/qa/uitest/autofilter2/tdf159420.py
new file mode 100644
index 0000000000..87ee159d22
--- /dev/null
+++ b/sc/qa/uitest/autofilter2/tdf159420.py
@@ -0,0 +1,126 @@
+# -*- 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.calc import enter_text_to_cell
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import is_row_hidden
+
+class tdf159420(UITestCase):
+
+ def testTdf159420(self):
+ with self.ui_test.create_doc_in_start_center("calc") as calcDoc:
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ xGridWin = xCalcDoc.getChild("grid_window")
+
+ # Fill the sheet with test data
+ enter_text_to_cell(xGridWin, "A1", "a")
+ enter_text_to_cell(xGridWin, "A2", "2")
+ enter_text_to_cell(xGridWin, "A3", "2")
+ enter_text_to_cell(xGridWin, "A4", "2")
+ enter_text_to_cell(xGridWin, "A5", "4")
+
+ enter_text_to_cell(xGridWin, "B1", "b")
+ enter_text_to_cell(xGridWin, "B2", "")
+ enter_text_to_cell(xGridWin, "B3", "")
+ enter_text_to_cell(xGridWin, "B4", "8")
+ enter_text_to_cell(xGridWin, "B5", "8")
+
+ enter_text_to_cell(xGridWin, "C1", "c")
+
+ # Select the data range and set autofilter
+ xGridWin.executeAction("SELECT", mkPropertyValues({"RANGE": "A1:C5"}))
+ self.xUITest.executeCommand(".uno:DataFilterAutoFilter")
+
+ # Click the autofilter dropdown in column A
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "0", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+
+ self.assertEqual(2, len(xTreeList.getChildren()))
+
+ xEntry1 = xTreeList.getChild(0)
+ self.assertEqual("2", get_state_as_dict(xEntry1)['Text'])
+ self.assertEqual("true", get_state_as_dict(xEntry1)['IsChecked'])
+ self.assertEqual("false", get_state_as_dict(xEntry1)['IsSemiTransparent'])
+
+ xEntry2 = xTreeList.getChild(1)
+ self.assertEqual("4", get_state_as_dict(xEntry2)['Text'])
+ self.assertEqual("true", get_state_as_dict(xEntry2)['IsChecked'])
+ self.assertEqual("false", get_state_as_dict(xEntry2)['IsSemiTransparent'])
+
+ # Uncheck the second entry
+ xEntry2.executeAction("CLICK", tuple())
+
+ xOkButton = xFloatWindow.getChild("ok")
+ xOkButton.executeAction("CLICK", tuple())
+
+ # Check that only row#2 is visible
+ self.assertFalse(is_row_hidden(calcDoc, 1))
+ self.assertFalse(is_row_hidden(calcDoc, 2))
+ self.assertFalse(is_row_hidden(calcDoc, 3))
+ self.assertTrue(is_row_hidden(calcDoc, 4))
+
+ # Click the autofilter dropdown in column B
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "1", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+
+ self.assertEqual(2, len(xTreeList.getChildren()))
+
+ xEntry1 = xTreeList.getChild(0)
+ self.assertEqual("(empty)", get_state_as_dict(xEntry1)['Text'])
+ self.assertEqual("true", get_state_as_dict(xEntry1)['IsChecked'])
+ self.assertEqual("false", get_state_as_dict(xEntry1)['IsSemiTransparent'])
+
+ xEntry2 = xTreeList.getChild(1)
+ self.assertEqual("8", get_state_as_dict(xEntry2)['Text'])
+ self.assertEqual("true", get_state_as_dict(xEntry2)['IsChecked'])
+ self.assertEqual("false", get_state_as_dict(xEntry2)['IsSemiTransparent'])
+
+ # Uncheck the first entry
+ xEntry1.executeAction("CLICK", tuple())
+
+ # Close the popup window
+ xOkButton = xFloatWindow.getChild("ok")
+ xOkButton.executeAction("CLICK", tuple())
+
+ self.assertTrue(is_row_hidden(calcDoc, 1))
+ self.assertTrue(is_row_hidden(calcDoc, 2))
+ self.assertFalse(is_row_hidden(calcDoc, 3))
+ self.assertTrue(is_row_hidden(calcDoc, 4))
+
+ # Click the autofilter dropdown in column C
+ xGridWin.executeAction("LAUNCH", mkPropertyValues({"AUTOFILTER": "", "COL": "2", "ROW": "0"}))
+ xFloatWindow = self.xUITest.getFloatWindow()
+ xCheckListMenu = xFloatWindow.getChild("FilterDropDown")
+ xTreeList = xCheckListMenu.getChild("check_list_box")
+
+ self.assertEqual(1, len(xTreeList.getChildren()))
+
+ xEntry1 = xTreeList.getChild(0)
+ self.assertEqual("(empty)", get_state_as_dict(xEntry1)['Text'])
+
+ # Without the fix in place, this test would have failed with
+ # AssertionError: 'true' != 'false'
+ self.assertEqual("true", get_state_as_dict(xEntry1)['IsChecked'])
+ self.assertEqual("false", get_state_as_dict(xEntry1)['IsSemiTransparent'])
+
+ # Close the popup window
+ xOkButton = xFloatWindow.getChild("ok")
+ xOkButton.executeAction("CLICK", tuple())
+
+ self.assertTrue(is_row_hidden(calcDoc, 1))
+ self.assertTrue(is_row_hidden(calcDoc, 2))
+ self.assertFalse(is_row_hidden(calcDoc, 3))
+ self.assertTrue(is_row_hidden(calcDoc, 4))
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf129701.ods b/sc/qa/uitest/data/tdf129701.ods
new file mode 100644
index 0000000000..94407fcd56
--- /dev/null
+++ b/sc/qa/uitest/data/tdf129701.ods
Binary files differ
diff --git a/sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py b/sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py
new file mode 100644
index 0000000000..596cd62f8b
--- /dev/null
+++ b/sc/qa/uitest/pasteSpecial/tdf129701-PasteUnformated.py
@@ -0,0 +1,70 @@
+# -*- 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 libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_url_for_data_file
+from uitest.uihelper.common import get_state_as_dict
+from libreoffice.calc.document import get_cell_by_position
+
+class tdf129701(UITestCase):
+
+ def test_tdf129701(self):
+
+ with self.ui_test.load_file(get_url_for_data_file("tdf129701.ods")):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D21:F25"}))
+ self.xUITest.executeCommand(".uno:Copy")
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "J4"}))
+ with self.ui_test.execute_dialog_through_command(".uno:PasteUnformatted", close_button="ok") as xDialog:
+
+ xSkipEmtyCells = xDialog.getChild("skipemptycells")
+ xSeparatedBy = xDialog.getChild("toseparatedby")
+ xTab = xDialog.getChild("tab")
+ xMergeDelimiters = xDialog.getChild("mergedelimiters")
+
+ xSeparatedBy.executeAction("CLICK", tuple())
+ if get_state_as_dict(xTab)['Selected'] == 'false':
+ xTab.executeAction("CLICK", tuple())
+ if get_state_as_dict(xMergeDelimiters)['Selected'] == 'true':
+ xMergeDelimiters.executeAction("CLICK", tuple())
+ if get_state_as_dict(xSkipEmtyCells)['Selected'] == 'true':
+ xSkipEmtyCells.executeAction("CLICK", tuple())
+ # Check wether Skip empty cells is unselected
+ self.assertEqual('false', get_state_as_dict(xSkipEmtyCells)['Selected'])
+
+ document = self.ui_test.get_component()
+ # Without the fix in place, this test would have failed with
+ # non empty cells in column 11
+
+ self.assertEqual( "x1", get_cell_by_position(document, 0, 9, 3).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0,10, 3).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0,11, 3).getString())
+ self.assertEqual("A16", get_cell_by_position(document, 0,12, 3).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0, 9, 4).getString())
+ self.assertEqual( "x2", get_cell_by_position(document, 0,10, 4).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0,11, 4).getString())
+ self.assertEqual("A17", get_cell_by_position(document, 0,12, 4).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0, 9, 5).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0,10, 5).getString())
+ self.assertEqual( "x3", get_cell_by_position(document, 0,11, 5).getString())
+ self.assertEqual("A18", get_cell_by_position(document, 0,12, 5).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0, 9, 6).getString())
+ self.assertEqual( "x4", get_cell_by_position(document, 0,10, 6).getString())
+ self.assertEqual( "" , get_cell_by_position(document, 0,11, 6).getString())
+ self.assertEqual("A19", get_cell_by_position(document, 0,12, 6).getString())
+ self.assertEqual( "x5", get_cell_by_position(document, 0, 9, 7).getString())
+ self.assertEqual( "x6", get_cell_by_position(document, 0,10, 7).getString())
+ self.assertEqual( "x7", get_cell_by_position(document, 0,11, 7).getString())
+ self.assertEqual("A20", get_cell_by_position(document, 0,12, 7).getString())
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: