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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon May 25 14:25:27 UTC 2020


 sw/qa/uitest/writer_tests7/tdf133189.py |   61 ++++++++++++++++++--------------
 1 file changed, 36 insertions(+), 25 deletions(-)

New commits:
commit af4f6bd6632059138ff58f89a78f08c0b0ac0c83
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Mon May 25 14:51:44 2020 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Mon May 25 16:24:41 2020 +0200

    uitest: use fixed values for width and height
    
    Change-Id: Id7217392a94ba79f5737a95b056a8f53281e5844
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94792
    Tested-by: Jenkins
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/sw/qa/uitest/writer_tests7/tdf133189.py b/sw/qa/uitest/writer_tests7/tdf133189.py
index 8e5b9d5176bf..8b59fcceb00b 100644
--- a/sw/qa/uitest/writer_tests7/tdf133189.py
+++ b/sw/qa/uitest/writer_tests7/tdf133189.py
@@ -5,7 +5,7 @@
 # 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 get_state_as_dict, select_pos
 from libreoffice.uno.propertyvalue import mkPropertyValues
 
 def change_metric_units(self, unit):
@@ -39,40 +39,51 @@ class tdf133189(UITestCase):
         xPaperOrient = xWriterEdit.getChild('paperorientation')
         xPaperMargin = xWriterEdit.getChild('marginLB')
 
-        props = {"TEXT": 'A4'}
-        actionProps = mkPropertyValues(props)
-        xPaperSize.executeAction("SELECT", actionProps)
+        #change measurement to Inches
+        change_metric_units(self, 'Inch')
 
-        self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "A4")
-        self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+        self.ui_test.execute_dialog_through_command(".uno:PageDialog")
+        xDialog = self.xUITest.getTopFocusWindow()
+        tabcontrol = xDialog.getChild("tabcontrol")
+        select_pos(tabcontrol, "1")
 
-        #change measurement to Centimeter
-        change_metric_units(self, 'Centimeter')
+        xWidth = xDialog.getChild('spinWidth')
+        xHeight = xDialog.getChild('spinHeight')
 
-        #wait until the sidebar is updated
-        self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
-
-        # tdf#129267
-        self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)")
-        self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "A4")
-        self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+        props = {"VALUE": '8.0'}
+        actionProps = mkPropertyValues(props)
 
-        heightValue = float(get_state_as_dict(xPaperHeight)['Value'])
-        widthValue = float(get_state_as_dict(xPaperWidth)['Value'])
+        xWidth.executeAction("VALUE", actionProps)
+        xHeight.executeAction("VALUE", actionProps)
 
-        #change measurement again to Inches
-        change_metric_units(self, 'Inch')
+        xOKBtn = xDialog.getChild("ok")
+        self.ui_test.close_dialog_through_button(xOKBtn)
 
-        #wait until the sidebar is updated
         self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (0.75″)")
-
         self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (0.75″)")
-        self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "A4")
+        self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+        self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+        self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
         self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+        self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "8.00″")
+        self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "8.00″")
+        self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "8.00″")
+        self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "8.00″")
+
+        #change measurement again to Centimeters
+        change_metric_units(self, 'Centimeter')
 
-        # 1 inc = 2.54 cms. Check the elements has been updated
-        self.assertEqual(int(float(get_state_as_dict(xPaperWidth)['Value'])), int(widthValue / 2.54))
-        self.assertEqual(int(float(get_state_as_dict(xPaperHeight)['Value'])), int(heightValue / 2.54))
+        self.ui_test.wait_until_property_is_updated(xPaperMargin, "SelectEntryText", "Normal (1.90 cm)")
+        # tdf#129267
+        self.assertEqual(get_state_as_dict(xPaperMargin)['SelectEntryText'], "Normal (1.90 cm)")
+        self.ui_test.wait_until_property_is_updated(xPaperSize, "SelectEntryText", "User")
+        self.assertEqual(get_state_as_dict(xPaperSize)['SelectEntryText'], "User")
+        self.ui_test.wait_until_property_is_updated(xPaperOrient, "SelectEntryText", "Portrait")
+        self.assertEqual(get_state_as_dict(xPaperOrient)['SelectEntryText'], "Portrait")
+        self.ui_test.wait_until_property_is_updated(xPaperWidth, "Text", "20.32 cm")
+        self.assertEqual(get_state_as_dict(xPaperWidth)['Text'], "20.32 cm")
+        self.ui_test.wait_until_property_is_updated(xPaperHeight, "Text", "20.32 cm")
+        self.assertEqual(get_state_as_dict(xPaperHeight)['Text'], "20.32 cm")
 
         self.xUITest.executeCommand(".uno:Sidebar")
 


More information about the Libreoffice-commits mailing list