summaryrefslogtreecommitdiffstats
path: root/sc/qa/uitest/chart/chartGrid.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /sc/qa/uitest/chart/chartGrid.py
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.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/chart/chartGrid.py')
-rw-r--r--sc/qa/uitest/chart/chartGrid.py200
1 files changed, 200 insertions, 0 deletions
diff --git a/sc/qa/uitest/chart/chartGrid.py b/sc/qa/uitest/chart/chartGrid.py
new file mode 100644
index 000000000..c54e03637
--- /dev/null
+++ b/sc/qa/uitest/chart/chartGrid.py
@@ -0,0 +1,200 @@
+# -*- 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 change_measurement_unit, select_pos
+from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from libreoffice.uno.propertyvalue import mkPropertyValues
+
+
+# Chart Grid dialog
+# Bug 98390 - Crash when modifying minor grid
+class chartGrid(UITestCase):
+ def test_tdf98390_chart_grid_dialog(self):
+ with self.ui_test.load_file(get_url_for_data_file("tdf98390.ods")):
+ xCalcDoc = self.xUITest.getTopFocusWindow()
+ gridwin = xCalcDoc.getChild("grid_window")
+
+ change_measurement_unit(self, "Centimeter")
+
+ #X Axis Major Grid
+ 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": "DiagramGridYMain"})) as xDialog:
+ #tab "Line".
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+
+ #reopen and verify X Axis Major Grid
+ 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": "DiagramGridYMain"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+ #Y Axis Major Grid
+ 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": "DiagramGridXMain"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+
+ #reopen and verify Y Axis Major Grid
+ 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": "DiagramGridXMain"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+
+ #Y Axis Minor Grid
+ 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": "DiagramGridXHelp"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+
+ #reopen and verify Y Axis Minor Grid
+ 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": "DiagramGridXHelp"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+
+ #X Axis Minor Grid
+ 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": "DiagramGridYHelp"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+
+ #reopen and verify X Axis Minor Grid
+ 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": "DiagramGridYHelp"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.10 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "5%")
+
+
+ #All Grids
+ 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": "DiagramGridAll"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ xWidth.executeAction("UP", tuple())
+ transparency.executeAction("UP", tuple())
+
+
+ #reopen and verify X Axis Minor Grid (changed in All Grids)
+ 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": "DiagramGridYHelp"})) as xDialog:
+
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "0")
+ xWidth = xDialog.getChild("MTR_FLD_LINE_WIDTH")
+ transparency = xDialog.getChild("MTR_LINE_TRANSPARENT")
+
+ self.assertEqual(get_state_as_dict(xWidth)["Text"], "0.20 cm")
+ self.assertEqual(get_state_as_dict(transparency)["Text"], "10%")
+
+
+# vim: set shiftwidth=4 softtabstop=4 expandtab: