diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2023-03-22 11:34:54 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2023-03-29 10:17:00 +0000 |
commit | 3ff9de9e06017375ea9abfc20b3eb0c7cd91c254 (patch) | |
tree | d57885dc54a2074c9d848a220fbaec073cc2db48 /uitest | |
parent | 375784d6bf0e6208cd122e0766277bea36268faf (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.
(cherry picked from commit 015da04a8f3e1368c6b9668ca22d7e320e1ecae6)
Change-Id: Id0dfde23a8726c8799950a6e4fdd1d85f135eafc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149376
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/uitest/test.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 5ed20add799c..5442d46b1d90 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -104,6 +104,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): |