Kaydet (Commit) 9b53538a authored tarafından Miklos Vajna's avatar Miklos Vajna

sw: rework import tests to match the syntax of export tests

As a side-effect, this reduces the length of the code as well.

Change-Id: I83da39968ab7629548dd3c469ea8e648c4574653
üst ffcaa765
......@@ -42,32 +42,37 @@ public:
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testEmptySvgFamilyName);
CPPUNIT_TEST(testHideAllSections);
CPPUNIT_TEST(testOdtBorders);
CPPUNIT_TEST(run);
#endif
CPPUNIT_TEST_SUITE_END();
private:
/// Load an ODF file and make the document available via mxComponent.
void load(const OUString& rURL);
void run();
};
void Test::load(const OUString& rFilename)
void Test::run()
{
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfimport/data/") + rFilename);
MethodEntry<Test> aMethods[] = {
{"empty-svg-family-name.odt", &Test::testEmptySvgFamilyName},
{"fdo53210.odt", &Test::testHideAllSections},
{"borders_ooo33.odt", &Test::testOdtBorders},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
MethodEntry<Test>& rEntry = aMethods[i];
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/odfimport/data/") + OUString::createFromAscii(rEntry.pName));
(this->*rEntry.pMethod)();
}
}
void Test::testEmptySvgFamilyName()
{
// .odt import did crash on the empty font list (which I think is valid according SVG spec)
load( "empty-svg-family-name.odt" );
}
void Test::testHideAllSections()
{
// This document has a section that is conditionally hidden, but has no empty paragraph after it.
load("fdo53210.odt");
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XNameAccess> xMasters = xTextFieldsSupplier->getTextFieldMasters();
// Set _CS_Allgemein to 0
......@@ -79,7 +84,6 @@ void Test::testHideAllSections()
void Test::testOdtBorders()
{
load("borders_ooo33.odt");
AllBordersMap map;
uno::Sequence< table::BorderLine > tempSequence(4);
......
......@@ -50,30 +50,35 @@ public:
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(testN757910);
CPPUNIT_TEST(testN760294);
CPPUNIT_TEST(testN750255);
CPPUNIT_TEST(testN652364);
CPPUNIT_TEST(testN757118);
CPPUNIT_TEST(testN757905);
CPPUNIT_TEST(testAllGapsWord);
CPPUNIT_TEST(run);
#endif
CPPUNIT_TEST_SUITE_END();
private:
/// Load a WW8 file and make the document available via mxComponent.
void load(const OUString& rURL);
void run();
};
void Test::load(const OUString& rFilename)
void Test::run()
{
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ww8import/data/") + rFilename);
MethodEntry<Test> aMethods[] = {
{"n757910.doc", &Test::testN757910},
{"n760294.doc", &Test::testN760294},
{"n750255.doc", &Test::testN750255},
{"n652364.doc", &Test::testN652364},
{"n757118.doc", &Test::testN757118},
{"n757905.doc", &Test::testN757905},
{"all_gaps_word.doc", &Test::testAllGapsWord},
};
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
MethodEntry<Test>& rEntry = aMethods[i];
mxComponent = loadFromDesktop(getURLFromSrc("/sw/qa/extras/ww8import/data/") + OUString::createFromAscii(rEntry.pName));
(this->*rEntry.pMethod)();
}
}
void Test::testN757910()
{
load("n757910.doc");
// The internal margin was larger than 0.28cm
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
......@@ -90,8 +95,6 @@ void Test::testN757910()
void Test::testN760294()
{
load("n760294.doc");
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xTable(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
......@@ -103,8 +106,6 @@ void Test::testN760294()
void Test::testN750255()
{
load( "n750255.doc" );
/*
Column break without columns on the page is a page break, so check those paragraphs
are on page 2 (page style 'Convert 1') and page 3 (page style 'Convert 2')
......@@ -142,8 +143,6 @@ xray para2.PageStyleName
void Test::testN652364()
{
load( "n652364.doc" );
/*
Related to 750255 above, column break with columns on the page however should be a column break.
enum = ThisComponent.Text.createEnumeration
......@@ -181,7 +180,6 @@ xray para2.PageStyleName
void Test::testN757118()
{
load( "n757118.doc" );
/*
Two pairs of horizontal rules (one absolute width, one relative width)
have the same width (full page width, half page width).
......@@ -216,15 +214,12 @@ void Test::testN757905()
// paragraph height. When in Word-compat mode, we should take the max of
// the two, not just the height of the fly.
load("n757905.doc");
OUString aHeight = parseDump("/root/page/body/txt/infos/bounds", "height");
CPPUNIT_ASSERT(sal_Int32(31) < aHeight.toInt32());
}
void Test::testAllGapsWord()
{
load("all_gaps_word.doc");
BorderTest borderTest;
borderTest.testTheBorders(mxComponent);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment