summaryrefslogtreecommitdiff
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
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>
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx43
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx109
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx130
-rw-r--r--sw/qa/extras/swmodeltestbase.hxx7
-rw-r--r--sw/qa/extras/ww8export/ww8export.cxx45
5 files changed, 170 insertions, 164 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()"));
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 2d7f49d83562..e5da60bfc07f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -67,53 +67,68 @@ public:
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
- CPPUNIT_TEST(testZoom);
- CPPUNIT_TEST(defaultTabStopNotInStyles);
- CPPUNIT_TEST(testFdo38244);
- CPPUNIT_TEST(testMathEscape);
- CPPUNIT_TEST(testFdo51034);
- CPPUNIT_TEST(testMathAccents);
- CPPUNIT_TEST(testMathD);
- CPPUNIT_TEST(testMathEscaping);
- CPPUNIT_TEST(testMathLim);
- CPPUNIT_TEST(testMathMalformedXml);
- CPPUNIT_TEST(testMathMatrix);
- CPPUNIT_TEST(testMathMso2k7);
- CPPUNIT_TEST(testMathNary);
- CPPUNIT_TEST(testMathOverbraceUnderbrace);
- CPPUNIT_TEST(testMathOverstrike);
- CPPUNIT_TEST(testMathPlaceholders);
- CPPUNIT_TEST(testMathRad);
- CPPUNIT_TEST(testMathSubscripts);
- CPPUNIT_TEST(testMathVerticalStacks);
- CPPUNIT_TEST(testTablePosition);
- CPPUNIT_TEST(testFdo47669);
+ 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/ooxmlexport/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("Office Open XML Text");
- 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[] = {
+ {"zoom.docx", &Test::testZoom},
+ {"empty.odt", &Test::defaultTabStopNotInStyles},
+ {"fdo38244.docx", &Test::testFdo38244},
+ {"math-escape.docx", &Test::testMathEscape},
+ {"fdo51034.odt", &Test::testFdo51034},
+ {"math-accents.docx", &Test::testMathAccents},
+ {"math-d.docx", &Test::testMathD},
+ {"math-escaping.docx", &Test::testMathEscaping},
+ {"math-lim.docx", &Test::testMathLim},
+ {"math-malformed_xml.docx", &Test::testMathMalformedXml},
+ {"math-matrix.docx", &Test::testMathMatrix},
+ {"math-mso2k7.docx", &Test::testMathMso2k7},
+ {"math-nary.docx", &Test::testMathNary},
+ {"math-overbrace_underbrace.docx", &Test::testMathOverbraceUnderbrace},
+ {"math-overstrike.docx", &Test::testMathOverstrike},
+ {"math-placeholders.docx", &Test::testMathPlaceholders},
+ {"math-rad.docx", &Test::testMathRad},
+ {"math-subscripts.docx", &Test::testMathSubscripts},
+ {"math-vertical_stacks.docx", &Test::testMathVerticalStacks},
+ {"../../ooxmlimport/data/n779957.docx", &Test::testTablePosition},
+ {"fdo47669.docx", &Test::testFdo47669},
+ };
+ // Don't test the first import of these, for some reason those tests fail
+ const char* aBlacklist[] = {
+ "math-escape.docx",
+ "math-mso2k7.docx",
+ };
+ std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
+ {
+ MethodEntry<Test>& rEntry = aMethods[i];
+ mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ooxmlexport/data/") + OUString::createFromAscii(rEntry.pName));
+ // If the testcase is stored in some other format, it's pointless to test.
+ if (OString(rEntry.pName).endsWith(".docx") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
+ (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("Office Open XML Text");
+ 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::testZoom()
{
- roundtrip("zoom.docx");
-
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
@@ -124,7 +139,6 @@ void Test::testZoom()
void Test::defaultTabStopNotInStyles()
{
- roundtrip( "empty.odt" );
// The default tab stop was mistakenly exported to a style.
// xray ThisComponent.StyleFamilies(1)(0).ParaTabStop
uno::Reference< container::XNameAccess > paragraphStyles = getStyles( "ParagraphStyles" );
@@ -138,8 +152,6 @@ void Test::defaultTabStopNotInStyles()
void Test::testFdo38244()
{
- roundtrip("fdo38244.docx");
-
/*
* Comments attached to a range was imported without the range, check for the fieldmark start/end positions.
*
@@ -204,14 +216,12 @@ void Test::testFdo38244()
void Test::testMathEscape()
{
- roundtrip("math-escape.docx");
CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1)));
}
void Test::testFdo51034()
{
// The problem was that the 'l' param of the HYPERLINK field was parsed with = "#", not += "#".
- roundtrip("fdo51034.odt");
CPPUNIT_ASSERT_EQUAL(OUString("http://Www.google.com/#a"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
}
@@ -226,7 +236,6 @@ void Test::testFdo51034()
void Test::testMathAccents()
{
- roundtrip( "math-accents.docx" );
CHECK_FORMULA(
"acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} widetilde {a}"
" widehat {a} dot {a} widevec {a} widevec {a} widetilde {a} underline {a}",
@@ -235,7 +244,6 @@ void Test::testMathAccents()
void Test::testMathD()
{
- roundtrip( "math-d.docx" );
CHECK_FORMULA( "left (x mline y mline z right )", getFormula( getRun( getParagraph( 1 ), 1 )));
CHECK_FORMULA( "left (1 right )", getFormula( getRun( getParagraph( 1 ), 2 )));
CHECK_FORMULA( "left [2 right ]", getFormula( getRun( getParagraph( 1 ), 3 )));
@@ -249,31 +257,26 @@ void Test::testMathD()
void Test::testMathEscaping()
{
- roundtrip( "math-escaping.docx" );
CHECK_FORMULA( "− ∞ < x < ∞", getFormula( getRun( getParagraph( 1 ), 1 )));
}
void Test::testMathLim()
{
- roundtrip( "math-lim.docx" );
CHECK_FORMULA( "lim from {x → 1} {x}", getFormula( getRun( getParagraph( 1 ), 1 )));
}
void Test::testMathMalformedXml()
{
- roundtrip( "math-malformed_xml.docx" );
CPPUNIT_ASSERT_EQUAL( 0, getLength());
}
void Test::testMathMatrix()
{
- roundtrip( "math-matrix.docx" );
CHECK_FORMULA( "left [matrix {1 # 2 ## 3 # 4} right ]", getFormula( getRun( getParagraph( 1 ), 1 )));
}
void Test::testMathMso2k7()
{
- roundtrip( "math-mso2k7.docx" );
CHECK_FORMULA( "A = π {r} ^ {2}", getFormula( getRun( getParagraph( 1 ), 1 )));
// TODO check the stack/binom difference
// CHECK_FORMULA( "{left (x+a right )} ^ {n} = sum from {k=0} to {n} {left (binom {n} {k} right ) {x} ^ {k} {a} ^ {n-k}}",
@@ -305,7 +308,6 @@ void Test::testMathMso2k7()
void Test::testMathNary()
{
- roundtrip( "math-nary.docx" );
CHECK_FORMULA( "lllint from {1} to {2} {x + 1}", getFormula( getRun( getParagraph( 1 ), 1 )));
CHECK_FORMULA( "prod from {a} {b}", getFormula( getRun( getParagraph( 1 ), 2 )));
CHECK_FORMULA( "sum to {2} {x}", getFormula( getRun( getParagraph( 1 ), 3 )));
@@ -313,33 +315,28 @@ void Test::testMathNary()
void Test::testMathOverbraceUnderbrace()
{
- roundtrip( "math-overbrace_underbrace.docx" );
CHECK_FORMULA( "{abcd} overbrace {4}", getFormula( getRun( getParagraph( 1 ), 1 )));
CHECK_FORMULA( "{xyz} underbrace {3}", getFormula( getRun( getParagraph( 2 ), 1 )));
}
void Test::testMathOverstrike()
{
- roundtrip( "math-overstrike.docx" );
CHECK_FORMULA( "overstrike {abc}", getFormula( getRun( getParagraph( 1 ), 1 )));
}
void Test::testMathPlaceholders()
{
- roundtrip( "math-placeholders.docx" );
CHECK_FORMULA( "sum from <?> to <?> <?>", getFormula( getRun( getParagraph( 1 ), 1 )));
}
void Test::testMathRad()
{
- roundtrip( "math-rad.docx" );
CHECK_FORMULA( "sqrt {4}", getFormula( getRun( getParagraph( 1 ), 1 )));
CHECK_FORMULA( "nroot {3} {x + 1}", getFormula( getRun( getParagraph( 1 ), 2 )));
}
void Test::testMathSubscripts()
{
- roundtrip( "math-subscripts.docx" );
CHECK_FORMULA( "{x} ^ {y} + {e} ^ {x}", getFormula( getRun( getParagraph( 1 ), 1 )));
CHECK_FORMULA( "{x} ^ {b}", getFormula( getRun( getParagraph( 1 ), 2 )));
CHECK_FORMULA( "{x} rsub {b}", getFormula( getRun( getParagraph( 1 ), 3 )));
@@ -351,7 +348,6 @@ void Test::testMathSubscripts()
void Test::testMathVerticalStacks()
{
- roundtrip( "math-vertical_stacks.docx" );
CHECK_FORMULA( "{a} over {b}", getFormula( getRun( getParagraph( 1 ), 1 )));
CHECK_FORMULA( "{a} / {b}", getFormula( getRun( getParagraph( 2 ), 1 )));
// TODO check these
@@ -364,7 +360,6 @@ void Test::testTablePosition()
// This is the reverse test of n779957 from ooxmlimport
// We want to verify that a full round-trip does not break formatting
// Of course if import code is wrong, this tests will fail regardless of export code.
- roundtrip( "../../ooxmlimport/data/n779957.docx" );
sal_Int32 xCoordsFromOffice[] = { 2500, -1000, 0, 0 };
sal_Int32 cellLeftMarginFromOffice[] = { 250, 100, 0, 0 };
@@ -401,8 +396,6 @@ void Test::testTablePosition()
void Test::testFdo47669()
{
- roundtrip("fdo47669.docx");
-
/*
* Problem: we created imbalance </w:hyperlink> which shouldn't be there,
* resulting in loading error: missing last character of hyperlink text
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index af4b50cdc59f..2300c9959ece 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -69,56 +69,77 @@ public:
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
- CPPUNIT_TEST(testZoom);
- CPPUNIT_TEST(testFdo38176);
- CPPUNIT_TEST(testFdo49683);
- CPPUNIT_TEST(testFdo44174);
- CPPUNIT_TEST(testFdo50087);
- CPPUNIT_TEST(testFdo50831);
- CPPUNIT_TEST(testFdo48335);
- CPPUNIT_TEST(testFdo38244);
- CPPUNIT_TEST(testMathAccents);
- CPPUNIT_TEST(testMathEqarray);
- CPPUNIT_TEST(testMathD);
- CPPUNIT_TEST(testMathEscaping);
- CPPUNIT_TEST(testMathLim);
- CPPUNIT_TEST(testMathMatrix);
- CPPUNIT_TEST(testMathBox);
- CPPUNIT_TEST(testMathMso2007);
- CPPUNIT_TEST(testMathNary);
- CPPUNIT_TEST(testMathLimupp);
- CPPUNIT_TEST(testMathStrikeh);
- CPPUNIT_TEST(testMathPlaceholders);
- CPPUNIT_TEST(testMathRad);
- CPPUNIT_TEST(testMathSepchr);
- CPPUNIT_TEST(testMathSubscripts);
- CPPUNIT_TEST(testMathVerticalstacks);
- CPPUNIT_TEST(testMathRuns);
- CPPUNIT_TEST(testFdo53113);
+ 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/rtfexport/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("Rich Text Format");
- utl::TempFile aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aArgs);
- mxComponent = loadFromDesktop(aTempFile.GetURL());
+ MethodEntry<Test> aMethods[] = {
+ {"zoom.rtf", &Test::testZoom},
+ {"fdo38176.rtf", &Test::testFdo38176},
+ {"fdo49683.rtf", &Test::testFdo49683},
+ {"fdo44174.rtf", &Test::testFdo44174},
+ {"fdo50087.rtf", &Test::testFdo50087},
+ {"fdo50831.rtf", &Test::testFdo50831},
+ {"fdo48335.odt", &Test::testFdo48335},
+ {"fdo38244.rtf", &Test::testFdo38244},
+ {"math-accents.rtf", &Test::testMathAccents},
+ {"math-eqarray.rtf", &Test::testMathEqarray},
+ {"math-d.rtf", &Test::testMathD},
+ {"math-escaping.rtf", &Test::testMathEscaping},
+ {"math-lim.rtf", &Test::testMathLim},
+ {"math-matrix.rtf", &Test::testMathMatrix},
+ {"math-mbox.rtf", &Test::testMathBox},
+ {"math-mso2007.rtf", &Test::testMathMso2007},
+ {"math-nary.rtf", &Test::testMathNary},
+ {"math-limupp.rtf", &Test::testMathLimupp},
+ {"math-strikeh.rtf", &Test::testMathStrikeh},
+ {"math-placeholders.rtf", &Test::testMathPlaceholders},
+ {"math-rad.rtf", &Test::testMathRad},
+ {"math-sepchr.rtf", &Test::testMathSepchr},
+ {"math-subscripts.rtf", &Test::testMathSubscripts},
+ {"math-vertical-stacks.rtf", &Test::testMathVerticalstacks},
+ {"math-runs.rtf", &Test::testMathRuns},
+ {"fdo53113.odt", &Test::testFdo53113},
+ };
+ // Don't test the first import of these, for some reason those tests fail
+ const char* aBlacklist[] = {
+ "math-eqarray.rtf",
+ "math-escaping.rtf",
+ "math-lim.rtf",
+ "math-mso2007.rtf",
+ "math-nary.rtf",
+ "math-rad.rtf",
+ "math-vertical-stacks.rtf",
+ "math-runs.rtf",
+ };
+ std::vector<const char*> vBlacklist(aBlacklist, aBlacklist + SAL_N_ELEMENTS(aBlacklist));
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
+ {
+ MethodEntry<Test>& rEntry = aMethods[i];
+ mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/rtfexport/data/") + OUString::createFromAscii(rEntry.pName));
+ // If the testcase is stored in some other format, it's pointless to test.
+ if (OString(rEntry.pName).endsWith(".rtf") && std::find(vBlacklist.begin(), vBlacklist.end(), rEntry.pName) == vBlacklist.end())
+ (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("Rich Text Format");
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aArgs);
+ mxComponent = loadFromDesktop(aTempFile.GetURL());
+ (this->*rEntry.pMethod)();
+ }
}
void Test::testZoom()
{
- roundtrip("zoom.rtf");
-
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xViewSettingsSupplier->getViewSettings());
@@ -129,14 +150,11 @@ void Test::testZoom()
void Test::testFdo38176()
{
- roundtrip("fdo38176.rtf");
CPPUNIT_ASSERT_EQUAL(9, getLength());
}
void Test::testFdo49683()
{
- roundtrip("fdo49683.rtf");
-
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties());
uno::Sequence<OUString> aKeywords(xDocumentProperties->getKeywords());
@@ -147,8 +165,6 @@ void Test::testFdo49683()
void Test::testFdo44174()
{
- roundtrip("fdo44174.rtf");
-
uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
uno::Reference<text::XTextViewCursorSupplier> xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY);
@@ -159,8 +175,6 @@ void Test::testFdo44174()
void Test::testFdo50087()
{
- roundtrip("fdo50087.rtf");
-
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<document::XDocumentProperties> xDocumentProperties(xDocumentPropertiesSupplier->getDocumentProperties());
CPPUNIT_ASSERT_EQUAL(OUString("Title"), xDocumentProperties->getTitle());
@@ -170,8 +184,6 @@ void Test::testFdo50087()
void Test::testFdo50831()
{
- roundtrip("fdo50831.rtf");
-
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
@@ -194,8 +206,6 @@ void Test::testFdo48335()
* oRun = oRuns.nextElement
* xray oRun.TextPortionType 'was Text, should be SoftPageBreak
*/
- roundtrip("fdo48335.odt");
-
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
@@ -212,8 +222,6 @@ void Test::testFdo48335()
void Test::testFdo38244()
{
// See ooxmlexport's testFdo38244().
- roundtrip("fdo38244.rtf");
-
// Test comment range feature.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
@@ -237,7 +245,6 @@ void Test::testFdo38244()
void Test::testMathAccents()
{
- roundtrip("math-accents.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("acute {a} grave {a} check {a} breve {a} circle {a} widevec {a} widetilde {a} widehat {a} dot {a} widevec {a} widevec {a} widetilde {a} underline {a}");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -245,7 +252,6 @@ void Test::testMathAccents()
void Test::testMathEqarray()
{
- roundtrip("math-eqarray.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("y = left lbrace stack { 0, x < 0 # 1, x = 0 # {x} ^ {2} , x > 0 } right none");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -253,7 +259,6 @@ void Test::testMathEqarray()
void Test::testMathD()
{
- roundtrip("math-d.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("left (x mline y mline z right ) left (1 right ) left [2 right ] left ldbracket 3 right rdbracket left lline 4 right rline left ldline 5 right rdline left langle 6 right rangle left langle a mline b right rangle left ({x} over {y} right )");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -261,7 +266,6 @@ void Test::testMathD()
void Test::testMathEscaping()
{
- roundtrip("math-escaping.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("á \\{", 5, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -269,7 +273,6 @@ void Test::testMathEscaping()
void Test::testMathLim()
{
- roundtrip("math-lim.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("lim from {x → 1} {x}", 22, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -277,7 +280,6 @@ void Test::testMathLim()
void Test::testMathMatrix()
{
- roundtrip("math-matrix.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("left [matrix {1 # 2 ## 3 # 4} right ]");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -285,7 +287,6 @@ void Test::testMathMatrix()
void Test::testMathBox()
{
- roundtrip("math-mbox.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("a");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -293,7 +294,6 @@ void Test::testMathBox()
void Test::testMathMso2007()
{
- roundtrip("math-mso2007.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("A = π {r} ^ {2}", 16, RTL_TEXTENCODING_UTF8);
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -334,7 +334,6 @@ void Test::testMathMso2007()
void Test::testMathNary()
{
- roundtrip("math-nary.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("lllint from {1} to {2} {x + 1} prod from {a} {b} sum to {2} {x}");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -342,7 +341,6 @@ void Test::testMathNary()
void Test::testMathLimupp()
{
- roundtrip("math-limupp.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
CPPUNIT_ASSERT_EQUAL(OUString("{abcd} overbrace {4}"), aActual);
@@ -352,35 +350,30 @@ void Test::testMathLimupp()
void Test::testMathStrikeh()
{
- roundtrip("math-strikeh.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
CPPUNIT_ASSERT_EQUAL(OUString("overstrike {abc}"), aActual);
}
void Test::testMathPlaceholders()
{
- roundtrip("math-placeholders.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
CPPUNIT_ASSERT_EQUAL(OUString("sum from <?> to <?> <?>"), aActual);
}
void Test::testMathRad()
{
- roundtrip("math-rad.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
CPPUNIT_ASSERT_EQUAL(OUString("sqrt {4} nroot {3} {x + 1}"), aActual);
}
void Test::testMathSepchr()
{
- roundtrip("math-sepchr.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
CPPUNIT_ASSERT_EQUAL(OUString("AxByBzC"), aActual);
}
void Test::testMathSubscripts()
{
- roundtrip("math-subscripts.rtf");
OUString aActual = getFormula(getRun(getParagraph(1), 1));
OUString aExpected("{x} ^ {y} + {e} ^ {x} {x} ^ {b} {x} rsub {b} {a} rsub {c} rsup {b} {x} lsub {2} lsup {1} {{x csup {6} csub {3}} lsub {4} lsup {5}} rsub {2} rsup {1}");
CPPUNIT_ASSERT_EQUAL(aExpected, aActual);
@@ -388,7 +381,6 @@ void Test::testMathSubscripts()
void Test::testMathVerticalstacks()
{
- roundtrip("math-vertical-stacks.rtf");
CPPUNIT_ASSERT_EQUAL(OUString("{a} over {b}"), getFormula(getRun(getParagraph(1), 1)));
CPPUNIT_ASSERT_EQUAL(OUString("{a} / {b}"), getFormula(getRun(getParagraph(2), 1)));
CPPUNIT_ASSERT_EQUAL(OUString("stack { a # b }"), getFormula(getRun(getParagraph(3), 1)));
@@ -397,7 +389,6 @@ void Test::testMathVerticalstacks()
void Test::testMathRuns()
{
- roundtrip("math-runs.rtf");
// was [](){}, i.e. first curly bracket had an incorrect position
CPPUNIT_ASSERT_EQUAL(OUString("\\{ left [ right ] left ( right ) \\}"), getFormula(getRun(getParagraph(1), 1)));
}
@@ -414,7 +405,6 @@ void Test::testFdo53113()
* xray oCoordinates(1).Second.Value ' 102
*/
- roundtrip("fdo53113.odt");
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(xDraws->getByIndex(0), "CustomShapeGeometry");
diff --git a/sw/qa/extras/swmodeltestbase.hxx b/sw/qa/extras/swmodeltestbase.hxx
index e4e2a9b7cb0d..2a7f4d68c7b2 100644
--- a/sw/qa/extras/swmodeltestbase.hxx
+++ b/sw/qa/extras/swmodeltestbase.hxx
@@ -226,6 +226,13 @@ protected:
uno::Reference<lang::XComponent> mxComponent;
xmlBufferPtr mpXmlBuffer;
+
+ template< typename T >
+ struct MethodEntry
+ {
+ const char* pName;
+ void (T::*pMethod)();
+ };
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index 470028cd9635..de2c80db6e80 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -45,28 +45,39 @@ public:
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
- CPPUNIT_TEST(testN325936);
- CPPUNIT_TEST(testFdo45724);
- CPPUNIT_TEST(testFdo46020);
- 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/ww8export/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("MS Word 97");
- utl::TempFile aTempFile;
- aTempFile.EnableKillingFile();
- xStorable->storeToURL(aTempFile.GetURL(), aArgs);
- mxComponent = loadFromDesktop(aTempFile.GetURL());
+ MethodEntry<Test> aMethods[] = {
+ {"n325936.doc", &Test::testN325936},
+ {"fdo45724.odt", &Test::testFdo45724},
+ {"fdo46020.odt", &Test::testFdo46020},
+ {"first-header-footer.doc", &Test::testFirstHeaderFooter},
+ };
+ for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
+ {
+ MethodEntry<Test>& rEntry = aMethods[i];
+ mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ww8export/data/") + OUString::createFromAscii(rEntry.pName));
+ // If the testcase is stored in some other format, it's pointless to test.
+ if (OString(rEntry.pName).endsWith(".doc"))
+ (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("MS Word 97");
+ utl::TempFile aTempFile;
+ aTempFile.EnableKillingFile();
+ xStorable->storeToURL(aTempFile.GetURL(), aArgs);
+ mxComponent = loadFromDesktop(aTempFile.GetURL());
+ (this->*rEntry.pMethod)();
+ }
}
void Test::testN325936()
@@ -78,7 +89,6 @@ void Test::testN325936()
* xray ThisComponent.DrawPage(0).BackColorTransparency
*/
- roundtrip("n325936.doc");
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY);
@@ -88,7 +98,6 @@ void Test::testN325936()
void Test::testFdo45724()
{
- roundtrip("fdo45724.odt");
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
uno::Reference<drawing::XControlShape> xControlShape(xDraws->getByIndex(0), uno::UNO_QUERY);
@@ -100,7 +109,6 @@ void Test::testFdo45724()
void Test::testFdo46020()
{
// The footnote in that document wasn't exported, check that it is actually exported
- roundtrip("fdo46020.odt");
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xFootnotes->getCount());
@@ -109,7 +117,6 @@ void Test::testFdo46020()
void Test::testFirstHeaderFooter()
{
// Test import and export of a section's headerf/footerf properties.
- roundtrip("first-header-footer.doc");
// The document has 6 pages. Note that we don't test if 4 or just 2 page
// styles are created, the point is that layout should be correct.