summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport/odfexport.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-10-20 11:42:15 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-10-20 18:12:23 +0200
commit0a30cb22a141c26b4eab43a478d32df0769596ec (patch)
tree2b2d50a4e9d8c3b3915de17b667ba470640d4f89 /sw/qa/extras/odfexport/odfexport.cxx
parentbb80f99092c4ad6d5015165a60f7a239dcb2fbff (diff)
sw: run export tests twice
Export tests are in fact import-export-import tests. Given that we want to test the export filter here, it's handy to run the tests twice, first before the export (to detect if already the import filter fails) and also after the second import, to do the real test. So this should make it easier to detect when you have an export failure, but in fact the bug is in the import side. Change-Id: I26e3445f079a7fbd4e037218f7094a84e730b746 Requested-by: Pierre-Eric Pelloux-Prayer <pierre-eric@lanedo.com> Agreed-by: Lubos Lunak <l.lunak@suse.cz>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx43
1 files changed, 26 insertions, 17 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index 032da03cd640..7964ea9a1303 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -37,34 +37,44 @@ public:
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
- CPPUNIT_TEST(testFdo38244);
- CPPUNIT_TEST(testFirstHeaderFooter);
+ CPPUNIT_TEST(run);
#endif
CPPUNIT_TEST_SUITE_END();
private:
- void roundtrip(const OUString& rURL);
+ void run();
};
-void Test::roundtrip(const OUString& rFilename)
+void Test::run()
{
- uno::Reference<lang::XComponent> xImported = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfexport/data/") + rFilename);
- uno::Reference<frame::XStorable> xStorable(xImported, uno::UNO_QUERY);
- uno::Sequence<beans::PropertyValue> aArgs(1);
- aArgs[0].Name = "FilterName";
- aArgs[0].Value <<= OUString("writer8");
- utl::TempFile aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aArgs);
- uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
- xComponent->dispose();
- mxComponent = loadFromDesktop(aTempFile.GetURL());
+ MethodEntry<Test> aMethods[] = {
+ {"fdo38244.odt", &Test::testFdo38244},
+ {"first-header-footer.odt", &Test::testFirstHeaderFooter},
+ };
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
+ {
+ MethodEntry<Test>& rEntry = aMethods[i];
+ mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfexport/data/") + OUString::createFromAscii(rEntry.pName));
+ // If the testcase is stored in some other format, it's pointless to test.
+ if (OString(rEntry.pName).endsWith(".odt"))
+ (this->*rEntry.pMethod)();
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aArgs(1);
+ aArgs[0].Name = "FilterName";
+ aArgs[0].Value <<= OUString("writer8");
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aArgs);
+ uno::Reference<lang::XComponent> xComponent(xStorable, uno::UNO_QUERY);
+ xComponent->dispose();
+ mxComponent = loadFromDesktop(aTempFile.GetURL());
+ (this->*rEntry.pMethod)();
+ }
}
void Test::testFdo38244()
{
// See ooxmlexport's testFdo38244().
- roundtrip("fdo38244.odt");
// Test comment range feature.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
@@ -91,7 +101,6 @@ void Test::testFdo38244()
void Test::testFirstHeaderFooter()
{
// Test import and export of the header-first token.
- roundtrip("first-header-footer.odt");
// The document has 6 pages, two page styles for the first and second half of pages.
CPPUNIT_ASSERT_EQUAL(OUString("First header"), parseDump("/root/page[1]/header/txt/text()"));