/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
uno::Reference<util::XModifiable> xModifiable(mxComponent, uno::UNO_QUERY);
CPPUNIT_ASSERT(!xModifiable->isModified()); // see above, set the OLE cache to 1 for this test // and the problem was that the formulas that were in the cache // (the second one) were lost
OUString formula1(getFormula(getRun(getParagraph(1), 1)));
CPPUNIT_ASSERT_EQUAL(u" size 12{1+1=2} {}"_ustr, formula1);
OUString formula2(getFormula(getRun(getParagraph(2), 1)));
CPPUNIT_ASSERT_EQUAL(u" size 12{2+2=4} {}"_ustr, formula2);
}
DECLARE_ODFEXPORT_TEST(testTdf144319, "tdf144319.odt")
{
CPPUNIT_ASSERT_EQUAL(7, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
OUString formula1(getFormula(getRun(getParagraph(3), 1)));
CPPUNIT_ASSERT_EQUAL(u"{ x = frac { { - b +- sqrt { b ^ 2 - 4 a c } } } { { 2 a } } }"_ustr, formula1);
OUString formula2(getFormula(getRun(getParagraph(4), 1)));
CPPUNIT_ASSERT_EQUAL(u"{ sum csup n csub { i = 1 } i ^ 3 = left ( frac { { n left ( { n + 1 } right ) } } { 2 } right ) ^ 2 }"_ustr, formula2);
OUString formula3(getFormula(getRun(getParagraph(5), 1)));
CPPUNIT_ASSERT_EQUAL(u"{ sum ^ n _ { i = 1 } i ^ 3 = left ( frac { { n left ( { n + 1 } right ) } } { 2 } right ) ^ 2 }"_ustr, formula3);
OUString formula4(getFormula(getRun(getParagraph(6), 1)));
CPPUNIT_ASSERT_EQUAL(u"{ sum ^ n _ { i = 1 } i ^ 3 = left ( frac { { n left ( { n + 1 } right ) } } { 2 } right ) ^ 2 }"_ustr, formula4);
// Without the fix in place, this test would have failed with // - the property is of unexpected type or void: Model
OUString formula5(getFormula(getRun(getParagraph(7), 1)));
CPPUNIT_ASSERT_EQUAL(u"{ y ^ 2 { nitalic m p } = left ( { x ^ 3 + 7 } right ) { nitalic m p } }"_ustr, formula5);
}
// true-case and false-case have spaces inside
{
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
SwHiddenTextField::ParseIfFieldDefinition(u" IF A A A \"B B B\" \"C C C\" ", paramCondition, paramTrue, paramFalse);
CPPUNIT_ASSERT_EQUAL(u"A A A"_ustr, paramCondition);
CPPUNIT_ASSERT_EQUAL(u"B B B"_ustr, paramTrue);
CPPUNIT_ASSERT_EQUAL(u"C C C"_ustr, paramFalse);
}
// true-case and false-case have leading/trailing space
{
OUString paramCondition;
OUString paramTrue;
OUString paramFalse;
// Input document contains only one IF-field, // and it should be imported as com.sun.star.text.TextField.ConditionalText in any case, // instead of insertion of the pair of two field-marks: <field:fieldmark-start> + <field:fieldmark-end>.
CPPUNIT_TEST_FIXTURE(Test, testTdf43569)
{
loadAndReload("tdf43569_conditionalfield.doc"); // check if our parser is valid
testTdf43569_CheckIfFieldParse();
// now check field creation during import
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
// at least one field should be detected
CPPUNIT_ASSERT(xFields->hasMoreElements());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf130314)
{
loadAndReload("tdf130314.docx"); // Without the fix in place, this test would have hung
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf133487)
{
loadAndReload("MadeByLO7.odt");
CPPUNIT_ASSERT_EQUAL(3, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // shape in background has lowest index
assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p[2]/draw:custom-shape", "z-index", u"0");
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[2]/draw:custom-shape[@draw:z-index = '0']/attribute::draw:style-name]/style:graphic-properties", "run-through", u"background"); // shape in foreground, previously index 1
assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p[1]/draw:custom-shape", "z-index", u"2");
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[1]/draw:custom-shape[@draw:z-index = '2']/attribute::draw:style-name]/style:graphic-properties", "run-through", u"foreground"); // shape in foreground, previously index 0
assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p[3]/draw:custom-shape", "z-index", u"1");
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[3]/draw:custom-shape[@draw:z-index = '1']/attribute::draw:style-name]/style:graphic-properties", "run-through", u"foreground");
}
CPPUNIT_TEST_FIXTURE(Test, testTdf141467)
{
loadAndReload("Formcontrol needs high z-index.odt");
CPPUNIT_ASSERT_EQUAL(2, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // shape in foreground has lowest index
assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p[2]/draw:custom-shape", "z-index", u"0");
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[2]/draw:custom-shape[@draw:z-index = '0']/attribute::draw:style-name]/style:graphic-properties", "run-through", u"foreground"); // form control, previously index 0
assertXPath(pXmlDoc, "/office:document-content/office:body/office:text/text:p[2]/draw:control", "z-index", u"1"); // no run-through on form's style
assertXPath(pXmlDoc, "/office:document-content/office:automatic-styles/style:style[@style:name = /office:document-content/office:body/office:text/text:p[2]/draw:control[@draw:z-index = '1']/attribute::draw:style-name]/style:graphic-properties/attribute::run-through", 0);
}
// Without the fix in place, this test would have failed with // - Expected: ** Expression is faulty ** // - Actual : 17976931348623200...
uno::Reference<text::XTextRange> xE2(xTable->getCellByName(u"E2"_ustr), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(u"** Expression is faulty **"_ustr, xE2->getString());
}
// This was 0 (lost table during ODT export in footnotes) // Note: fix also tdf#95806: painting table layout is correct
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
// floating table: there is a frame now
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf150149)
{
loadAndReload("tdf150149.fodt");
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // This was 0 (lost table header in multi-column section)
assertXPath(pXmlDoc, "//table:table-header-rows", 1);
assertXPath(pXmlDoc, "//table:table-header-rows/table:table-row/table:table-cell", 3);
}
CPPUNIT_TEST_FIXTURE(Test, testUserFieldDecl)
{
loadAndReload("user-field-decl.odt");
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Without the accompanying fix in place, this test would have failed with 'Expected: 2; // Actual: 1', i.e. the in-table field had no declaration (in the header), while the // outside-table one had the declaration.
assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
}
CPPUNIT_TEST_FIXTURE(Test, testUserFieldDeclFly)
{
loadAndReload("user-field-decl-fly.odt");
CPPUNIT_ASSERT_EQUAL(1, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages());
xmlDocUniquePtr pXmlDoc = parseExport(u"styles.xml"_ustr); // Without the accompanying fix in place, this test would have failed with 'Expected: 2; // Actual: 1', i.e. the in-textframe field had no declaration (in the header), while the // outside-textframe one had the declaration.
assertXPath(pXmlDoc, "//style:header/text:user-field-decls/text:user-field-decl", 2);
}
xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); // check that there are 3 background-image elements
assertXPath(pXmlDoc, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap']/style:background-image[@style:repeat='stretch']", 3); // tdf#90640: check that one of them is 55% opaque
assertXPath(pXmlDoc, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap' and @fo:background-color='transparent' and @draw:opacity='55%']/style:background-image[@style:repeat='stretch' and @draw:opacity='55%']", 1); // tdf#90640: check that one of them is 43% opaque // (emulated - hopefully not with rounding errors)
assertXPath(pXmlDoc, "//style:style[@style:parent-style-name='Frame' and @style:family='graphic']/style:graphic-properties[@draw:fill='bitmap' and @fo:background-color='transparent' and @draw:opacity-name='Transparency_20_1']/style:background-image[@style:repeat='stretch' and @draw:opacity='43%']", 1);
}
CPPUNIT_TEST_FIXTURE(Test, testSHA1Correct)
{ // tdf#114939 this has both an affected password as well as content.xml constchar* const sPass = "1012345678901234567890123456789012345678901234567890";
createSwDoc("sha1_correct.odt", sPass);
CPPUNIT_TEST_FIXTURE(Test, testSHA1Wrong)
{ // tdf#114939 this has both an affected password as well as content.xml constchar* const sPass = "1012345678901234567890123456789012345678901234567890";
createSwDoc("sha1_wrong.odt", sPass);
DECLARE_ODFEXPORT_TEST(testTdf152710, "tdf152710.odt")
{ // Without this fix in place, this test would have crash at import time
CPPUNIT_ASSERT_EQUAL(2, getPages());
}
DECLARE_ODFEXPORT_TEST(testredlineTextFrame, "redlineTextFrame.odt")
{
CPPUNIT_ASSERT_EQUAL(2, getShapes());
CPPUNIT_ASSERT_EQUAL(1, getPages()); //Note this is for a crash test //Counting the Number of Frames and checking with the expected count
uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
}
DECLARE_ODFEXPORT_TEST(testTdf107292, "tdf107292.odt")
{ // tracked deletions at the same position were loaded in reverse order
CPPUNIT_ASSERT_EQUAL(1, getPages());
// Without this fix in place, this test would have failed with // - Expected: Lorem ipsum dolor sit... // - Actual : dolor ipsumLorem sit...
CPPUNIT_ASSERT_EQUAL(u"Lorem ipsum dolor sit..."_ustr, getParagraph(1)->getString());
}
DECLARE_ODFEXPORT_TEST(testTdf140437, "tdf140437.odt")
{ // Without the fix in place, the document would have failed to load
CPPUNIT_ASSERT_EQUAL(1, getPages());
// at least one field should be detected
CPPUNIT_ASSERT(xFields->hasMoreElements());
}
CPPUNIT_TEST_FIXTURE(Test, testTdf131621)
{
loadAndReload("tdf131621.ott");
CPPUNIT_ASSERT_EQUAL(12, getShapes()); //Crash test, Check number of pages
CPPUNIT_ASSERT_EQUAL( 1, getPages() );
}
CPPUNIT_TEST_FIXTURE(Test, testTdf135144)
{
loadAndReload("tdf135144.docx"); //Crashes at import time after roundtrip
CPPUNIT_ASSERT_EQUAL(3, getPages());
CPPUNIT_ASSERT_EQUAL(4, getShapes());
}
DECLARE_ODFEXPORT_TEST(testTdf130950, "tdf130950.odt")
{ //Crashes at import time
CPPUNIT_ASSERT_EQUAL(1, getPages());
CPPUNIT_ASSERT_EQUAL(2, getShapes());
}
DECLARE_ODFEXPORT_TEST(testFdo38244, "fdo38244.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages()); // See ooxmlexport's testFdo38244().
CPPUNIT_TEST_FIXTURE(Test, testSenderInitials)
{
loadAndReload("sender-initials.fodt"); // Test sender-initial properties (both annotation metadata and text field)
uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XEnumerationAccess> xFieldsAccess(xTextFieldsSupplier->getTextFields());
uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration()); // first 3 are annotations, last 2 are text fields for (unsigned i = 0; i < 3; ++i)
{
uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(u"I"_ustr, getProperty<OUString>(xPropertySet, u"Initials"_ustr));
} for (unsigned i = 0; i < 2; ++i)
{
uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xPropertySet, u"IsFixed"_ustr));
CPPUNIT_ASSERT_EQUAL(u"I"_ustr, getProperty<OUString>(xPropertySet, u"Content"_ustr));
}
}
uno::Reference<beans::XPropertySet> xFrameStyle2(xStyles->getByName(u"Untitled1"_ustr),
uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(COL_WHITE, getProperty<Color>(xFrameStyle2, u"BackColorRGB"_ustr));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xFrameStyle2, u"BackTransparent"_ustr));
CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty<sal_Int32>(xFrameStyle2, u"BackColorTransparency"_ustr));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xFrameStyle2, u"FillStyle"_ustr)); // unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xFrameStyle2, "FillColor")); // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xFrameStyle2, "FillTransparence"));
uno::Reference<beans::XPropertySet> xStyle2(xParaStyles->getByName(
u"Avis expert questions"_ustr), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, getProperty<Color>(xStyle2, u"ParaBackColor"_ustr));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle2, u"ParaBackTransparent"_ustr));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xStyle2, u"FillStyle"_ustr)); // unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle2, "FillColor")); // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle2, "FillTransparence"));
CPPUNIT_ASSERT_EQUAL(Color(0x661900), getProperty<Color>(xStyle2, u"CharColor"_ustr));
uno::Reference<beans::XPropertySet> xStyle32(xParaStyles->getByName(
u"Avis expert rXponses"_ustr), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(COL_TRANSPARENT, getProperty<Color>(xStyle32, u"ParaBackColor"_ustr));
CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle32, u"ParaBackTransparent"_ustr));
CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_NONE, getProperty<drawing::FillStyle>(xStyle32, u"FillStyle"_ustr)); // unfortunately this is actually the pool default value, which would be hard to fix - but it isn't a problem because style is NONE // CPPUNIT_ASSERT_EQUAL(sal_Int32(0xffffff), getProperty<sal_Int32>(xStyle32, "FillColor")); // CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(xStyle32, "FillTransparence"));
CPPUNIT_ASSERT_EQUAL(Color(0x461900), getProperty<Color>(xStyle32, u"CharColor"_ustr));
};
// MCGR: Use the completely imported gradient to check for correctness
basegfx::BColorStops aColorStops = model::gradient::getColorStopsFromUno(aGradient.ColorStops);
CPPUNIT_TEST_FIXTURE(Test, testDuplicateCrossRefHeadingBookmark)
{
loadAndReload("CrossRefHeadingBookmark.fodt"); // the file contains invalid duplicate heading cross reference bookmarks // but we have to round trip them, tdf#94804
DECLARE_ODFEXPORT_TEST(testFdo60769, "fdo60769.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages()); // Test multi-paragraph comment range feature.
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();
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); while (xRunEnum->hasMoreElements())
{
uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
OUString aType = getProperty<OUString>(xPropertySet, u"TextPortionType"_ustr); // First paragraph: no field end, no anchor
CPPUNIT_ASSERT(aType == "Text" || aType == "Annotation");
}
xRunEnumAccess.set(xParaEnum->nextElement(), uno::UNO_QUERY); while (xRunEnum->hasMoreElements())
{
uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
OUString aType = getProperty<OUString>(xPropertySet, u"TextPortionType"_ustr); // Second paragraph: no field start
CPPUNIT_ASSERT(aType == "Text" || aType == "AnnotationEnd");
}
}
DECLARE_ODFEXPORT_TEST(testTdf115815, "tdf115815.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages()); // Test comment range feature on tracked deletion.
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();
uno::Reference<container::XEnumerationAccess> xRunEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xRunEnum = xRunEnumAccess->createEnumeration(); bool bAnnotationStart = false; bool bBeforeAnnotation = true;
OUString sTextBeforeAnnotation; while (xRunEnum->hasMoreElements())
{
uno::Reference<beans::XPropertySet> xPropertySet(xRunEnum->nextElement(), uno::UNO_QUERY);
OUString aType = getProperty<OUString>(xPropertySet, u"TextPortionType"_ustr); // there is no AnnotationEnd with preceding AnnotationStart, // i.e. annotation with lost range
CPPUNIT_ASSERT(aType != "AnnotationEnd" || !bAnnotationStart);
bAnnotationStart = (aType == "Annotation");
// collect paragraph text before the first annotation if (bBeforeAnnotation)
{ if (bAnnotationStart)
bBeforeAnnotation = false; elseif (aType == "Text")
{
uno::Reference<text::XTextRange> xRun(xPropertySet, uno::UNO_QUERY);
sTextBeforeAnnotation += xRun->getString();
}
}
}
// This was "Lorem ipsum" (collapsed annotation range)
CPPUNIT_ASSERT_EQUAL(u"Lorem "_ustr, sTextBeforeAnnotation);
}
/* * The problem was that the exporter didn't insert "Obj102" to the * resulting zip file. No idea how to check for "broken" (missing OLE data * and replacement image) OLE objects using UNO, so we'll check the zip file directly.
*/
save(u"writer8"_ustr);
uno::Sequence<uno::Any> aArgs{ uno::Any(maTempFile.GetURL()) };
uno::Reference<container::XNameAccess> xNameAccess(m_xSFactory->createInstanceWithArguments(u"com.sun.star.packages.zip.ZipFileAccess"_ustr, aArgs), uno::UNO_QUERY); const css::uno::Sequence<OUString> aNames(xNameAccess->getElementNames()); // The exported document must have three objects named ObjNNN. The names are assigned in // OLEHandler::copyOLEOStream using a static counter, and actual numbers depend on previous // tests; so just count the matching names here. int nMatches = 0; for (const OUString& sName : aNames)
{
OUString sRest; if (sName.startsWith("Obj", &sRest))
{ // all following characters must be decimal digits; minimal value is 100 bool bMatch = sRest.getLength() >= 3
&& std::all_of(sRest.getStr(), sRest.getStr() + sRest.getLength(),
[](sal_Unicode ch) { return ch >= '0' && ch <= '9'; }); if (bMatch)
++nMatches;
}
}
CPPUNIT_ASSERT_EQUAL(3, nMatches);
}
DECLARE_ODFEXPORT_TEST(testStylePageNumber, "ooo321_stylepagenumber.odt")
{
CPPUNIT_ASSERT_EQUAL(5, getPages());
uno::Reference<text::XTextContent> xTable1(getParagraphOrTable(1)); // actually no break attribute is written in this case // CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, getProperty<style::BreakType>(xTable1, "BreakType"));
CPPUNIT_ASSERT_EQUAL(u"Left Page"_ustr, getProperty<OUString>(xTable1, u"PageDescName"_ustr));
CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xTable1, u"PageNumberOffset"_ustr));
DECLARE_ODFEXPORT_TEST(testCharacterBorder, "charborder.odt")
{
CPPUNIT_ASSERT_EQUAL(1, getPages()); // Make sure paragraph and character attributes don't interfere // First paragraph has a paragraph border and a character border included by the paragraph style
// Paragraph border of first paragraph
{ const table::BorderLine2 aFirstParTopBorder(0x6666FF,2,26,26,7,55); const sal_Int32 aFirstParTopPadding(150);
uno::Reference<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY);
// Top border
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,u"TopBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,u"TopBorderDistance"_ustr));
// Bottom border (same as top border)
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,u"BottomBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,u"BottomBorderDistance"_ustr));
// Left border (same as top border)
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,u"LeftBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,u"LeftBorderDistance"_ustr));
// Right border (same as top border)
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParTopBorder, getProperty<table::BorderLine2>(xSet,u"RightBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParTopPadding, getProperty<sal_Int32>(xSet,u"RightBorderDistance"_ustr));
// Character border for first paragraph
{ const table::BorderLine2 aFirstParCharTopBorder(0xFF3333,0,37,0,2,37); const sal_Int32 aFirstParCharTopPadding(450);
uno::Reference<beans::XPropertySet> xSet(getParagraph(1), uno::UNO_QUERY);
// Top border
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,u"CharTopBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,u"CharTopBorderDistance"_ustr));
// Bottom border (same as top border)
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,u"CharBottomBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,u"CharBottomBorderDistance"_ustr));
// Left border (same as top border)
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,u"CharLeftBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,u"CharLeftBorderDistance"_ustr));
// Right border (same as top border)
CPPUNIT_ASSERT_BORDER_EQUAL(aFirstParCharTopBorder, getProperty<table::BorderLine2>(xSet,u"CharRightBorder"_ustr));
CPPUNIT_ASSERT_EQUAL(aFirstParCharTopPadding, getProperty<sal_Int32>(xSet,u"CharRightBorderDistance"_ustr));
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.