sc/qa/uitest/chart/tdf107097.py |   65 ++++++++++++++++++++++++++++++++++++++++
 sc/qa/uitest/data/tdf107097.ods |binary
 2 files changed, 65 insertions(+)

New commits:
commit 86b192965ee8d625092b723337f6a65bdf34dcb7
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Fri Feb 12 12:09:28 2021 +0100
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Fri Feb 12 15:57:14 2021 +0100

    tdf#107097: sc: Add UItest
    
    Change-Id: Ia517095e230fd4b8395ffacac6e10347aade78aa
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110814
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>

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
Binary files /dev/null and b/sc/qa/uitest/data/tdf107097.ods differ
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to