sc/qa/uitest/chart/tdf136011.py | 57 ++++++++++++++++++++++++++++++++++++++++ sc/qa/uitest/data/tdf136011.ods |binary 2 files changed, 57 insertions(+)
New commits: commit 14b135ca0434fda09966acf6fd14fab600bfde49 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Thu Feb 11 22:27:33 2021 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Fri Feb 12 00:42:03 2021 +0100 tdf#136011: sc: Add UItest Change-Id: I2fb168a2f7147f97602ddabee6100e53fd7249cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110795 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> 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 Binary files /dev/null and b/sc/qa/uitest/data/tdf136011.ods differ _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits