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

Make CppunitTest_sw_rtfimport use DECLARE_SW_IMPORT_TEST()

Change-Id: I670e0460f15951f99f0f750d2798c771f64c3095
üst 0ae2fe26
......@@ -123,7 +123,9 @@ protected:
if (mustTestImportOf(filename))
{
header();
preTest(filename);
load(mpTestDocumentPath, filename);
postTest(filename);
verify();
finish();
}
......@@ -158,6 +160,19 @@ protected:
{
return true;
}
/**
* Override this function if some special filename-specific setup is needed
*/
virtual void preTest(const char* /*filename*/)
{
}
/**
* Override this function if some special filename-specific teardown is needed
*/
virtual void postTest(const char* /*filename*/)
{
}
private:
void dumpLayout()
......
......@@ -6,6 +6,10 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include <swmodeltestbase.hxx>
#if !defined(MACOSX) && !defined(WNT)
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/document/XFilter.hpp>
#include <com/sun/star/document/XImporter.hpp>
......@@ -45,7 +49,6 @@
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/streamwrap.hxx>
#include <swmodeltestbase.hxx>
#include <bordertest.hxx>
#define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L))
......@@ -53,130 +56,34 @@
class Test : public SwModelTestBase
{
public:
void testFdo45553();
void testN192129();
void testFdo45543();
void testN695479();
void testFdo42465();
void testFdo45187();
void testFdo46662();
void testN750757();
void testFdo45563();
void testFdo43965();
void testN751020();
void testFdo47326();
void testFdo47036();
void testFdo46955();
void testFdo45394();
void testFdo48104();
void testFdo47107();
void testFdo45182();
void testFdo44176();
void testFdo39053();
void testFdo48356();
void testFdo48023();
void testFdo48876();
void testFdo48193();
void testFdo44211();
void testFdo48037();
void testFdo47764();
void testFdo38786();
void testN757651();
void testFdo49501();
void testFdo49271();
void testFdo49692();
void testFdo45190();
void testFdo50539();
void testFdo50665();
void testFdo49659();
void testFdo46966();
void testFdo52066();
void testFdo48033_53594();
void testFdo36089();
void testFdo49892();
void testFdo48446();
void testFdo47495();
void testAllGapsWord();
void testFdo52052();
void testInk();
void testFdo52389();
void testFdo49655_62805();
void testFdo52475();
void testFdo55493();
void testCopyPastePageStyle();
void testCopyPasteFootnote();
void testShptxtPard();
void testDoDhgt();
void testDplinehollow();
void testLeftmarginDefault();
void testDppolyline();
void testFdo56512();
void testFdo52989();
void testFdo48442();
void testFdo55525();
void testFdo57708();
void testFdo54473();
void testFdo49934();
void testFdo57886();
void testFdo58076();
void testFdo57678();
void testFdo45183();
void testFdo54612();
void testFdo58933();
void testFdo44053();
void testFdo48440();
void testFdo58646line();
void testFdo58646();
void testFdo59419();
void testFdo58076_2();
void testFdo59953();
void testFdo59638();
void testFdo60722();
void testFdo61909();
void testFdo62288();
void testFdo37716();
void testFdo51916();
void testFdo61193();
void testFdo63023();
void testFdo42109();
void testFdo62977();
void testN818997();
void testFdo64671();
void testPageBackground();
void testFdo62044();
void testPoshPosv();
void testN825305();
void testParaBottomMargin();
void testN823655();
void testFdo66040();
void testN823675();
void testFdo47802();
void testFdo39001();
void testGroupshape();
void testFdo66565();
void testFdo54900();
void testFdo64637();
void testN820504();
void testFdo67365();
void testFdo67498();
void testFdo47440();
void testFdo53556();
void testFdo63428();
void testGroupshapeRotation();
void testFdo44715();
void testFdo68076();
void testFdo68291();
void testFdo69384();
void testFdo70221();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
CPPUNIT_TEST(run);
#endif
CPPUNIT_TEST_SUITE_END();
Test() : SwModelTestBase("/sw/qa/extras/rtfimport/data/", "Rich Text Format")
{
}
virtual void preTest(const char* filename) SAL_OVERRIDE
{
m_aSavedSettings = Application::GetSettings();
if (OString(filename) == "fdo48023.rtf")
{
AllSettings aSettings(m_aSavedSettings);
aSettings.SetLanguageTag(LanguageTag("ru"));
Application::SetSettings(aSettings);
}
else if (OString(filename) == "fdo44211.rtf")
{
AllSettings aSettings(m_aSavedSettings);
aSettings.SetLanguageTag(LanguageTag("lt"));
Application::SetSettings(aSettings);
}
}
private:
void run();
virtual void postTest(const char* filename) SAL_OVERRIDE
{
if (OString(filename) == "fdo48023.rtf" || OString(filename) == "fdo44211.rtf")
Application::SetSettings(m_aSavedSettings);
}
protected:
/// Copy&paste helper.
void paste(OUString aFilename, uno::Reference<text::XTextRange> xTextRange = uno::Reference<text::XTextRange>())
{
......@@ -198,156 +105,12 @@ private:
xFilter->filter(aDescriptor);
}
AllSettings m_aSavedSettings;
};
void Test::run()
{
MethodEntry<Test> aMethods[] = {
{"fdo45553.rtf", &Test::testFdo45553},
{"n192129.rtf", &Test::testN192129},
{"fdo45543.rtf", &Test::testFdo45543},
{"n695479.rtf", &Test::testN695479},
{"fdo42465.rtf", &Test::testFdo42465},
{"fdo45187.rtf", &Test::testFdo45187},
{"fdo46662.rtf", &Test::testFdo46662},
{"n750757.rtf", &Test::testN750757},
{"fdo45563.rtf", &Test::testFdo45563},
{"fdo43965.rtf", &Test::testFdo43965},
{"n751020.rtf", &Test::testN751020},
{"fdo47326.rtf", &Test::testFdo47326},
{"fdo47036.rtf", &Test::testFdo47036},
{"fdo46955.rtf", &Test::testFdo46955},
{"fdo45394.rtf", &Test::testFdo45394},
{"fdo48104.rtf", &Test::testFdo48104},
{"fdo47107.rtf", &Test::testFdo47107},
{"fdo45182.rtf", &Test::testFdo45182},
{"fdo44176.rtf", &Test::testFdo44176},
{"fdo39053.rtf", &Test::testFdo39053},
{"fdo48356.rtf", &Test::testFdo48356},
{"fdo48023.rtf", &Test::testFdo48023},
{"fdo48876.rtf", &Test::testFdo48876},
{"fdo48193.rtf", &Test::testFdo48193},
{"fdo44211.rtf", &Test::testFdo44211},
{"fdo48037.rtf", &Test::testFdo48037},
{"fdo47764.rtf", &Test::testFdo47764},
{"fdo38786.rtf", &Test::testFdo38786},
{"n757651.rtf", &Test::testN757651},
{"fdo49501.rtf", &Test::testFdo49501},
{"fdo49271.rtf", &Test::testFdo49271},
{"fdo49692.rtf", &Test::testFdo49692},
{"fdo45190.rtf", &Test::testFdo45190},
{"fdo50539.rtf", &Test::testFdo50539},
{"fdo50665.rtf", &Test::testFdo50665},
{"fdo49659.rtf", &Test::testFdo49659},
{"fdo46966.rtf", &Test::testFdo46966},
{"fdo52066.rtf", &Test::testFdo52066},
{"fdo48033.rtf", &Test::testFdo48033_53594},
{"fdo53594.rtf", &Test::testFdo48033_53594},
{"fdo36089.rtf", &Test::testFdo36089},
{"fdo49892.rtf", &Test::testFdo49892},
{"fdo48446.rtf", &Test::testFdo48446},
{"fdo47495.rtf", &Test::testFdo47495},
{"all_gaps_word.rtf", &Test::testAllGapsWord},
{"fdo52052.rtf", &Test::testFdo52052},
{"ink.rtf", &Test::testInk},
{"fdo52389.rtf", &Test::testFdo52389},
{"fdo49655.rtf", &Test::testFdo49655_62805},
{"fdo62805.rtf", &Test::testFdo49655_62805},
{"fdo52475.rtf", &Test::testFdo52475},
{"fdo55493.rtf", &Test::testFdo55493},
{"copypaste-pagestyle.rtf", &Test::testCopyPastePageStyle},
{"copypaste-footnote.rtf", &Test::testCopyPasteFootnote},
{"shptxt-pard.rtf", &Test::testShptxtPard},
{"do-dhgt.rtf", &Test::testDoDhgt},
{"dplinehollow.rtf", &Test::testDplinehollow},
{"leftmargin-default.rtf", &Test::testLeftmarginDefault},
{"dppolyline.rtf", &Test::testDppolyline},
{"fdo56512.rtf", &Test::testFdo56512},
{"fdo52989.rtf", &Test::testFdo52989},
{"fdo48442.rtf", &Test::testFdo48442},
{"fdo55525.rtf", &Test::testFdo55525},
{"fdo57708.rtf", &Test::testFdo57708},
{"fdo54473.rtf", &Test::testFdo54473},
{"fdo49934.rtf", &Test::testFdo49934},
{"fdo57886.rtf", &Test::testFdo57886},
{"fdo58076.rtf", &Test::testFdo58076},
{"fdo57678.rtf", &Test::testFdo57678},
{"fdo45183.rtf", &Test::testFdo45183},
{"fdo54612.rtf", &Test::testFdo54612},
{"fdo58933.rtf", &Test::testFdo58933},
{"fdo44053.rtf", &Test::testFdo44053},
{"fdo48440.rtf", &Test::testFdo48440},
{"fdo58646line.rtf", &Test::testFdo58646line},
{"fdo58646.rtf", &Test::testFdo58646},
{"fdo59419.rtf", &Test::testFdo59419},
{"fdo58076-2.rtf", &Test::testFdo58076_2},
{"fdo59953.rtf", &Test::testFdo59953},
{"fdo59638.rtf", &Test::testFdo59638},
{"fdo60722.rtf", &Test::testFdo60722},
{"fdo61909.rtf", &Test::testFdo61909},
{"fdo62288.rtf", &Test::testFdo62288},
{"fdo37716.rtf", &Test::testFdo37716},
{"fdo51916.rtf", &Test::testFdo51916},
{"hello.rtf", &Test::testFdo61193},
{"fdo63023.rtf", &Test::testFdo63023},
{"fdo42109.rtf", &Test::testFdo42109},
{"fdo62977.rtf", &Test::testFdo62977},
{"n818997.rtf", &Test::testN818997},
{"fdo64671.rtf", &Test::testFdo64671},
{"page-background.rtf", &Test::testPageBackground},
{"fdo62044.rtf", &Test::testFdo62044},
{"posh-posv.rtf", &Test::testPoshPosv},
{"n825305.rtf", &Test::testN825305},
{"para-bottom-margin.rtf", &Test::testParaBottomMargin},
{"n823655.rtf", &Test::testN823655},
{"fdo66040.rtf", &Test::testFdo66040},
{"n823675.rtf", &Test::testN823675},
{"fdo47802.rtf", &Test::testFdo47802},
{"fdo39001.rtf", &Test::testFdo39001},
{"groupshape.rtf", &Test::testGroupshape},
{"groupshape-notext.rtf", &Test::testGroupshape},
{"fdo66565.rtf", &Test::testFdo66565},
{"fdo54900.rtf", &Test::testFdo54900},
{"fdo64637.rtf", &Test::testFdo64637},
{"n820504.rtf", &Test::testN820504},
{"fdo67365.rtf", &Test::testFdo67365},
{"fdo67498.rtf", &Test::testFdo67498},
{"fdo47440.rtf", &Test::testFdo47440},
{"fdo53556.rtf", &Test::testFdo53556},
{"hello.rtf", &Test::testFdo63428},
{"groupshape-rotation.rtf", &Test::testGroupshapeRotation},
{"fdo44715.rtf", &Test::testFdo44715},
{"fdo68076.rtf", &Test::testFdo68076},
{"fdo68291.odt", &Test::testFdo68291},
{"hello.rtf", &Test::testFdo69384},
{"fdo70221.rtf", &Test::testFdo70221},
};
header();
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{
MethodEntry<Test>& rEntry = aMethods[i];
AllSettings aSavedSettings(Application::GetSettings());
if (OString(rEntry.pName) == "fdo48023.rtf")
{
AllSettings aSettings(aSavedSettings);
aSettings.SetLanguageTag(LanguageTag("ru"));
Application::SetSettings(aSettings);
}
else if (OString(rEntry.pName) == "fdo44211.rtf")
{
AllSettings aSettings(aSavedSettings);
aSettings.SetLanguageTag(LanguageTag("lt"));
Application::SetSettings(aSettings);
}
load("/sw/qa/extras/rtfimport/data/", rEntry.pName);
if (OString(rEntry.pName) == "fdo48023.rtf" || OString(rEntry.pName) == "fdo44211.rtf")
Application::SetSettings(aSavedSettings);
(this->*rEntry.pMethod)();
finish();
}
}
#define DECLARE_RTFIMPORT_TEST(TestName, filename) DECLARE_SW_IMPORT_TEST(TestName, filename, Test)
void Test::testFdo45553()
DECLARE_RTFIMPORT_TEST(testFdo45553, "fdo45553.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -368,7 +131,7 @@ void Test::testFdo45553()
}
}
void Test::testN192129()
DECLARE_RTFIMPORT_TEST(testN192129, "n192129.rtf")
{
// We expect that the result will be 16x16px.
Size aExpectedSize(16, 16);
......@@ -384,12 +147,12 @@ void Test::testN192129()
CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height);
}
void Test::testFdo45543()
DECLARE_RTFIMPORT_TEST(testFdo45543, "fdo45543.rtf")
{
CPPUNIT_ASSERT_EQUAL(5, getLength());
}
void Test::testN695479()
DECLARE_RTFIMPORT_TEST(testN695479, "n695479.rtf")
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
......@@ -431,12 +194,12 @@ void Test::testN695479()
CPPUNIT_ASSERT(bDrawFound);
}
void Test::testFdo42465()
DECLARE_RTFIMPORT_TEST(testFdo42465, "fdo42465.rtf")
{
CPPUNIT_ASSERT_EQUAL(3, getLength());
}
void Test::testFdo45187()
DECLARE_RTFIMPORT_TEST(testFdo45187, "fdo45187.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -452,7 +215,7 @@ void Test::testFdo45187()
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1));
}
void Test::testFdo46662()
DECLARE_RTFIMPORT_TEST(testFdo46662, "fdo46662.rtf")
{
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
......@@ -470,7 +233,7 @@ void Test::testFdo46662()
}
}
void Test::testN750757()
DECLARE_RTFIMPORT_TEST(testN750757, "n750757.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -480,7 +243,7 @@ void Test::testN750757()
CPPUNIT_ASSERT_EQUAL(sal_Bool(true), getProperty<sal_Bool>(xParaEnum->nextElement(), "ParaContextMargin"));
}
void Test::testFdo45563()
DECLARE_RTFIMPORT_TEST(testFdo45563, "fdo45563.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -494,7 +257,7 @@ void Test::testFdo45563()
CPPUNIT_ASSERT_EQUAL(4, i);
}
void Test::testFdo43965()
DECLARE_RTFIMPORT_TEST(testFdo43965, "fdo43965.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -514,7 +277,7 @@ void Test::testFdo43965()
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void Test::testN751020()
DECLARE_RTFIMPORT_TEST(testN751020, "n751020.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -523,13 +286,13 @@ void Test::testN751020()
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin"));
}
void Test::testFdo47326()
DECLARE_RTFIMPORT_TEST(testFdo47326, "fdo47326.rtf")
{
// This was 15 only, as \super buffered text, then the contents of it got lost.
CPPUNIT_ASSERT_EQUAL(19, getLength());
}
void Test::testFdo47036()
DECLARE_RTFIMPORT_TEST(testFdo47036, "fdo47036.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -548,7 +311,7 @@ void Test::testFdo47036()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
}
void Test::testFdo46955()
DECLARE_RTFIMPORT_TEST(testFdo46955, "fdo46955.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -562,7 +325,7 @@ void Test::testFdo46955()
}
}
void Test::testFdo45394()
DECLARE_RTFIMPORT_TEST(testFdo45394, "fdo45394.rtf")
{
uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
OUString aActual = xHeaderText->getString();
......@@ -575,12 +338,12 @@ void Test::testFdo45394()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
void Test::testFdo48104()
DECLARE_RTFIMPORT_TEST(testFdo48104, "fdo48104.rtf")
{
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void Test::testFdo47107()
DECLARE_RTFIMPORT_TEST(testFdo47107, "fdo47107.rtf")
{
uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
// Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
......@@ -588,7 +351,7 @@ void Test::testFdo47107()
xNumberingStyles->getByName("WWNum2");
}
void Test::testFdo45182()
DECLARE_RTFIMPORT_TEST(testFdo45182, "fdo45182.rtf")
{
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY);
......@@ -598,7 +361,7 @@ void Test::testFdo45182()
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
void Test::testFdo44176()
DECLARE_RTFIMPORT_TEST(testFdo44176, "fdo44176.rtf")
{
uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY);
......@@ -610,7 +373,7 @@ void Test::testFdo44176()
CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
}
void Test::testFdo39053()
DECLARE_RTFIMPORT_TEST(testFdo39053, "fdo39053.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -622,7 +385,7 @@ void Test::testFdo39053()
CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
}
void Test::testFdo48356()
DECLARE_RTFIMPORT_TEST(testFdo48356, "fdo48356.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -637,7 +400,7 @@ void Test::testFdo48356()
CPPUNIT_ASSERT_EQUAL(1, i);
}
void Test::testFdo48023()
DECLARE_RTFIMPORT_TEST(testFdo48023, "fdo48023.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
......@@ -646,7 +409,7 @@ void Test::testFdo48023()
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
void Test::testFdo48876()
DECLARE_RTFIMPORT_TEST(testFdo48876, "fdo48876.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -655,12 +418,12 @@ void Test::testFdo48876()
CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode);
}
void Test::testFdo48193()
DECLARE_RTFIMPORT_TEST(testFdo48193, "fdo48193.rtf")
{
CPPUNIT_ASSERT_EQUAL(7, getLength());
}
void Test::testFdo44211()
DECLARE_RTFIMPORT_TEST(testFdo44211, "fdo44211.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
......@@ -668,7 +431,7 @@ void Test::testFdo44211()
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
void Test::testFdo48037()
DECLARE_RTFIMPORT_TEST(testFdo48037, "fdo48037.rtf")
{
uno::Reference<util::XNumberFormatsSupplier> xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW);
lang::Locale aUSLocale, aFRLocale;
......@@ -686,13 +449,13 @@ void Test::testFdo48037()
CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
}
void Test::testFdo47764()
DECLARE_RTFIMPORT_TEST(testFdo47764, "fdo47764.rtf")
{
// \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getParagraph(1), "ParaBackColor"));
}
void Test::testFdo38786()
DECLARE_RTFIMPORT_TEST(testFdo38786, "fdo38786.rtf")
{
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
......@@ -701,14 +464,14 @@ void Test::testFdo38786()
xFields->nextElement();
}
void Test::testN757651()
DECLARE_RTFIMPORT_TEST(testN757651, "n757651.rtf")
{
// The bug was that due to buggy layout the text expanded to two pages.
if (Application::GetDefaultDevice()->IsFontAvailable(OUString("Times New Roman")))
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
void Test::testFdo49501()
DECLARE_RTFIMPORT_TEST(testFdo49501, "fdo49501.rtf")
{
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
......@@ -720,12 +483,12 @@ void Test::testFdo49501()
CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "BottomMargin"));
}
void Test::testFdo49271()
DECLARE_RTFIMPORT_TEST(testFdo49271, "fdo49271.rtf")
{
CPPUNIT_ASSERT_EQUAL(25.f, getProperty<float>(getParagraph(2), "CharHeight"));
}
void Test::testFdo49692()
DECLARE_RTFIMPORT_TEST(testFdo49692, "fdo49692.rtf")
{
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
......@@ -741,7 +504,7 @@ void Test::testFdo49692()
}
}
void Test::testFdo45190()
DECLARE_RTFIMPORT_TEST(testFdo45190, "fdo45190.rtf")
{
// inherited \fi should be reset
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaFirstLineIndent"));
......@@ -750,13 +513,13 @@ void Test::testFdo45190()
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), getProperty<sal_Int32>(getParagraph(2), "ParaFirstLineIndent"));
}
void Test::testFdo50539()
DECLARE_RTFIMPORT_TEST(testFdo50539, "fdo50539.rtf")
{
// \chcbpat with zero argument should mean the auto (-1) color, not a default color (black)
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 1), "CharBackColor"));
}
void Test::testFdo50665()
DECLARE_RTFIMPORT_TEST(testFdo50665, "fdo50665.rtf")
{
// Access the second run, which is a textfield
uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY);
......@@ -764,7 +527,7 @@ void Test::testFdo50665()
CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), getProperty<OUString>(xRun, "CharFontName"));
}
void Test::testFdo49659()
DECLARE_RTFIMPORT_TEST(testFdo49659, "fdo49659.rtf")
{
// Both tables were ignored: 1) was in the header, 2) was ignored due to missing empty par at the end of the doc
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
......@@ -776,7 +539,7 @@ void Test::testFdo49659()
CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty<sal_Int8>(xGraphic, "GraphicType"));
}
void Test::testFdo46966()
DECLARE_RTFIMPORT_TEST(testFdo46966, "fdo46966.rtf")
{
/*
* The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
......@@ -787,7 +550,7 @@ void Test::testFdo46966()
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), getProperty<sal_Int32>(xPropertySet, "TopMargin"));
}
void Test::testFdo52066()
DECLARE_RTFIMPORT_TEST(testFdo52066, "fdo52066.rtf")
{
/*
* The problem was that the height of the shape was too big.
......@@ -798,7 +561,7 @@ void Test::testFdo52066()
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height);
}
void Test::testFdo48033_53594()
DECLARE_RTFIMPORT_TEST(testFdo48033, "fdo48033.rtf")
{
/*
* The problem was that the picture (48033) or OLE object (53594) was in the first cell,
......@@ -821,12 +584,35 @@ void Test::testFdo48033_53594()
CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
}
void Test::testFdo36089()
DECLARE_RTFIMPORT_TEST(testFdo53594, "fdo53594.rtf")
{
/*
* The problem was that the picture (48033) or OLE object (53594) was in the first cell,
* instead of the second one.
*
* oTable = ThisComponent.TextTables(0)
* oParas = oTable.getCellByName("B1").Text.createEnumeration
* oPara = oParas.nextElement
* oRuns = oPara.createEnumeration
* oRun = oRuns.nextElement
* xray oRun.TextPortionType ' Frame, was Text
*/
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
}
DECLARE_RTFIMPORT_TEST(testFdo36089, "fdo36089.rtf")
{
CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement"));
}
void Test::testFdo49892()
DECLARE_RTFIMPORT_TEST(testFdo49892, "fdo49892.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -847,31 +633,31 @@ void Test::testFdo49892()
}
}
void Test::testFdo48446()
DECLARE_RTFIMPORT_TEST(testFdo48446, "fdo48446.rtf")
{
OUString aExpected("\xd0\x98\xd0\xbc\xd1\x8f", 6, RTL_TEXTENCODING_UTF8);
getParagraph(1, aExpected);
}
void Test::testFdo47495()
DECLARE_RTFIMPORT_TEST(testFdo47495, "fdo47495.rtf")
{
// Used to have 4 paragraphs, as a result the original bugdoc had 2 pages instead of 1.
CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
}
void Test::testAllGapsWord()
DECLARE_RTFIMPORT_TEST(testAllGapsWord, "all_gaps_word.rtf")
{
BorderTest borderTest;
borderTest.testTheBorders(mxComponent);
}
void Test::testFdo52052()
DECLARE_RTFIMPORT_TEST(testFdo52052, "fdo52052.rtf")
{
// Make sure the textframe containing the text "third" appears on the 3rd page.
CPPUNIT_ASSERT_EQUAL(OUString("third"), parseDump("/root/page[3]/body/txt/anchored/fly/txt/text()"));
}
void Test::testInk()
DECLARE_RTFIMPORT_TEST(testInk, "ink.rtf")
{
/*
* The problem was that the second segment had wrong command count and wrap type.
......@@ -901,20 +687,28 @@ void Test::testInk()
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(1), "Surround"));
}
void Test::testFdo52389()
DECLARE_RTFIMPORT_TEST(testFdo52389, "fdo52389.rtf")
{
// The last '!' character at the end of the document was lost
CPPUNIT_ASSERT_EQUAL(6, getLength());
}
void Test::testFdo49655_62805()
DECLARE_RTFIMPORT_TEST(testFdo49655, "fdo49655.rtf")
{
/*
* 49655 :
* The problem was that the table was not imported due to the ' ' string in the middle of the table definition.
*
* xray ThisComponent.TextTables.Count 'was 0
*
*/
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
DECLARE_RTFIMPORT_TEST(testFdo62805, "fdo62805.rtf")
{
/*
* 62805 :
* The problem was that the table was not imported due to the absence of \pard after \row.
* The table was instead in a group (the '}' replace the \pard).
......@@ -924,20 +718,20 @@ void Test::testFdo49655_62805()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
void Test::testFdo52475()
DECLARE_RTFIMPORT_TEST(testFdo52475, "fdo52475.rtf")
{
// The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO.
CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty<sal_Int32>(getRun(getParagraph(1), 3), "CharBackColor"));
}
void Test::testFdo55493()
DECLARE_RTFIMPORT_TEST(testFdo55493, "fdo55493.rtf")
{
// The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm
uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
}
void Test::testCopyPastePageStyle()
DECLARE_RTFIMPORT_TEST(testCopyPastePageStyle, "copypaste-pagestyle.rtf")
{
// The problem was that RTF import during copy&paste did not ignore page styles.
// Once we have more copy&paste tests, makes sense to refactor this to some helper method.
......@@ -947,7 +741,7 @@ void Test::testCopyPastePageStyle()
CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
}
void Test::testCopyPasteFootnote()
DECLARE_RTFIMPORT_TEST(testCopyPasteFootnote, "copypaste-footnote.rtf")
{
// The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote.
uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
......@@ -958,7 +752,7 @@ void Test::testCopyPasteFootnote()
CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString());
}
void Test::testFdo61193()
DECLARE_RTFIMPORT_TEST(testFdo61193, "hello.rtf")
{
// Pasting content that contained a footnote caused a crash.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
......@@ -967,14 +761,14 @@ void Test::testFdo61193()
paste("fdo61193.rtf", xEnd);
}
void Test::testShptxtPard()
DECLARE_RTFIMPORT_TEST(testShptxtPard, "shptxt-pard.rtf")
{
// The problem was that \pard inside \shptxt caused loss of shape text
uno::Reference<text::XText> xText(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
}
void Test::testDoDhgt()
DECLARE_RTFIMPORT_TEST(testDoDhgt, "do-dhgt.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -990,19 +784,19 @@ void Test::testDoDhgt()
}
}
void Test::testDplinehollow()
DECLARE_RTFIMPORT_TEST(testDplinehollow, "dplinehollow.rtf")
{
uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty<drawing::LineStyle>(xPropertySet, "LineStyle"));
}
void Test::testLeftmarginDefault()
DECLARE_RTFIMPORT_TEST(testLeftmarginDefault, "leftmargin-default.rtf")
{
// The default left/right margin was incorrect when the top margin was set to zero.
CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin"));
}
void Test::testDppolyline()
DECLARE_RTFIMPORT_TEST(testDppolyline, "dppolyline.rtf")
{
// This was completely ignored, for now, just make sure we have all 4 lines.
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
......@@ -1010,7 +804,7 @@ void Test::testDppolyline()
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
}
void Test::testFdo56512()
DECLARE_RTFIMPORT_TEST(testFdo56512, "fdo56512.rtf")
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
......@@ -1019,21 +813,21 @@ void Test::testFdo56512()
CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString());
}
void Test::testFdo52989()
DECLARE_RTFIMPORT_TEST(testFdo52989, "fdo52989.rtf")
{
// Same as n#192129, but for JPEG files.
uno::Reference<drawing::XShape> xShape(getShape(1), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape->getSize().Width);
}
void Test::testFdo48442()
DECLARE_RTFIMPORT_TEST(testFdo48442, "fdo48442.rtf")
{
// The problem was that \pvmrg is the default in RTF, but not in Writer.
uno::Reference<drawing::XShape> xShape = getShape(1);
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty<sal_Int16>(xShape, "VertOrientRelation")); // was FRAME
}
void Test::testFdo55525()
DECLARE_RTFIMPORT_TEST(testFdo55525, "fdo55525.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1045,7 +839,7 @@ void Test::testFdo55525()
CPPUNIT_ASSERT_EQUAL(sal_Int16(896), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
}
void Test::testFdo57708()
DECLARE_RTFIMPORT_TEST(testFdo57708, "fdo57708.rtf")
{
// There were two issues: the doc was of 2 pages and the picture was missing.
CPPUNIT_ASSERT_EQUAL(1, getPages());
......@@ -1055,26 +849,26 @@ void Test::testFdo57708()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount());
}
void Test::testFdo54473()
DECLARE_RTFIMPORT_TEST(testFdo54473, "fdo54473.rtf")
{
// The problem was that character styles were not imported due to a typo.
CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName"));
CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
}
void Test::testFdo49934()
DECLARE_RTFIMPORT_TEST(testFdo49934, "fdo49934.rtf")
{
// Column break without columns defined should be a page break, but it was just ignored.
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void Test::testFdo57886()
DECLARE_RTFIMPORT_TEST(testFdo57886, "fdo57886.rtf")
{
// Was 'int from <?> to <?> <?>'.
CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), getFormula(getRun(getParagraph(1), 1)));
}
void Test::testFdo58076()
DECLARE_RTFIMPORT_TEST(testFdo58076, "fdo58076.rtf")
{
// An additional section was created, so the default page style didn't have the custom margins.
uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
......@@ -1084,7 +878,7 @@ void Test::testFdo58076()
CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "BottomMargin"));
}
void Test::testFdo57678()
DECLARE_RTFIMPORT_TEST(testFdo57678, "fdo57678.rtf")
{
// Paragraphs of the two tables were not converted to tables.
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
......@@ -1092,7 +886,7 @@ void Test::testFdo57678()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
}
void Test::testFdo45183()
DECLARE_RTFIMPORT_TEST(testFdo45183, "fdo45183.rtf")
{
// Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text.
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty<text::WrapTextMode>(getShape(1), "Surround"));
......@@ -1103,7 +897,7 @@ void Test::testFdo45183()
CPPUNIT_ASSERT_EQUAL(sal_Int32(16237), getProperty<sal_Int32>(xTables->getByIndex(0), "Width"));
}
void Test::testFdo54612()
DECLARE_RTFIMPORT_TEST(testFdo54612, "fdo54612.rtf")
{
// \dpptx without a \dppolycount caused a crash.
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
......@@ -1111,7 +905,7 @@ void Test::testFdo54612()
CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount());
}
void Test::testFdo58933()
DECLARE_RTFIMPORT_TEST(testFdo58933, "fdo58933.rtf")
{
// The problem was that the table had an additional cell in its first line.
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
......@@ -1121,7 +915,7 @@ void Test::testFdo58933()
CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
}
void Test::testFdo44053()
DECLARE_RTFIMPORT_TEST(testFdo44053, "fdo44053.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY);
......@@ -1132,25 +926,25 @@ void Test::testFdo44053()
getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
}
void Test::testFdo48440()
DECLARE_RTFIMPORT_TEST(testFdo48440, "fdo48440.rtf")
{
// Page break was ignored.
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void Test::testFdo58646line()
DECLARE_RTFIMPORT_TEST(testFdo58646line, "fdo58646line.rtf")
{
// \line symbol was ignored
getParagraph(1, "foo\nbar");
}
void Test::testFdo58646()
DECLARE_RTFIMPORT_TEST(testFdo58646, "fdo58646.rtf")
{
// Page break was ignored inside a continous section, on title page.
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void Test::testFdo59419()
DECLARE_RTFIMPORT_TEST(testFdo59419, "fdo59419.rtf")
{
// Junk to be ignored broke import of the table.
uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
......@@ -1158,13 +952,13 @@ void Test::testFdo59419()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
}
void Test::testFdo58076_2()
DECLARE_RTFIMPORT_TEST(testFdo58076_2, "fdo58076-2.rtf")
{
// Position of the picture wasn't correct.
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(8345)), getProperty<sal_Int32>(getShape(1), "HoriOrientPosition"));
}
void Test::testFdo59953()
DECLARE_RTFIMPORT_TEST(testFdo59953, "fdo59953.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1174,7 +968,7 @@ void Test::testFdo59953()
CPPUNIT_ASSERT_EQUAL(sal_Int16(7649), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position);
}
void Test::testFdo59638()
DECLARE_RTFIMPORT_TEST(testFdo59638, "fdo59638.rtf")
{
// The problem was that w:lvlOverride inside w:num was ignores by dmapper.
......@@ -1197,7 +991,7 @@ void Test::testFdo59638()
CPPUNIT_FAIL("no BulletChar property");
}
void Test::testFdo60722()
DECLARE_RTFIMPORT_TEST(testFdo60722, "fdo60722.rtf")
{
// The problem was that the larger shape was over the smaller one, and not the other way around.
uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
......@@ -1214,7 +1008,7 @@ void Test::testFdo60722()
CPPUNIT_ASSERT_EQUAL(sal_uInt32(0), getProperty<sal_uInt32>(xShape, "LineColor"));
}
void Test::testFdo61909()
DECLARE_RTFIMPORT_TEST(testFdo61909, "fdo61909.rtf")
{
uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
// Was the Writer default font.
......@@ -1223,7 +1017,7 @@ void Test::testFdo61909()
CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<sal_uInt32>(xTextRange, "CharBackColor"));
}
void Test::testFdo62288()
DECLARE_RTFIMPORT_TEST(testFdo62288, "fdo62288.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1236,7 +1030,7 @@ void Test::testFdo62288()
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin"));
}
void Test::testFdo37716()
DECLARE_RTFIMPORT_TEST(testFdo37716, "fdo37716.rtf")
{
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
......@@ -1244,19 +1038,19 @@ void Test::testFdo37716()
CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround"));
}
void Test::testFdo51916()
DECLARE_RTFIMPORT_TEST(testFdo51916, "fdo51916.rtf")
{
// Complex nested table caused a crash.
}
void Test::testFdo63023()
DECLARE_RTFIMPORT_TEST(testFdo63023, "fdo63023.rtf")
{
uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText");
// Back color was black (0) in the header, due to missing color table in the substream.
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFF99), getProperty<sal_Int32>(getRun(getParagraphOfText(1, xHeaderText), 1), "CharBackColor"));
}
void Test::testFdo42109()
DECLARE_RTFIMPORT_TEST(testFdo42109, "fdo42109.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1266,32 +1060,32 @@ void Test::testFdo42109()
CPPUNIT_ASSERT_EQUAL(OUString("TextField"), getProperty<OUString>(getRun(getParagraphOfText(1, xCell->getText()), 1), "TextPortionType"));
}
void Test::testFdo62977()
DECLARE_RTFIMPORT_TEST(testFdo62977, "fdo62977.rtf")
{
// The middle character was imported as '?' instead of the proper unicode value.
getRun(getParagraph(1), 1, OUString("\xE5\xB9\xB4\xEF\xBC\x94\xE6\x9C\x88", 9, RTL_TEXTENCODING_UTF8));
}
void Test::testN818997()
DECLARE_RTFIMPORT_TEST(testN818997, "n818997.rtf")
{
// \page was ignored between two \shp tokens.
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
void Test::testFdo64671()
DECLARE_RTFIMPORT_TEST(testFdo64671, "fdo64671.rtf")
{
// Additional '}' was inserted before the special character.
getRun(getParagraph(1), 1, OUString("\xC5\xBD", 2, RTL_TEXTENCODING_UTF8));
}
void Test::testPageBackground()
DECLARE_RTFIMPORT_TEST(testPageBackground, "page-background.rtf")
{
// The problem was that \background was ignored.
uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(0x92D050), getProperty<sal_Int32>(xPageStyle, "BackColor"));
}
void Test::testFdo62044()
DECLARE_RTFIMPORT_TEST(testFdo62044, "fdo62044.rtf")
{
// The problem was that RTF import during copy&paste did not ignore existing paragraph styles.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
......@@ -1303,14 +1097,14 @@ void Test::testFdo62044()
CPPUNIT_ASSERT_EQUAL(10.f, getProperty<float>(xPropertySet, "CharHeight")); // Was 18, i.e. reset back to original value.
}
void Test::testPoshPosv()
DECLARE_RTFIMPORT_TEST(testPoshPosv, "posh-posv.rtf")
{
CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "HoriOrient"));
CPPUNIT_ASSERT_EQUAL(text::VertOrientation::CENTER, getProperty<sal_Int16>(getShape(1), "VertOrient"));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(getShape(1), "FrameIsAutomaticHeight"));
}
void Test::testN825305()
DECLARE_RTFIMPORT_TEST(testN825305, "n825305.rtf")
{
// The problem was that the textbox wasn't transparent, due to unimplemented fFilled == 0.
uno::Reference<beans::XPropertyState> xPropertyState(getShape(2), uno::UNO_QUERY);
......@@ -1320,13 +1114,13 @@ void Test::testN825305()
CPPUNIT_ASSERT_EQUAL(beans::PropertyState_DIRECT_VALUE, ePropertyState);
}
void Test::testParaBottomMargin()
DECLARE_RTFIMPORT_TEST(testParaBottomMargin, "para-bottom-margin.rtf")
{
// This was 353, i.e. bottom margin of the paragraph was 0.35cm instead of 0.
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getParagraph(1), "ParaBottomMargin"));
}
void Test::testN823655()
DECLARE_RTFIMPORT_TEST(testN823655, "n823655.rtf")
{
uno::Sequence<beans::PropertyValue> aProps = getProperty< uno::Sequence<beans::PropertyValue> >(getShape(1), "CustomShapeGeometry");
uno::Sequence<beans::PropertyValue> aPathProps;
......@@ -1347,7 +1141,7 @@ void Test::testN823655()
CPPUNIT_ASSERT_EQUAL(sal_Int32(286), aCoordinates[0].Second.Value.get<sal_Int32>());
}
void Test::testFdo66040()
DECLARE_RTFIMPORT_TEST(testFdo66040, "fdo66040.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -1368,7 +1162,7 @@ void Test::testFdo66040()
CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), xShape->getSize().Height);
}
void Test::testN823675()
DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf")
{
uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
......@@ -1387,7 +1181,7 @@ void Test::testN823675()
CPPUNIT_ASSERT_EQUAL(OUString("Symbol"), aFont.Name);
}
void Test::testFdo47802()
DECLARE_RTFIMPORT_TEST(testFdo47802, "fdo47802.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -1395,13 +1189,23 @@ void Test::testFdo47802()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
}
void Test::testFdo39001()
DECLARE_RTFIMPORT_TEST(testFdo39001, "fdo39001.rtf")
{
// Document was of 4 pages, \sect at the end of the doc wasn't ignored.
CPPUNIT_ASSERT_EQUAL(3, getPages());
}
void Test::testGroupshape()
DECLARE_RTFIMPORT_TEST(testGroupshape, "groupshape.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
// There should be a single groupshape with 2 children.
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
uno::Reference<drawing::XShapes> xGroupshape(xDraws->getByIndex(0), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount());
}
DECLARE_RTFIMPORT_TEST(testGroupshape_notext, "groupshape-notext.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -1411,7 +1215,7 @@ void Test::testGroupshape()
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xGroupshape->getCount());
}
void Test::testFdo66565()
DECLARE_RTFIMPORT_TEST(testFdo66565, "fdo66565.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1421,7 +1225,7 @@ void Test::testFdo66565()
CPPUNIT_ASSERT_EQUAL(sal_Int16(304), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position);
}
void Test::testFdo54900()
DECLARE_RTFIMPORT_TEST(testFdo54900, "fdo54900.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1431,7 +1235,7 @@ void Test::testFdo54900()
CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_CENTER, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust")));
}
void Test::testFdo64637()
DECLARE_RTFIMPORT_TEST(testFdo64637, "fdo64637.rtf")
{
// The problem was that the custom "Company" property was added twice, the second invocation resulted in an exception.
uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
......@@ -1439,13 +1243,13 @@ void Test::testFdo64637()
CPPUNIT_ASSERT_EQUAL(OUString("bbb"), getProperty<OUString>(xPropertySet, "Company"));
}
void Test::testN820504()
DECLARE_RTFIMPORT_TEST(testN820504, "n820504.rtf")
{
// The shape was anchored at-page instead of at-character (that's incorrect as Word only supports at-character and as-character).
CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
}
void Test::testFdo67365()
DECLARE_RTFIMPORT_TEST(testFdo67365, "fdo67365.rtf")
{
uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
......@@ -1460,20 +1264,20 @@ void Test::testFdo67365()
CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(getParagraphOfText(1, xCell->getText()), "ParaAdjust")));
}
void Test::testFdo67498()
DECLARE_RTFIMPORT_TEST(testFdo67498, "fdo67498.rtf")
{
// Left margin of the default page style wasn't set (was 2000).
CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(5954)), getProperty<sal_Int32>(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin"));
}
void Test::testFdo47440()
DECLARE_RTFIMPORT_TEST(testFdo47440, "fdo47440.rtf")
{
// Vertical and horizontal orientation of the picture wasn't imported (was text::RelOrientation::FRAME).
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation"));
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "VertOrientRelation"));
}
void Test::testFdo53556()
DECLARE_RTFIMPORT_TEST(testFdo53556, "fdo53556.rtf")
{
// This was drawing::FillStyle_SOLID, which resulted in being non-transparent, hiding text which would be visible.
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(getShape(3), "FillStyle"));
......@@ -1484,7 +1288,7 @@ void Test::testFdo53556()
CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), xShapeDescriptor->getShapeType());
}
void Test::testFdo63428()
DECLARE_RTFIMPORT_TEST(testFdo63428, "hello.rtf")
{
// Pasting content that contained an annotation caused a crash.
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
......@@ -1497,13 +1301,13 @@ void Test::testFdo63428()
CPPUNIT_ASSERT_EQUAL(OUString("TextFieldEnd"), getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType"));
}
void Test::testGroupshapeRotation()
DECLARE_RTFIMPORT_TEST(testGroupshapeRotation, "groupshape-rotation.rtf")
{
// Rotation on groupshapes wasn't handled correctly, RotateAngle was 4500.
CPPUNIT_ASSERT_EQUAL(sal_Int32(315 * 100), getProperty<sal_Int32>(getShape(1), "RotateAngle"));
}
void Test::testFdo44715()
DECLARE_RTFIMPORT_TEST(testFdo44715, "fdo44715.rtf")
{
uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY);
uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
......@@ -1511,14 +1315,14 @@ void Test::testFdo44715()
CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getParagraphOfText(2, xCell->getText()), "CharHeight"));
}
void Test::testFdo68076()
DECLARE_RTFIMPORT_TEST(testFdo68076, "fdo68076.rtf")
{
// Encoding of the last char was wrong (more 'o' than 'y').
OUString aExpected("\xD0\x9E\xD0\xB1\xD1\x8A\xD0\xB5\xD0\xBA\xD1\x82 \xE2\x80\x93 \xD1\x83", 19, RTL_TEXTENCODING_UTF8);
getParagraph(1, aExpected);
}
void Test::testFdo68291()
DECLARE_RTFIMPORT_TEST(testFdo68291, "fdo68291.odt")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -1529,7 +1333,7 @@ void Test::testFdo68291()
CPPUNIT_ASSERT_EQUAL(OUString(), getProperty<OUString>(getParagraph(1), "PageDescName"));
}
void Test::testFdo69384()
DECLARE_RTFIMPORT_TEST(testFdo69384, "hello.rtf")
{
uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
uno::Reference<text::XTextRange> xText(xTextDocument->getText(), uno::UNO_QUERY);
......@@ -1541,7 +1345,7 @@ void Test::testFdo69384()
getStyles("ParagraphStyles")->getByName("Text body justified");
}
void Test::testFdo70221()
DECLARE_RTFIMPORT_TEST(testFdo70221, "fdo70221.rtf")
{
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
......@@ -1549,7 +1353,7 @@ void Test::testFdo70221()
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDraws->getCount());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
......
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