summaryrefslogtreecommitdiff
path: root/sw/qa/extras/rtfimport
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2016-02-12 15:47:05 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-02-15 23:04:01 +0000
commit3c9ae60c35a6f87f6167bcfe29f133670978d984 (patch)
tree369fd7db12e368fa2bc198178ebdcc1ee73121ae /sw/qa/extras/rtfimport
parent4d0f0654f96aafba1c88b4ffa90b7561afadabbf (diff)
sw: ensure that configuration change in odfexporttest.cxx ...
... is reverted in case the test function throws an exception, so that subsequent^Wfollowing tests don't inherit the changed configuration. Change-Id: I748f9edf15a7f860607ae4cce891450db254c73e (cherry picked from commit e2bfae9006e6adc4de17d0167dac6661b002f126) Reviewed-on: https://gerrit.libreoffice.org/22333 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sw/qa/extras/rtfimport')
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index f46636130ee3..0c6bd4bb8867 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -66,27 +66,32 @@ public:
{
}
- virtual void preTest(const char* filename) override
+ virtual std::unique_ptr<Resetter> preTest(const char* filename) override
{
m_aSavedSettings = Application::GetSettings();
if (OString(filename) == "fdo48023.rtf" || OString(filename) == "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;
}
else if (OString(filename) == "fdo44211.rtf")
{
+ std::unique_ptr<Resetter> pResetter(new Resetter(
+ [this] () {
+ Application::SetSettings(this->m_aSavedSettings);
+ }));
AllSettings aSettings(m_aSavedSettings);
aSettings.SetLanguageTag(LanguageTag("lt"));
Application::SetSettings(aSettings);
+ return pResetter;
}
- }
-
- virtual void postTest(const char* filename) override
- {
- if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo72031.rtf" || OString(filename) == "fdo44211.rtf")
- Application::SetSettings(m_aSavedSettings);
+ return nullptr;
}
protected: