summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-02-12 12:09:28 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-02-12 15:57:14 +0100
commit86b192965ee8d625092b723337f6a65bdf34dcb7 (patch)
treee2da6b1282994856334a5845eef98ba6ba581411 /sc
parentccec133b9021b07d16cdec6b6ad860e0a62648af (diff)
tdf#107097: sc: Add UItest
Change-Id: Ia517095e230fd4b8395ffacac6e10347aade78aa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110814 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/chart/tdf107097.py65
-rw-r--r--sc/qa/uitest/data/tdf107097.odsbin0 -> 17945 bytes
2 files changed, 65 insertions, 0 deletions
diff --git a/sc/qa/uitest/chart/tdf107097.py b/sc/qa/uitest/chart/tdf107097.py
new file mode 100644
index 000000000000..bbf697c5cd88
--- /dev/null
+++ b/sc/qa/uitest/chart/tdf107097.py
@@ -0,0 +1,65 @@
+# -*- 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 libreoffice.calc.document import get_cell_by_position
+from libreoffice.uno.propertyvalue import mkPropertyValues
+from uitest.uihelper.common import get_url_for_data_file
+
+# Test pivot chart is pasted correctly to a new document
+
+class tdf107097(UITestCase):
+
+ def test_tdf107097(self):
+ calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf107097.ods"))
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ document = self.ui_test.get_component()
+
+ xFirstMatrix = []
+ for row in range(6, 18):
+ xRow = []
+ for column in range(3, 7):
+ xRow.append(get_cell_by_position(document, 1, column, row).getValue())
+ xFirstMatrix.append(xRow)
+
+ gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+
+ 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
+
+ xSecondMatrix = []
+ for row in xData.Data:
+ xRow = []
+ for value in row:
+ xRow.append(value)
+ xSecondMatrix.append(xRow)
+
+ self.assertEqual(xFirstMatrix, xSecondMatrix)
+
+ aExpectedColumnDescriptions = ('Sum - Sales T1', 'Sum - Sales T2',
+ 'Sum - Sales T3', 'Sum - Sales T4')
+ aExpectedRowDescriptions = ('DE Berlin A', 'DE Berlin B', 'DE Munich A',
+ 'DE Munich B', 'EN Glasgow A', 'EN Liverpool B', 'EN London A',
+ 'EN London B', 'FR Nantes A', 'FR Nantes B', 'FR Paris A', 'FR Paris B')
+
+ self.assertEqual(aExpectedColumnDescriptions, xData.ColumnDescriptions)
+ self.assertEqual(aExpectedRowDescriptions, xData.RowDescriptions)
+
+ self.ui_test.close_doc()
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab:
diff --git a/sc/qa/uitest/data/tdf107097.ods b/sc/qa/uitest/data/tdf107097.ods
new file mode 100644
index 000000000000..efa9f1c013f3
--- /dev/null
+++ b/sc/qa/uitest/data/tdf107097.ods
Binary files differ