[Libreoffice-commits] core.git: sw/qa
Miklos Vajna (via logerrit)
logerrit at kemper.freedesktop.org
Wed Jul 28 06:36:59 UTC 2021
sw/qa/extras/ooxmlexport/ooxmlexport3.cxx | 7 +++----
sw/qa/inc/swmodeltestbase.hxx | 3 +++
sw/qa/unit/swmodeltestbase.cxx | 7 +++++++
3 files changed, 13 insertions(+), 4 deletions(-)
New commits:
commit 3808418e38fe9540a286ad48f1c3eaed2706f78c
Author: Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Tue Jul 27 20:05:11 2021 +0200
Commit: Miklos Vajna <vmiklos at collabora.com>
CommitDate: Wed Jul 28 08:36:26 2021 +0200
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 at collabora.com>
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();
More information about the Libreoffice-commits
mailing list