sw/qa/extras/uiwriter/uiwriter2.cxx | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-)
New commits: commit 85ec392132fa57025f7d70a5ccede912f1eb35e0 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Tue Dec 20 20:09:23 2022 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Wed Dec 21 07:24:49 2022 +0000 CppunitTest_sw_uiwriter2: simplify testRTLparaStyle_LocaleArabic Use comphelper::ScopeGuard the avoid the need for a separate preTest(). Change-Id: I89cb89f86baf5da1671b05ddb368335d0b3d2ff9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144628 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/uiwriter/uiwriter2.cxx b/sw/qa/extras/uiwriter/uiwriter2.cxx index 0959e88efcee..6e481fb770d8 100644 --- a/sw/qa/extras/uiwriter/uiwriter2.cxx +++ b/sw/qa/extras/uiwriter/uiwriter2.cxx @@ -47,21 +47,6 @@ public: { } - virtual std::unique_ptr<Resetter> preTest(const char* filename) override - { - m_aSavedSettings = Application::GetSettings(); - if (OString(filename).indexOf("LocaleArabic") != -1) - { - std::unique_ptr<Resetter> pResetter( - new Resetter([this]() { Application::SetSettings(this->m_aSavedSettings); })); - AllSettings aSettings(m_aSavedSettings); - aSettings.SetLanguageTag(LanguageTag("ar")); - Application::SetSettings(aSettings); - return pResetter; - } - return nullptr; - } - protected: AllSettings m_aSavedSettings; }; @@ -2629,8 +2614,12 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testUnfloating) CPPUNIT_TEST_FIXTURE(SwUiWriterTest2, testRTLparaStyle_LocaleArabic) { // New documents, created in RTL locales, were not round-tripping the paragraph style as RTL. - // Set the locale to "ar" for this test - see preTest() at the top of this file. - std::unique_ptr<Resetter> const pChanges(preTest("LocaleArabic")); + // Set the locale to "ar" for this test. + m_aSavedSettings = Application::GetSettings(); + AllSettings aSettings(m_aSavedSettings); + aSettings.SetLanguageTag(LanguageTag("ar")); + Application::SetSettings(aSettings); + comphelper::ScopeGuard g([this] { Application::SetSettings(this->m_aSavedSettings); }); createSwDoc(); // new, empty doc - everything defaults to RTL with Arabic locale