diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-13 12:18:48 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2023-02-13 12:42:34 +0000 |
commit | 22850e8d281d17575c01321cfff9e1ad2201ffb5 (patch) | |
tree | daa8ee571bcee568a8b478e367467753d6a8b730 /sw | |
parent | 835f87280ab228f59801c28c288472f2941ea222 (diff) |
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 <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/uitest/writer_tests6/tdf144691.py | 29 |
1 files changed, 15 insertions, 14 deletions
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: |