summaryrefslogtreecommitdiff
path: root/uitest
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-03-22 11:34:54 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-03-22 13:29:47 +0000
commit015da04a8f3e1368c6b9668ca22d7e320e1ecae6 (patch)
tree4c2f913eb5d3af1bb38c0b9d96fab8ce3723e2bf /uitest
parentb1851d1afec70402a711e850f27c1c2521a7ba4d (diff)
sw floattable: fix current page number when editing document with a split fly
UITest_writer_tests6's tdf124675.tdf124675.test_tdf124675_crash_moving_SwTextFrame_previous_page failed in the SW_FORCE_FLY_SPLIT=1 case, since the current page after typing was 3, not 2. It seems this change is wanted, since the total page count increases by 2, so it's consistent that the current page increases similarly with typing. Also, repeating the UITest in Word (after positioning the cursor at the top paragraph in the document) also produces page 3 as the current page. Fix the problem by locally enabling split flys for this test and then we can assert that we match Word. This requires a new context manager, but that set_config() is really similar to other context managers in the class that return no value. The original purpose of the test was to make sure we don't crash, anyway. Change-Id: Id0dfde23a8726c8799950a6e4fdd1d85f135eafc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149315 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'uitest')
-rw-r--r--uitest/uitest/test.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py
index 207969d5213b..23ca7f39bc4e 100644
--- a/uitest/uitest/test.py
+++ b/uitest/uitest/test.py
@@ -100,6 +100,19 @@ class UITest(object):
finally:
self.close_doc()
+ # Resets the setting to the old value at exit
+ @contextmanager
+ def set_config(self, path, new_value):
+ xChanges = self._xContext.ServiceManager.createInstanceWithArgumentsAndContext('com.sun.star.configuration.ReadWriteAccess', ("",), self._xContext)
+ try:
+ old_value = xChanges.getByHierarchicalName(path)
+ xChanges.replaceByHierarchicalName(path, new_value)
+ xChanges.commitChanges()
+ yield
+ finally:
+ xChanges.replaceByHierarchicalName(path, old_value)
+ xChanges.commitChanges()
+
# Calls UITest.close_doc at exit
@contextmanager
def load_empty_file(self, app):