summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorZdeněk Crhonek <zcrhonek@gmail.com>2018-03-12 23:10:59 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2018-03-18 11:05:51 +0100
commit826d9839e0f24631b330737b86fa520d7d8c5dd1 (patch)
treebc8e49e72c59cc68f7522337ba72c480e24e4848 /sc
parent4b0cfc9f5b82a11897446cd81f04a0653cc2a1d7 (diff)
uitest for bug tdf#65856
Change-Id: I494be1801bcecff42a00208880b533f0bc4ee874 Reviewed-on: https://gerrit.libreoffice.org/51178 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/calc_tests/data/tdf65856.odsbin0 -> 10520 bytes
-rw-r--r--sc/qa/uitest/calc_tests/data/tdf65856_2.odsbin0 -> 6720 bytes
-rw-r--r--sc/qa/uitest/calc_tests/tdf65856.py104
3 files changed, 104 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests/data/tdf65856.ods b/sc/qa/uitest/calc_tests/data/tdf65856.ods
new file mode 100644
index 000000000000..c3c27c710445
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/data/tdf65856.ods
Binary files differ
diff --git a/sc/qa/uitest/calc_tests/data/tdf65856_2.ods b/sc/qa/uitest/calc_tests/data/tdf65856_2.ods
new file mode 100644
index 000000000000..4a0fe0ff4147
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/data/tdf65856_2.ods
Binary files differ
diff --git a/sc/qa/uitest/calc_tests/tdf65856.py b/sc/qa/uitest/calc_tests/tdf65856.py
new file mode 100644
index 000000000000..3c4432951574
--- /dev/null
+++ b/sc/qa/uitest/calc_tests/tdf65856.py
@@ -0,0 +1,104 @@
+# -*- 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
+import os
+from uitest.uihelper.common import get_state_as_dict
+from uitest.path import get_srcdir_url
+from libreoffice.calc.document import get_sheet_from_doc
+from libreoffice.calc.conditional_format import get_conditional_format_from_sheet
+from uitest.debug import sleep
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from libreoffice.calc.document import get_cell_by_position
+
+def get_url_for_data_file(file_name):
+ return get_srcdir_url() + "/sc/qa/uitest/calc_tests/data/" + file_name
+
+class tdf65856(UITestCase):
+
+ def test_tdf65856_paste_special_shift_right(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #- mark D1:E14; copy
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "D1:E14"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ #mark cell D1
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "D1"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xmove_right = xDialog.getChild("move_right")
+ xmove_right.executeAction("CLICK", tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ #check
+ self.assertEqual(get_cell_by_position(document, 0, 0, 0).getString(), "T1")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 0).getString(), "TE1")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 0).getString(), "TES1")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 0).getString(), "TEST1")
+ self.assertEqual(get_cell_by_position(document, 0, 0, 13).getString(), "T14")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 13).getString(), "TE14")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 13).getString(), "TES14")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 13).getString(), "TEST14")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 13).getString(), "TEST14")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 13).getString(), "TEST14")
+ self.assertEqual(get_cell_by_position(document, 0, 6, 13).getString(), "TEST14")
+ self.ui_test.close_doc()
+
+ def test_tdf65856_paste_special_shift_right_2(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf65856_2.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ #- select range C2:D4; copy
+ gridwin.executeAction("SELECT", mkPropertyValues({"RANGE": "C2:D4"}))
+ self.xUITest.executeCommand(".uno:Copy")
+ #mark cell B2
+ gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "B2"}))
+ self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
+ xDialog = self.xUITest.getTopFocusWindow()
+
+ xmove_right = xDialog.getChild("move_right")
+ xmove_right.executeAction("CLICK", tuple())
+
+ xOkBtn = xDialog.getChild("ok")
+ self.ui_test.close_dialog_through_button(xOkBtn)
+
+ #check
+ self.assertEqual(get_cell_by_position(document, 0, 1, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getString(), "1")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getString(), "2")
+ self.assertEqual(get_cell_by_position(document, 0, 1, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 2, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 3).getString(), "3")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 1).getFormula(), "=D2")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 1).getFormula(), "=D2")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 2).getFormula(), "=E3")
+ self.assertEqual(get_cell_by_position(document, 0, 5, 2).getFormula(), "=E3")
+ self.assertEqual(get_cell_by_position(document, 0, 3, 3).getFormula(), "=F4")
+ self.assertEqual(get_cell_by_position(document, 0, 4, 3).getFormula(), "=F4")
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
+