diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:06:44 +0000 |
commit | ed5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch) | |
tree | 7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/chart2 | |
parent | Initial commit. (diff) | |
download | libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip |
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sc/qa/uitest/chart2')
-rw-r--r-- | sc/qa/uitest/chart2/tdf101894.py | 67 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf107097.py | 61 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf120348.py | 61 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf122398.py | 87 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf123013.py | 52 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf123231.py | 65 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf123520.py | 62 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf124111.py | 53 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf124295.py | 32 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf129587.py | 56 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf131715.py | 28 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf133630.py | 61 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf134059.py | 64 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf136011.py | 51 | ||||
-rw-r--r-- | sc/qa/uitest/chart2/tdf142851.py | 34 |
15 files changed, 834 insertions, 0 deletions
diff --git a/sc/qa/uitest/chart2/tdf101894.py b/sc/qa/uitest/chart2/tdf101894.py new file mode 100644 index 000000000..1beca011c --- /dev/null +++ b/sc/qa/uitest/chart2/tdf101894.py @@ -0,0 +1,67 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf101894(UITestCase): + + def test_tdf101894(self): + with self.ui_test.load_file(get_url_for_data_file("tdf101894.ods")) as calc_doc: + xChart = calc_doc.Sheets[0].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + + self.assertEqual(4, len(xDataSeries)) + + xOldSheetRanges = [] + for i in range(4): + xRow = [] + xDS = xDataSeries[i].DataSequences + + self.assertEqual(2, len(xDS)) + xRow.append(xDS[0].Values.SourceRangeRepresentation) + xRow.append(xDS[1].Values.SourceRangeRepresentation) + xOldSheetRanges.append(xRow) + + # Rename the sheet first + with self.ui_test.execute_dialog_through_command(".uno:RenameTable") as xDialog: + xname_entry = xDialog.getChild("name_entry") + + oldName = get_state_as_dict(xname_entry)['Text'] + xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + xname_entry.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + xname_entry.executeAction("TYPE", mkPropertyValues({"TEXT":"NewName"})) + + # Copy sheet and use the old name + with self.ui_test.execute_dialog_through_command(".uno:Move") as xDialog: + newName = xDialog.getChild("newName") + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"})) + newName.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"})) + newName.executeAction("TYPE", mkPropertyValues({"TEXT": oldName})) + + xChart = calc_doc.Sheets[0].Charts[0] + xDataSeries = xChart.getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + + self.assertEqual(4, len(xDataSeries)) + + xNewSheetRanges = [] + for i in range(4): + xRow = [] + xDS = xDataSeries[i].DataSequences + + self.assertEqual(2, len(xDS)) + xRow.append(xDS[0].Values.SourceRangeRepresentation) + xRow.append(xDS[1].Values.SourceRangeRepresentation) + xNewSheetRanges.append(xRow) + + self.assertEqual(xOldSheetRanges, xNewSheetRanges) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf107097.py b/sc/qa/uitest/chart2/tdf107097.py new file mode 100644 index 000000000..53ba438ec --- /dev/null +++ b/sc/qa/uitest/chart2/tdf107097.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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): + with self.ui_test.load_file(get_url_for_data_file("tdf107097.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + + xFirstMatrix = [] + for row in range(6, 18): + xRow = [] + for column in range(3, 7): + xRow.append(get_cell_by_position(calc_doc, 1, column, row).getValue()) + xFirstMatrix.append(xRow) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Paste") + + xData = calc_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) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf120348.py b/sc/qa/uitest/chart2/tdf120348.py new file mode 100644 index 000000000..9f3a64837 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf120348.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_url_for_data_file + +from libreoffice.calc.document import get_cell_by_position +from libreoffice.uno.propertyvalue import mkPropertyValues + + +class tdf120348(UITestCase): + + def test_tdf120348(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf120348.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xFirstMatrix = [] + for row in range(1, 159): + xRow = [] + for column in range(5, 9): + xRow.append(round(get_cell_by_position(calc_doc, 0, column, row).getValue(), 5)) + xFirstMatrix.append(xRow) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 2"})) + + self.xUITest.executeCommand(".uno:Copy") + + with self.ui_test.load_empty_file("calc") as calc_document: + + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + self.xUITest.executeCommand(".uno:Paste") + + xData = calc_document.Sheets[0].Charts[0].getEmbeddedObject().Data + + columnNames = ('Finland', 'Sweden', 'Poland', '') + self.assertEqual(columnNames, xData.ColumnDescriptions) + + xSecondMatrix = [] + for row in xData.Data: + xRow = [] + for value in row: + xRow.append(round(value, 5)) + xSecondMatrix.append(xRow) + + # Without the fix in place, this test would have failed with + # First differing element 51: + # [3.31618, 3.65089, 3.33626, 0.0] + # [3.31618, 3.65089, 0.0, 0.0] + + self.assertEqual(xFirstMatrix, xSecondMatrix) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf122398.py b/sc/qa/uitest/chart2/tdf122398.py new file mode 100644 index 000000000..7f41c428f --- /dev/null +++ b/sc/qa/uitest/chart2/tdf122398.py @@ -0,0 +1,87 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 122398 - UI: Cannot specify min/max in axis scale or axis position. Limited between 0 and 100 +class tdf122398(UITestCase): + def test_tdf122398_chart_min_max_x_axis(self): + with self.ui_test.load_file(get_url_for_data_file("tdf122398.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #Open attached file. Set chart into edit mode. Select x-axis and then Format Selection. + #Disable the Automatic for min and max. You cannot change the values at all, neither with direct + #input nor with up-down arrow buttons. + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + autoMinimum.executeAction("CLICK", tuple()) + autoMaximum.executeAction("CLICK", tuple()) + majorInterval.executeAction("CLICK", tuple()) + minorInterval.executeAction("CLICK", tuple()) + #In a chart that contains an axis with a date datatype, the UI does not allow specifying + #a minimum or maximum value greater than 09/04/1900 (i.e., April 9, 1900) + minimum.executeAction("CLEAR", tuple()) + minimum.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) + maximum.executeAction("DOWN", tuple()) #29.04.2018 + major.executeAction("UP", tuple()) #21 + minor.executeAction("DOWN", tuple()) #1 + + #reopen and verify + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "Scale". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + autoMinimum = xDialog.getChild("CBX_AUTO_MIN") + autoMaximum = xDialog.getChild("CBX_AUTO_MAX") + majorInterval = xDialog.getChild("CBX_AUTO_STEP_MAIN") + minorInterval = xDialog.getChild("CBX_AUTO_STEP_HELP") + minimum = xDialog.getChild("EDT_MIN") + maximum = xDialog.getChild("EDT_MAX") + major = xDialog.getChild("EDT_STEP_MAIN") + minor = xDialog.getChild("MT_STEPHELP") + + self.assertEqual(get_state_as_dict(autoMinimum)["Selected"], "false") + self.assertEqual(get_state_as_dict(autoMaximum)["Selected"], "false") + self.assertEqual(get_state_as_dict(majorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minorInterval)["Selected"], "false") + self.assertEqual(get_state_as_dict(minimum)["Text"], "01.01.2018") + self.assertEqual(get_state_as_dict(maximum)["Text"], "29.04.2018") + self.assertEqual(get_state_as_dict(major)["Text"], "21") + self.assertEqual(get_state_as_dict(minor)["Text"], "1") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf123013.py b/sc/qa/uitest/chart2/tdf123013.py new file mode 100644 index 000000000..d7a0b32c8 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf123013.py @@ -0,0 +1,52 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 123013 - Can not change Trendline name in charts +class tdf123013(UITestCase): + def test_tdf96432_chart_trendline_name(self): + with self.ui_test.load_file(get_url_for_data_file("tdf123013.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + #add name + xentryname = xDialog.getChild("entry_name") + xentryname.executeAction("TYPE", mkPropertyValues({"TEXT":"Tline"})) + + #reopen and try again + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + #Right-click on the chart; from the pop-up menu select "Format Y bars + # The program presents dialog "Format Y bars", tab "Line". + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + #add name + xentryname = xDialog.getChild("entry_name") + self.assertEqual(get_state_as_dict(xentryname)["Text"], "Tline") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf123231.py b/sc/qa/uitest/chart2/tdf123231.py new file mode 100644 index 000000000..86c31f74f --- /dev/null +++ b/sc/qa/uitest/chart2/tdf123231.py @@ -0,0 +1,65 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 123231 - Chart set trendline format regression type Power twice +class tdf123231(UITestCase): + def test_tdf123231_chart_trendline_dialog_power(self): + with self.ui_test.load_file(get_url_for_data_file("tdf93506.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + #Change regression Type to Power + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + power = xDialog.getChild("exponential") #type regression power + + power.executeAction("CLICK", tuple()) #set power + + #reopen dialog and close dialog + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + power = xDialog.getChild("exponential") #type regression power + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + + #reopen and verify Power + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatTrendline"})) as xDialog: + #Click on tab "Type". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + power = xDialog.getChild("exponential") #type regression power + + self.assertEqual(get_state_as_dict(power)["Checked"], "true") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf123520.py b/sc/qa/uitest/chart2/tdf123520.py new file mode 100644 index 000000000..6854ef044 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf123520.py @@ -0,0 +1,62 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_by_text, select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 123520 - Y axis - positioning tab, textbox "Cross other axis at" date changed +class tdf123520(UITestCase): + def test_tdf123520_chart_y_cross_other_axis(self): + with self.ui_test.load_file(get_url_for_data_file("tdf123520.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + crossAxisValue.executeAction("CLEAR", tuple()) + crossAxisValue.executeAction("TYPE", mkPropertyValues({"TEXT":"01.01.2018"})) + #crossAxisValue.executeAction("TYPE", mkPropertyValues({"KEYCODE":"TAB"})) + #TAB doesn't works- add "a" at the end of textbox + #workaround - edit another ui item, it should trigger leave of textbox + select_by_text(placeLabels, "Outside start") + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisY"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + placeLabels = xDialog.getChild("LB_PLACE_LABELS") + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "01.01.2018") + self.assertEqual(get_state_as_dict(placeLabels)["SelectEntryText"], "Outside start") + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf124111.py b/sc/qa/uitest/chart2/tdf124111.py new file mode 100644 index 000000000..91fac95e0 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf124111.py @@ -0,0 +1,53 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +# Bug 124111 - Cannot enter negative number for cross other axis at value +class tdf124111(UITestCase): + def test_tdf124111_chart_x_negative_cross(self): + with self.ui_test.load_file(get_url_for_data_file("tdf124111.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + #Click on tab "positioning". + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + crossAxisValue.executeAction("DOWN", tuple()) #-1 + + #reopen and verify tab "positioning". + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + crossAxis = xDialog.getChild("LB_CROSSES_OTHER_AXIS_AT") + crossAxisValue = xDialog.getChild("EDT_CROSSES_OTHER_AXIS_AT") #only available when crossAxis = Value + + self.assertEqual(get_state_as_dict(crossAxis)["SelectEntryText"], "Value") + self.assertEqual(get_state_as_dict(crossAxisValue)["Text"], "-1") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf124295.py b/sc/qa/uitest/chart2/tdf124295.py new file mode 100644 index 000000000..0c64e0e23 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf124295.py @@ -0,0 +1,32 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict + + +class tdf124295(UITestCase): + + def test_tdf124295(self): + # Open spreadsheet and insert chart + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="cancel") as xChartDlg: + + # Click 3D look check button + x3DCheckBtn = xChartDlg.getChild("3dlook") + x3DCheckBtn.executeAction("CLICK", tuple()) + + x3DSchemeLstBox = xChartDlg.getChild("3dscheme") + # Without the fix in place, this test would have failed with: + # AssertionError: 'Realistic' != '' + self.assertEqual("Realistic", get_state_as_dict(x3DSchemeLstBox)["SelectEntryText"]) + + + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf129587.py b/sc/qa/uitest/chart2/tdf129587.py new file mode 100644 index 000000000..1fa06c889 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf129587.py @@ -0,0 +1,56 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict, get_url_for_data_file +from uitest.uihelper.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf129587(UITestCase): + def test_tdf129587(self): + + with self.ui_test.load_file(get_url_for_data_file("tdf129587.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual("$Tabelle1.$F$2:$G$11", xDataSeries[0].ErrorBarY.ErrorBarRangeNegative) + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + xSeriesObj = xChartMain.getChild("CID/MultiClick/D=0:CS=0:CT=0:Series=0:ErrorsY=") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatYErrorBars"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "0") + + xPerBtn = xDialog.getChild("RB_PERCENT") + xPerBtn.executeAction("CLICK", tuple()) + + xPosField = xDialog.getChild("MF_POSITIVE") + xNegField = xDialog.getChild("MF_NEGATIVE") + + self.assertEqual("0%", get_state_as_dict(xPosField)['Text']) + self.assertEqual("0%", get_state_as_dict(xNegField)['Text']) + + #Increase value by one + xPosField.executeAction("UP", tuple()) + + #Both fields are updated because 'Same value for both' is enabled + self.assertEqual("1%", get_state_as_dict(xPosField)['Text']) + self.assertEqual("1%", get_state_as_dict(xNegField)['Text']) + + + #Without the fix in place, it would have crashed here + xDataSeries = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertEqual(1.0, xDataSeries[0].ErrorBarY.PercentageError) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf131715.py b/sc/qa/uitest/chart2/tdf131715.py new file mode 100644 index 000000000..e001eaa7b --- /dev/null +++ b/sc/qa/uitest/chart2/tdf131715.py @@ -0,0 +1,28 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_state_as_dict +from uitest.uihelper.common import select_pos + +class tdf131715(UITestCase): + + def test_tdf131715(self): + with self.ui_test.create_doc_in_start_center("calc"): + with self.ui_test.execute_dialog_through_command(".uno:InsertObjectChart", close_button="finish") as xChartDlg: + + xWizard = xChartDlg.getChild('Wizard') + + for i in range(10): + #without the fix in place, it would crash here + select_pos(xWizard, "2") + + self.assertEqual(get_state_as_dict(xWizard)['CurrentStep'], "2") + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf133630.py b/sc/qa/uitest/chart2/tdf133630.py new file mode 100644 index 000000000..a632ba4fa --- /dev/null +++ b/sc/qa/uitest/chart2/tdf133630.py @@ -0,0 +1,61 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import select_pos, get_url_for_data_file +from uitest.uihelper.common import change_measurement_unit +from libreoffice.uno.propertyvalue import mkPropertyValues + +class tdf133630(UITestCase): + + def test_tdf133630(self): + + with self.ui_test.load_file(get_url_for_data_file("chartArea.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + change_measurement_unit(self, "Centimeter") + + xCS = calc_doc.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0] + self.assertEqual(0, xCS.getAxisByDimension(0, 0).LineWidth) + self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth) + + # First change the line width of one element + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:Axis=0,0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "DiagramAxisX"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "2") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xWidth.executeAction("UP", tuple()) + + + self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth) + self.assertEqual(80, xCS.ChartTypes[0].DataSeries[0].LineWidth) + + # Now change the line width of another element + xSeriesObj = xChartMain.getChild("CID/D=0:CS=0:CT=0:Series=0") + with self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataSeries"})) as xDialog: + + tabcontrol = xDialog.getChild("tabcontrol") + select_pos(tabcontrol, "1") + + xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH") + xWidth.executeAction("UP", tuple()) + + # Without the fix in place, this test would have crashed here + + self.assertEqual(100, xCS.getAxisByDimension(0, 0).LineWidth) + self.assertEqual(100, xCS.ChartTypes[0].DataSeries[0].LineWidth) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf134059.py b/sc/qa/uitest/chart2/tdf134059.py new file mode 100644 index 000000000..92be27ffa --- /dev/null +++ b/sc/qa/uitest/chart2/tdf134059.py @@ -0,0 +1,64 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import select_pos +from libreoffice.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file +from libreoffice.calc.document import get_row + +class Tdf134059(UITestCase): + + def assertSeriesNames(self, gridwin): + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + + xPage = xChartMain.getChild("CID/Page=") + + with self.ui_test.execute_dialog_through_action(xPage, "COMMAND", mkPropertyValues({"COMMAND": "DataRanges"})) as xDialog: + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + xSeries = xDialog.getChild("LB_SERIES") + self.assertEqual(3, len(xSeries.getChildren())) + self.assertEqual("Col. 1", get_state_as_dict(xSeries.getChild('0'))['Text']) + self.assertEqual("Col. 2", get_state_as_dict(xSeries.getChild('1'))['Text']) + self.assertEqual("Col. 3", get_state_as_dict(xSeries.getChild('2'))['Text']) + + + gridwin.executeAction("DESELECT", mkPropertyValues({"OBJECT": "Object 1"})) + + def test_tdf134059(self): + with self.ui_test.load_file(get_url_for_data_file("tdf134059.ods")) as calc_doc: + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + self.assertSeriesNames(gridwin) + + # Hide row 10 + gridwin.executeAction("SELECT", mkPropertyValues({"CELL": "A10"})) + self.ui_test._xUITest.executeCommand(".uno:HideRow") + + row = get_row(calc_doc, 9) + self.assertFalse(row.getPropertyValue("IsVisible")) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Col. 1' != 'Column C' + self.assertSeriesNames(gridwin) + + self.xUITest.executeCommand(".uno:Undo") + + self.assertTrue(row.getPropertyValue("IsVisible")) + + self.assertSeriesNames(gridwin) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf136011.py b/sc/qa/uitest/chart2/tdf136011.py new file mode 100644 index 000000000..a5ea560e5 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf136011.py @@ -0,0 +1,51 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.common import get_url_for_data_file + +from libreoffice.uno.propertyvalue import mkPropertyValues + + +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): + + with self.ui_test.load_file(get_url_for_data_file("tdf136011.ods")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + 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") + + with self.ui_test.load_empty_file("calc") as calc_document: + self.xUITest.executeCommand(".uno:Paste") + + xData = calc_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)) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: diff --git a/sc/qa/uitest/chart2/tdf142851.py b/sc/qa/uitest/chart2/tdf142851.py new file mode 100644 index 000000000..e48b9cf46 --- /dev/null +++ b/sc/qa/uitest/chart2/tdf142851.py @@ -0,0 +1,34 @@ +# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*- +# +# This file is part of the LibreOffice project. +# +# 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.uno.propertyvalue import mkPropertyValues +from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file + +# Bug 142851 - UI Chart Type dialog empty with unsupported combo chart + +class tdf142851(UITestCase): + def test_tdf142851_combo_chart_type(self): + with self.ui_test.load_file(get_url_for_data_file("tdf142851.xlsx")): + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + + gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Diagram 1"})) + gridwin.executeAction("ACTIVATE", tuple()) + xChartMainTop = self.xUITest.getTopFocusWindow() + xChartMain = xChartMainTop.getChild("chart_window") + xChart = xChartMain.getChild("CID/Page=") + + with self.ui_test.execute_dialog_through_action(xChart, "COMMAND", mkPropertyValues({"COMMAND" : "DiagramType"})) as xDialog: + chartTypeVisible = get_state_as_dict(xDialog.getChild("charttype"))['Visible'] + subTypeVisible = get_state_as_dict(xDialog.getChild("subtype"))['Visible'] + + self.assertEqual('true', chartTypeVisible) + self.assertEqual('true', subTypeVisible) + +# vim: set shiftwidth=4 softtabstop=4 expandtab: |