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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Wed Feb 24 21:08:34 UTC 2021


 sw/qa/uitest/writer_tests7/forms.py |   47 ++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

New commits:
commit bfcbccbf0c2798e6a36f43b72060289a9c0ca73f
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Wed Feb 24 17:04:17 2021 +0100
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Wed Feb 24 22:07:48 2021 +0100

    tdf#139486: sw: Add UItest
    
    Change-Id: I250bd21d1ffb7f2076ef08a1d69c0c6929e8420f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111492
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sw/qa/uitest/writer_tests7/forms.py b/sw/qa/uitest/writer_tests7/forms.py
index a8d0774ab71d..8c77560e0b61 100644
--- a/sw/qa/uitest/writer_tests7/forms.py
+++ b/sw/qa/uitest/writer_tests7/forms.py
@@ -6,6 +6,7 @@
 #
 from uitest.framework import UITestCase
 from uitest.uihelper.common import get_state_as_dict, get_url_for_data_file
+from uitest.uihelper.common import change_measurement_unit
 from libreoffice.uno.propertyvalue import mkPropertyValues
 
 class Forms(UITestCase):
@@ -92,4 +93,50 @@ class Forms(UITestCase):
 
         self.ui_test.close_doc()
 
+    def test_tdf139486(self):
+
+        # Reuse file from another test
+        self.ui_test.load_file(get_url_for_data_file("tdf140198.odt"))
+
+        change_measurement_unit(self, "Centimeter")
+
+        self.xUITest.executeCommand(".uno:JumpToNextFrame")
+
+        document = self.ui_test.get_component()
+        drawPage = document.getDrawPages().getByIndex(0)
+        shape = drawPage.getByIndex(0)
+        self.assertEqual(13996, shape.getSize().Width)
+        self.assertEqual(2408, shape.getSize().Height)
+
+        self.ui_test.execute_modeless_dialog_through_command(".uno:ControlProperties")
+        xWidth = self.ui_test.wait_until_child_is_available('numericfield-Width')
+        xHeight = self.ui_test.wait_until_child_is_available('numericfield-Height')
+
+        self.assertEqual("14.00 cm", get_state_as_dict(xWidth)['Text'])
+        self.assertEqual("2.41 cm", get_state_as_dict(xHeight)['Text'])
+
+        xWidth.executeAction("FOCUS", tuple())
+        xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+        xWidth.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+        xWidth.executeAction("TYPE", mkPropertyValues({"TEXT":"20 cm"}))
+
+        self.assertEqual("20 cm", get_state_as_dict(xWidth)['Text'])
+
+        xHeight.executeAction("FOCUS", tuple())
+        xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"CTRL+A"}))
+        xHeight.executeAction("TYPE", mkPropertyValues({"KEYCODE":"BACKSPACE"}))
+        xHeight.executeAction("TYPE", mkPropertyValues({"TEXT":"5 cm"}))
+
+        self.assertEqual("5 cm", get_state_as_dict(xHeight)['Text'])
+
+        # Move the focus to another element so the changes done before take effect on the document
+        xDialog = self.xUITest.getTopFocusWindow()
+        xDialog.getChild('numericfield-PositionY').executeAction("FOCUS", tuple())
+
+        # Without the fix in place, the size of the form wouldn't have changed
+        self.assertEqual(20001, shape.getSize().Width)
+        self.assertEqual(5001, shape.getSize().Height)
+
+        self.ui_test.close_doc()
+
 # vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list