summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2021-06-15 14:52:54 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-15 21:27:39 +0200
commitce37a53c58e278fc9d330e70ab13533a94f73270 (patch)
treedd3eab8e74d4ac6612d3ed9750a8256bc711bee4 /sc
parent32b61e99dfd8d2c50dec1cddfb27c4e5e7083d2d (diff)
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@collabora.com> Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sc')
-rw-r--r--sc/qa/uitest/calc_tests8/tdf126248.py82
1 files changed, 36 insertions, 46 deletions
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: