diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-03-12 17:34:12 +0100 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-03-12 19:37:21 +0100 |
commit | 02c9e05551d69980e0757b1b0a624692ea21a96b (patch) | |
tree | 4f6ef74d6eb63a3dc09774a85e2f9632da4c0abb | |
parent | 622a08384eb95b58c015348b0e98e35d9fe852bc (diff) |
tdf#131291: Add UItest
Change-Id: I65aede1899d2c509fd52f8db0657ec3a5791f681
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90430
Tested-by: Jenkins
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
-rw-r--r-- | sc/qa/uitest/calc_tests/data/tdf131291.ods | bin | 0 -> 13814 bytes | |||
-rw-r--r-- | sc/qa/uitest/chart/chartDataLabels.py | 73 |
2 files changed, 73 insertions, 0 deletions
diff --git a/sc/qa/uitest/calc_tests/data/tdf131291.ods b/sc/qa/uitest/calc_tests/data/tdf131291.ods Binary files differnew file mode 100644 index 000000000000..76a87c2c226c --- /dev/null +++ b/sc/qa/uitest/calc_tests/data/tdf131291.ods diff --git a/sc/qa/uitest/chart/chartDataLabels.py b/sc/qa/uitest/chart/chartDataLabels.py index 7747875c3329..54ad9b9ce2a2 100644 --- a/sc/qa/uitest/chart/chartDataLabels.py +++ b/sc/qa/uitest/chart/chartDataLabels.py @@ -212,4 +212,77 @@ class chartDataLabels(UITestCase): self.ui_test.close_dialog_through_button(xOKBtn) self.ui_test.close_doc() + + def test_tdf131291(self): + calc_doc = self.ui_test.load_file(get_url_for_data_file("tdf131291.ods")) + xCalcDoc = self.xUITest.getTopFocusWindow() + gridwin = xCalcDoc.getChild("grid_window") + document = self.ui_test.get_component() + + 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") + + xDataSeries = document.Sheets[0].Charts[0].getEmbeddedObject().getFirstDiagram().CoordinateSystems[0].ChartTypes[0].DataSeries + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + xTabs = xDialog.getChild("tabcontrol") + select_pos(xTabs, "1") + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + + xNumberFormatBtn = xDialog.getChild("PB_NUMBERFORMAT") + + def handle_number_dlg(dialog): + categoryformat = dialog.getChild("categorylb") + formatted = dialog.getChild("formatted") + + # Select currency + categoryformat.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + categoryformat.executeAction("TYPE", mkPropertyValues({"KEYCODE": "DOWN"})) + + self.assertEqual(get_state_as_dict(categoryformat)["SelectEntryText"], "Currency") + + self.assertEqual(get_state_as_dict(formatted)["Text"], "[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00") + + xOKButton = dialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKButton) + + self.ui_test.execute_blocking_action(xNumberFormatBtn.executeAction, args=('CLICK', ()), + dialog_handler=handle_number_dlg) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + xNumberFormats = document.Sheets[0].Charts[0].getEmbeddedObject().getNumberFormats() + xLocale = Locale() + xFormat = xNumberFormats.queryKey("[$$-409]#,##0.00;[RED]-[$$-409]#,##0.00", xLocale, True) + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + + #reopen and verify the previous changes + self.ui_test.execute_dialog_through_action(xSeriesObj, "COMMAND", mkPropertyValues({"COMMAND": "FormatDataLabels"})) + xDialog = self.xUITest.getTopFocusWindow() + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + # tdf#131291: it would fail here: AssertionError: 0 != 104 + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + + xOKBtn = xDialog.getChild("ok") + self.ui_test.close_dialog_through_button(xOKBtn) + + self.assertTrue(xDataSeries[0].Label.ShowNumber) + self.assertFalse(xDataSeries[0].Label.ShowNumberInPercent) + self.assertEqual(xDataSeries[0].NumberFormat, xFormat) + self.ui_test.close_doc() # vim: set shiftwidth=4 softtabstop=4 expandtab: |