summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-12-20 20:09:23 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-12-21 07:24:49 +0000
commit85ec392132fa57025f7d70a5ccede912f1eb35e0 (patch)
tree914b3927abd94b731930c8472573f0222359b5d8
parent6f43f00279252265fe4892b46fe0b4686ff721ed (diff)
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 <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/uiwriter/uiwriter2.cxx23
1 files changed, 6 insertions, 17 deletions
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