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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Tue Jun 15 19:28:20 UTC 2021


 sc/qa/uitest/calc_tests8/tdf126248.py |   82 ++++++++++++++--------------------
 1 file changed, 36 insertions(+), 46 deletions(-)

New commits:
commit ce37a53c58e278fc9d330e70ab13533a94f73270
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Jun 15 14:52:54 2021 +0200
Commit:     Xisco Fauli <xiscofauli at libreoffice.org>
CommitDate: Tue Jun 15 21:27:39 2021 +0200

    uitest: sc: use guarded wrapper in test
    
    maybe it helps to know why it's failing on amd64
    Change-Id: I6f3e4747393c823c4f1f98fc9208ed2ab16c270c
    
    Change-Id: Ie804b0485dc3cf4206bfe88884d1c1a420cee593
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117247
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>

diff --git a/sc/qa/uitest/calc_tests8/tdf126248.py b/sc/qa/uitest/calc_tests8/tdf126248.py
index 406a86574657..27482acd0cde 100644
--- a/sc/qa/uitest/calc_tests8/tdf126248.py
+++ b/sc/qa/uitest/calc_tests8/tdf126248.py
@@ -11,6 +11,7 @@ from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.calc import enter_text_to_cell
 from uitest.uihelper.common import select_pos
 from uitest.uihelper.common import select_by_text
+from uitest.uihelper import guarded
 
 class tdf126248(UITestCase):
 
@@ -30,67 +31,56 @@ class tdf126248(UITestCase):
         self.xUITest.executeCommand(".uno:Sidebar")
 
     def changeLocalSetting(self, language):
-        self.ui_test.execute_dialog_through_command(".uno:OptionsTreeDialog")
-        xDialog = self.xUITest.getTopFocusWindow()
-
-        xPages = xDialog.getChild("pages")
-        xLanguageEntry = xPages.getChild('2')
-        xLanguageEntry.executeAction("EXPAND", tuple())
-        xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
-        xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple())
-
-        # Check asian support is enabled
-        asianlanguage = xDialog.getChild("asiansupport")
-        self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected'])
-
-        localeSetting = xDialog.getChild("localesetting")
-        select_by_text(localeSetting, language)
-        self.ui_test.wait_until_property_is_updated(localeSetting, 'SelectEntryText', language)
-        self.assertEqual(language, get_state_as_dict(localeSetting)['SelectEntryText'])
-
-        xOKBtn = xDialog.getChild("ok")
-        self.ui_test.close_dialog_through_button(xOKBtn)
-
+        with guarded.execute_dialog_through_command(self, ".uno:OptionsTreeDialog") as xDialog:
+            xPages = xDialog.getChild("pages")
+            xLanguageEntry = xPages.getChild('2')
+            xLanguageEntry.executeAction("EXPAND", tuple())
+            xxLanguageEntryGeneralEntry = xLanguageEntry.getChild('0')
+            xxLanguageEntryGeneralEntry.executeAction("SELECT", tuple())
+
+            # Check asian support is enabled
+            asianlanguage = xDialog.getChild("asiansupport")
+            self.assertEqual("true", get_state_as_dict(asianlanguage)['Selected'])
+
+            localeSetting = xDialog.getChild("localesetting")
+            select_by_text(localeSetting, language)
+            self.ui_test.wait_until_property_is_updated(localeSetting, 'SelectEntryText', language)
+            self.assertEqual(language, get_state_as_dict(localeSetting)['SelectEntryText'])
 
     def test_tdf126248(self):
 
-        self.ui_test.create_doc_in_start_center("calc")
+        with guarded.create_doc_in_start_center(self, "calc"):
 
-        self.changeLocalSetting("Chinese (traditional)")
+            self.changeLocalSetting("Chinese (traditional)")
 
-        self.ui_test.execute_dialog_through_command(".uno:FormatCellDialog")
-        xCellsDlg = self.xUITest.getTopFocusWindow()
-
-        # Get current font names from the Format Cell dialog
-        westFontName = get_state_as_dict(xCellsDlg.getChild("westfontnamelb-cjk"))['Text']
-        eastFontName = get_state_as_dict(xCellsDlg.getChild("eastfontnamelb"))['Text']
-
-        okBtn = xCellsDlg.getChild("ok")
-        self.ui_test.close_dialog_through_button(okBtn)
-
-        xCalcDoc = self.xUITest.getTopFocusWindow()
-        gridwin = xCalcDoc.getChild("grid_window")
+            with guarded.execute_dialog_through_command(self, ".uno:FormatCellDialog") as xDialog:
+                xTabs = xDialog.getChild("tabcontrol")
+                select_pos(xTabs, "1")
 
-        enter_text_to_cell(gridwin, "A1", "Test")
+                # Get current font names from the Format Cell dialog
+                westFontName = get_state_as_dict(xDialog.getChild("westfontnamelb-cjk"))['Text']
+                eastFontName = get_state_as_dict(xDialog.getChild("eastfontnamelb"))['Text']
 
-        # Without the fix in place, this test would have failed here
-        self.assertFontName(gridwin, westFontName)
+            xCalcDoc = self.xUITest.getTopFocusWindow()
+            gridwin = xCalcDoc.getChild("grid_window")
 
-        enter_text_to_cell(gridwin, "B1", "測試")
+            enter_text_to_cell(gridwin, "A1", "Test")
 
-        self.assertFontName(gridwin, eastFontName)
+            # Without the fix in place, this test would have failed here
+            self.assertFontName(gridwin, westFontName)
 
-        self.changeLocalSetting("English (USA)")
+            enter_text_to_cell(gridwin, "B1", "測試")
 
-        enter_text_to_cell(gridwin, "C1", "Test")
+            self.assertFontName(gridwin, eastFontName)
 
-        self.assertFontName(gridwin, westFontName)
+            self.changeLocalSetting("English (USA)")
 
-        enter_text_to_cell(gridwin, "D1", "測試")
+            enter_text_to_cell(gridwin, "C1", "Test")
 
-        self.assertFontName(gridwin, eastFontName)
+            self.assertFontName(gridwin, westFontName)
 
-        self.ui_test.close_doc()
+            enter_text_to_cell(gridwin, "D1", "測試")
 
+            self.assertFontName(gridwin, eastFontName)
 
 # vim: set shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list