summaryrefslogtreecommitdiff
path: root/sw/qa/uitest/writer_tests4
diff options
context:
space:
mode:
authorXisco Fauli <xiscofauli@libreoffice.org>2023-02-06 13:52:58 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2023-02-07 09:33:40 +0000
commit7355c2ee8a9f0811d1cd3d37fc9dac2ad5f95774 (patch)
treea5fd1f08a00eac447ca2e6b8da00c75cfa947442 /sw/qa/uitest/writer_tests4
parentca57cee2ae5718378193a9c7050248c63b5fa47e (diff)
uitest: reset value when changing the measurement unit
Otherwise, changing it in one test might affect other tests Use @contextmanager decorator to change it back to default 'Inch' at the end of the test even if the test hits an assert Change-Id: I1e7b35019cd19b490aa619c0a866bb9f93820950 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146583 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw/qa/uitest/writer_tests4')
-rw-r--r--sw/qa/uitest/writer_tests4/tdf138546.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/sw/qa/uitest/writer_tests4/tdf138546.py b/sw/qa/uitest/writer_tests4/tdf138546.py
index dedaf36d1ff8..11305bf8234e 100644
--- a/sw/qa/uitest/writer_tests4/tdf138546.py
+++ b/sw/qa/uitest/writer_tests4/tdf138546.py
@@ -16,22 +16,22 @@ class tdf138546(UITestCase):
def test_tdf138546(self):
with self.ui_test.load_file(get_url_for_data_file("tdf138546.odt")):
- change_measurement_unit(self, "Centimeter")
+ with change_measurement_unit(self, "Centimeter"):
- #dialog Columns
- with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
+ #dialog Columns
+ with self.ui_test.execute_dialog_through_command(".uno:FormatColumns", close_button="cancel") as xDialog:
- colsnf = xDialog.getChild("colsnf")
- width1mf = xDialog.getChild("width1mf")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
- with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
- tabcontrol = xDialog.getChild("tabcontrol")
- select_pos(tabcontrol, "7") #Columns
- colsnf = xDialog.getChild("colsnf")
- width1mf = xDialog.getChild("width1mf")
- self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
- self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
+ with self.ui_test.execute_dialog_through_command(".uno:PageDialog", close_button="cancel") as xDialog:
+ tabcontrol = xDialog.getChild("tabcontrol")
+ select_pos(tabcontrol, "7") #Columns
+ colsnf = xDialog.getChild("colsnf")
+ width1mf = xDialog.getChild("width1mf")
+ self.assertEqual(get_state_as_dict(colsnf)["Text"], "2")
+ self.assertEqual((get_state_as_dict(width1mf)["Text"])[0:3], "2.0") #2.00 cm
# vim: set shiftwidth=4 softtabstop=4 expandtab: