[Libreoffice-commits] core.git: sc/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 2 07:54:16 UTC 2020


 sc/qa/uitest/chart/chartLegend.py |   43 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

New commits:
commit 61d9d1cf56994146d514fd5bf8c3f3f6885449ea
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Thu Oct 1 11:52:03 2020 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Fri Oct 2 09:53:33 2020 +0200

    uitest: sc: test chart legends move with arrow keys
    
    Change-Id: I9fb81be8de86408c6ee13495593636effbd1cc24
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103755
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/chart/chartLegend.py b/sc/qa/uitest/chart/chartLegend.py
index 414a2de09227..7e2e085d135b 100644
--- a/sc/qa/uitest/chart/chartLegend.py
+++ b/sc/qa/uitest/chart/chartLegend.py
@@ -7,6 +7,7 @@
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import select_pos
+from uitest.uihelper.common import change_measurement_unit
 from uitest.uihelper.calc import enter_text_to_cell
 from libreoffice.calc.document import get_cell_by_position
 from libreoffice.uno.propertyvalue import mkPropertyValues
@@ -95,4 +96,46 @@ class chartLegend(UITestCase):
     xOKBtn = xDialog.getChild("ok")
     self.ui_test.close_dialog_through_button(xOKBtn)
     self.ui_test.close_doc()
+
+   def test_legends_move_with_arrows_keys(self):
+
+    calc_doc = self.ui_test.load_file(get_url_for_data_file("dataLabels.ods"))
+    xCalcDoc = self.xUITest.getTopFocusWindow()
+    gridwin = xCalcDoc.getChild("grid_window")
+
+    change_measurement_unit(self, "Centimeter")
+
+    gridwin.executeAction("SELECT", mkPropertyValues({"OBJECT": "Object 1"}))
+    gridwin.executeAction("ACTIVATE", tuple())
+    xChartMainTop = self.xUITest.getTopFocusWindow()
+    xChartMain = xChartMainTop.getChild("chart_window")
+
+    # Select the legends
+    xLegends = xChartMain.getChild("CID/D=0:Legend=")
+    xLegends.executeAction("SELECT", tuple())
+
+    self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
+
+    xDialog = self.xUITest.getTopFocusWindow()
+    self.assertEqual("4.61", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
+    self.assertEqual("1.54", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
+
+    xOkBtn = xDialog.getChild("ok")
+    xOkBtn.executeAction("CLICK", tuple())
+
+    xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "UP"}))
+    xChartMain.executeAction("TYPE", mkPropertyValues({"KEYCODE": "LEFT"}))
+
+    self.ui_test.execute_dialog_through_action(xLegends, "COMMAND", mkPropertyValues({"COMMAND": "TransformDialog"}))
+
+    # Check the position has changed after moving the label using the arrows keys
+    xDialog = self.xUITest.getTopFocusWindow()
+    self.assertEqual("4.51", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_X"))['Value'])
+    self.assertEqual("1.44", get_state_as_dict(xDialog.getChild("MTR_FLD_POS_Y"))['Value'])
+
+    xOkBtn = xDialog.getChild("ok")
+    xOkBtn.executeAction("CLICK", tuple())
+
+    self.ui_test.close_doc()
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list