diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-07-27 20:05:11 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2021-07-28 08:36:26 +0200 |
commit | 3808418e38fe9540a286ad48f1c3eaed2706f78c (patch) | |
tree | 09577dee5b54a14e400fe5f6245131f102102934 /sw | |
parent | 3bd2f04d59acfd1eb954042bd485858cdf0fd670 (diff) |
Add SwModelTestBase::loadAndSave()
Allows one more removal of DECLARE_OOXMLEXPORT_EXPORTONLY_TEST() in
CppunitTest_sw_ooxmlexport3. That conversion in testCalendar1 now looks
like a good candidate for mass-conversion purposes.
See commit a226cec52e536c46e03f57a5f1f7931abbeb0cdd
(CppunitTest_sw_rtfimport: convert one testcase to use
CPPUNIT_TEST_FIXTURE(), 2019-11-05) for motivation.
Change-Id: I096b87ede4417976e5348399e631814ca103bdc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119573
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 7 | ||||
-rw-r--r-- | sw/qa/inc/swmodeltestbase.hxx | 3 | ||||
-rw-r--r-- | sw/qa/unit/swmodeltestbase.cxx | 7 |
3 files changed, 13 insertions, 4 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 30bc65297c09..a4ca163cbb66 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -157,9 +157,7 @@ DECLARE_OOXMLEXPORT_TEST(testCharacterBorder, "charborder.odt") CPPUNIT_TEST_FIXTURE(Test, testStyleInheritance) { - load(mpTestDocumentPath, "style-inheritance.docx"); - save("Office Open XML Text", maTempFile); - mbExported = true; + loadAndSave("style-inheritance.docx"); // Check that now styleId's are more like what MSO produces xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); @@ -257,8 +255,9 @@ CPPUNIT_TEST_FIXTURE(Test, testStyleInheritance) assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Normal']/w:pPr/w:suppressAutoHyphens", 0); } -DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCalendar1, "calendar1.docx") +CPPUNIT_TEST_FIXTURE(Test, testCalendar1) { + loadAndSave("calendar1.docx"); // Document has a non-trivial table style, test the roundtrip of it. xmlDocUniquePtr pXmlStyles = parseExport("word/styles.xml"); assertXPath(pXmlStyles, "/w:styles/w:style[@w:styleId='Calendar1']/w:basedOn", "val", "TableNormal"); diff --git a/sw/qa/inc/swmodeltestbase.hxx b/sw/qa/inc/swmodeltestbase.hxx index 27a27929681e..8c0b60038849 100644 --- a/sw/qa/inc/swmodeltestbase.hxx +++ b/sw/qa/inc/swmodeltestbase.hxx @@ -337,6 +337,9 @@ protected: /// Save the loaded document to a tempfile. Can be used to check the resulting docx/odt directly as a ZIP file. void save(const OUString& aFilterName, utl::TempFile& rTempFile); + /// Combines load() and save(). + void loadAndSave(const char* pName); + void finish(); /// Get page count. diff --git a/sw/qa/unit/swmodeltestbase.cxx b/sw/qa/unit/swmodeltestbase.cxx index 9cb362bf3ff5..00276a2f844d 100644 --- a/sw/qa/unit/swmodeltestbase.cxx +++ b/sw/qa/unit/swmodeltestbase.cxx @@ -630,6 +630,13 @@ void SwModelTestBase::save(const OUString& aFilterName, utl::TempFile& rTempFile } } +void SwModelTestBase::loadAndSave(const char* pName) +{ + load(mpTestDocumentPath, pName); + save(OUString::createFromAscii(mpFilter), maTempFile); + mbExported = true; +} + void SwModelTestBase::finish() { sal_uInt32 nEndTime = osl_getGlobalTimer(); |