From 22850e8d281d17575c01321cfff9e1ad2201ffb5 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 13 Feb 2023 12:18:48 +0100 Subject: sw: use try/finally to reset the changes in OptionsTreeDialog Otherwise it might affect other tests if it hits an assert Change-Id: I987d5b4493d599a7ad21c916464efca52f24f548 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146897 Tested-by: Jenkins Reviewed-by: Xisco Fauli --- sw/qa/uitest/writer_tests6/tdf144691.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'sw') diff --git a/sw/qa/uitest/writer_tests6/tdf144691.py b/sw/qa/uitest/writer_tests6/tdf144691.py index f2f980a598ae..14e8a62a4b5a 100644 --- a/sw/qa/uitest/writer_tests6/tdf144691.py +++ b/sw/qa/uitest/writer_tests6/tdf144691.py @@ -28,19 +28,20 @@ class tdf144691(UITestCase): defaultLanguage = get_state_as_dict(xWesternLanguage)['SelectEntryText'] - # Select another language - select_by_text(xWesternLanguage, "Tajik") - self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText']) - - xApply = xDialog.getChild("apply") - xApply.executeAction("CLICK", tuple()) - - # Without the fix in place, this test would have failed with - # AssertionError: 'Tajik' != 'English (USA)' - self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText']) - - # Select the default language - select_by_text(xWesternLanguage, defaultLanguage) - self.assertEqual(defaultLanguage, get_state_as_dict(xWesternLanguage)['SelectEntryText']) + try: + # Select another language + select_by_text(xWesternLanguage, "Tajik") + self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText']) + + xApply = xDialog.getChild("apply") + xApply.executeAction("CLICK", tuple()) + + # Without the fix in place, this test would have failed with + # AssertionError: 'Tajik' != 'English (USA)' + self.assertEqual("Tajik", get_state_as_dict(xWesternLanguage)['SelectEntryText']) + finally: + # Select the default language + select_by_text(xWesternLanguage, defaultLanguage) + self.assertEqual(defaultLanguage, get_state_as_dict(xWesternLanguage)['SelectEntryText']) # vim: set shiftwidth=4 softtabstop=4 expandtab: -- cgit