summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2023-01-31 20:21:46 +0100
committerMiklos Vajna <vmiklos@collabora.com>2023-02-01 07:03:38 +0000
commita262ee4c4a682f844ef380d5e843be1b3ec78c98 (patch)
tree753c447156c981acab4c16703686e75624bda109
parent2d9570523b16dd157eeee384040642e3c2e0ed05 (diff)
CppunitTest_sw_rtfexport5: fold preTest() into its only user
Avoid magic in preTest() based on the bugdoc name. Change-Id: I7642828480bb4f636956b966275d8c3e26919a50 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146421 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx36
1 files changed, 16 insertions, 20 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 1104b9e4683b..fb020428ef03 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -38,6 +38,7 @@
#include <vcl/settings.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <comphelper/scopeguard.hxx>
using namespace css;
@@ -48,24 +49,6 @@ public:
: SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format")
{
}
-
- virtual std::unique_ptr<Resetter> preTest(const char* filename) override
- {
- m_aSavedSettings = Application::GetSettings();
- if (filename == std::string_view("fdo72031.rtf"))
- {
- std::unique_ptr<Resetter> pResetter(
- new Resetter([this]() { Application::SetSettings(this->m_aSavedSettings); }));
- AllSettings aSettings(m_aSavedSettings);
- aSettings.SetLanguageTag(LanguageTag("ru"));
- Application::SetSettings(aSettings);
- return pResetter;
- }
- return nullptr;
- }
-
-protected:
- AllSettings m_aSavedSettings;
};
DECLARE_RTFEXPORT_TEST(testFdo63023, "fdo63023.rtf")
@@ -756,9 +739,22 @@ DECLARE_RTFEXPORT_TEST(testFdo85889mac, "fdo85889-mac.rtf")
CPPUNIT_ASSERT_EQUAL(OUString(u"\u00D2\u00DA\u00DB"), xTextRange->getString());
}
-DECLARE_RTFEXPORT_TEST(testFdo72031, "fdo72031.rtf")
+CPPUNIT_TEST_FIXTURE(Test, testFdo72031)
{
- CPPUNIT_ASSERT_EQUAL(OUString(u"\uF0C5"), getRun(getParagraph(1), 1)->getString());
+ auto verify = [this]() {
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uF0C5"), getRun(getParagraph(1), 1)->getString());
+ };
+
+ AllSettings aSavedSettings = Application::GetSettings();
+ AllSettings aSettings(aSavedSettings);
+ aSettings.SetLanguageTag(LanguageTag("ru"));
+ Application::SetSettings(aSettings);
+ comphelper::ScopeGuard g([&aSavedSettings] { Application::SetSettings(aSavedSettings); });
+
+ createSwDoc("fdo72031.rtf");
+ verify();
+ reload(mpFilter, "fdo72031.rtf");
+ verify();
}
DECLARE_RTFEXPORT_TEST(testFdo86750, "fdo86750.rtf")