summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-02-11 22:27:33 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-02-12 00:42:03 +0100
commit14b135ca0434fda09966acf6fd14fab600bfde49 (patch)
tree0cca61a2bab86a263dfc07dc4bc2116fd9c70fce /sc
parent9a97943aaebf931fd17e4fa18a41926dc5d1e7e3 (diff)
tdf#136011: sc: Add UItest
Change-Id: I2fb168a2f7147f97602ddabee6100e53fd7249cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110795 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/chart/tdf136011.py57
-rw-r--r--sc/qa/uitest/data/tdf136011.odsbin0 -> 23559 bytes
2 files changed, 57 insertions, 0 deletions
diff --git a/sc/qa/uitest/chart/tdf136011.py b/sc/qa/uitest/chart/tdf136011.py
new file mode 100644
index 000000000000..5a8074f3975d
--- /dev/null
+++ b/sc/qa/uitest/chart/tdf136011.py
@@ -0,0 +1,57 @@
+# -*- 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.calc import enter_text_to_cell
+from libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_url_for_data_file
+
+class tdf136011(UITestCase):
+
+ def test_tdf136011(self):
+
+ xObjectNames = ['Object 1', 'Object 2']
+ xCategories = ['Test 1', 'Test 2', 'Test 3']
+ xSubCategories = [['A', 'B', 'C'], ['1', '2', '3']]
+ xColumnNames = ['A', 'B', 'C']
+
+ # Test both charts
+ for i, name in enumerate(xObjectNames):
+
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf136011.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ xExpectedResults = []
+ for category in xCategories:
+ for subCategory in xSubCategories[i]:
+ xExpectedResults.append(category + ' ' + subCategory)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": name}))
+
+ self.xUITest.executeCommand(".uno:Copy")
+
+ self.ui_test.close_doc()
+
+ self.ui_test.load_empty_file("calc")
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+ document = self.ui_test.get_component()
+
+ self.xUITest.executeCommand(".uno:Paste")
+
+ xData = document.Sheets[0].Charts[0].getEmbeddedObject().Data
+
+ self.assertEqual(xColumnNames, list(xData.ColumnDescriptions))
+
+ # Without the fix in place, the numbers in the categories in chart
+ # 'Object 2' wouldn't have been pasted to the new document
+ self.assertEqual(xExpectedResults, list(xData.RowDescriptions))
+
+ self.ui_test.close_doc()
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf136011.ods b/sc/qa/uitest/data/tdf136011.ods
new file mode 100644
index 000000000000..03a0a7dd6324
--- /dev/null
+++ b/sc/qa/uitest/data/tdf136011.ods
Binary files differ