/* * Version: MPL 1.1 / GPLv3+ / LGPLv3+ * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Initial Developer of the Original Code is * Miklos Vajna (SUSE, Inc.) * Portions created by the Initial Developer are Copyright (C) 2012 the * Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 3 or later (the "GPLv3+"), or * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable * instead of those above. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define TWIP_TO_MM100(TWIP) ((TWIP) >= 0 ? (((TWIP)*127L+36L)/72L) : (((TWIP)*127L-36L)/72L)) 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(); 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(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) CPPUNIT_TEST(run); #endif CPPUNIT_TEST_SUITE_END(); private: void run(); /// Get page count. int getPages(); /// Copy&paste helper. void paste(OUString aFilename, uno::Reference xTextRange = uno::Reference()) { uno::Reference xFilter(m_xSFactory->createInstance("com.sun.star.comp.Writer.RtfFilter"), uno::UNO_QUERY_THROW); uno::Reference xImporter(xFilter, uno::UNO_QUERY_THROW); xImporter->setTargetDocument(mxComponent); uno::Sequence aDescriptor(xTextRange.is() ? 3 : 2); aDescriptor[0].Name = "InputStream"; SvStream* pStream = utl::UcbStreamHelper::CreateStream(getURLFromSrc("/sw/qa/extras/rtfimport/data/") + aFilename, STREAM_WRITE); uno::Reference xStream(new utl::OStreamWrapper(*pStream)); aDescriptor[0].Value <<= xStream; aDescriptor[1].Name = "IsNewDoc"; aDescriptor[1].Value <<= sal_False; if (xTextRange.is()) { aDescriptor[2].Name = "TextInsertModeRange"; aDescriptor[2].Value <<= xTextRange; } xFilter->filter(aDescriptor); } }; void Test::run() { MethodEntry 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}, {"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}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) { MethodEntry& 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(); } } int Test::getPages() { uno::Reference xModel(mxComponent, uno::UNO_QUERY); uno::Reference xTextViewCursorSupplier(xModel->getCurrentController(), uno::UNO_QUERY); uno::Reference xCursor(xTextViewCursorSupplier->getViewCursor(), uno::UNO_QUERY); xCursor->jumpToLastPage(); return xCursor->getPage(); } void Test::testFdo45553() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); while (xParaEnum->hasMoreElements()) { uno::Reference xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference xRangeEnum = xRangeEnumAccess->createEnumeration(); while (xRangeEnum->hasMoreElements()) { uno::Reference xRange(xRangeEnum->nextElement(), uno::UNO_QUERY); OUString aStr = xRange->getString(); if ( aStr == "space-before" ) CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(120)), getProperty(xRange, "ParaTopMargin")); else if ( aStr == "space-after" ) CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(240)), getProperty(xRange, "ParaBottomMargin")); } } } void Test::testN192129() { // We expect that the result will be 16x16px. Size aExpectedSize(16, 16); MapMode aMap(MAP_100TH_MM); aExpectedSize = Application::GetDefaultDevice()->PixelToLogic( aExpectedSize, aMap ); uno::Reference xTextGraphicObjectsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY); uno::Reference xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY); awt::Size aActualSize(xShape->getSize()); CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width); CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height); } void Test::testFdo45543() { CPPUNIT_ASSERT_EQUAL(5, getLength()); } void Test::testN695479() { uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference xPropertySet(xIndexAccess->getByIndex(0), uno::UNO_QUERY); // Negative ABSH should mean fixed size. CPPUNIT_ASSERT_EQUAL(text::SizeType::FIX, getProperty(xPropertySet, "SizeType")); CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(300)), getProperty(xPropertySet, "Height")); uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); bool bFrameFound = false, bDrawFound = false; for (int i = 0; i < xDraws->getCount(); ++i) { uno::Reference xServiceInfo(xDraws->getByIndex(i), uno::UNO_QUERY); if (xServiceInfo->supportsService("com.sun.star.text.TextFrame")) { // Both frames should be anchored to the first paragraph. bFrameFound = true; uno::Reference xTextContent(xServiceInfo, uno::UNO_QUERY); uno::Reference xRange(xTextContent->getAnchor(), uno::UNO_QUERY); uno::Reference xText(xRange->getText(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("plain"), xText->getString()); if (i == 0) // Additonally, the frist frame should have double border at the bottom. CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::DOUBLE, getProperty(xPropertySet, "BottomBorder").LineStyle); } else if (xServiceInfo->supportsService("com.sun.star.drawing.LineShape")) { // The older "drawing objects" syntax should be recognized. bDrawFound = true; xPropertySet.set(xServiceInfo, uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty(xPropertySet, "HoriOrientRelation")); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty(xPropertySet, "VertOrientRelation")); } } CPPUNIT_ASSERT(bFrameFound); CPPUNIT_ASSERT(bDrawFound); } void Test::testFdo42465() { CPPUNIT_ASSERT_EQUAL(3, getLength()); } void Test::testFdo45187() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); // There should be two shapes. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); // They should be anchored to different paragraphs. CPPUNIT_ASSERT(getProperty(xDraws->getByIndex(0), "AnchorPosition").Y != getProperty(xDraws->getByIndex(1), "AnchorPosition").Y); } void Test::testFdo46662() { uno::Reference xPropertySet(getStyles("NumberingStyles")->getByName("WWNum3"), uno::UNO_QUERY); uno::Reference xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence aProps; xLevels->getByIndex(1) >>= aProps; // 2nd level for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; if ( rProp.Name == "ParentNumbering" ) CPPUNIT_ASSERT_EQUAL(sal_Int16(2), rProp.Value.get()); else if ( rProp.Name == "Suffix" ) CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get().getLength()); } } void Test::testN750757() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT_EQUAL(sal_Bool(false), getProperty(xParaEnum->nextElement(), "ParaContextMargin")); CPPUNIT_ASSERT_EQUAL(sal_Bool(true), getProperty(xParaEnum->nextElement(), "ParaContextMargin")); } void Test::testFdo45563() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); int i = 0; while (xParaEnum->hasMoreElements()) { xParaEnum->nextElement(); i++; } CPPUNIT_ASSERT_EQUAL(4, i); } void Test::testFdo43965() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); // First paragraph: the parameter of \up was ignored uno::Reference xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference xRangeEnum = xRangeEnumAccess->createEnumeration(); uno::Reference xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(36), getProperty(xPropertySet, "CharEscapement")); CPPUNIT_ASSERT_EQUAL(sal_Int32(100), getProperty(xPropertySet, "CharEscapementHeight")); // Second paragraph: Word vs Writer border default problem CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty(xParaEnum->nextElement(), "TopBorder").LineWidth); // Finally, make sure that we have two pages CPPUNIT_ASSERT_EQUAL(2, getPages()); } void Test::testN751020() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(200)), getProperty(xParaEnum->nextElement(), "ParaBottomMargin")); } void Test::testFdo47326() { // This was 15 only, as \super buffered text, then the contents of it got lost. CPPUNIT_ASSERT_EQUAL(19, getLength()); } void Test::testFdo47036() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); int nAtCharacter = 0; for (int i = 0; i < xDraws->getCount(); ++i) { if (getProperty(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AT_CHARACTER) nAtCharacter++; } // The image at the document start was ignored. CPPUNIT_ASSERT_EQUAL(1, nAtCharacter); // There should be 2 textboxes, not 4 uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } void Test::testFdo46955() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); while (xParaEnum->hasMoreElements()) { uno::Reference xRangeEnumAccess(xParaEnum->nextElement(), uno::UNO_QUERY); uno::Reference xRangeEnum = xRangeEnumAccess->createEnumeration(); while (xRangeEnum->hasMoreElements()) CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE, getProperty(xRangeEnum->nextElement(), "CharCaseMap")); } } void Test::testFdo45394() { uno::Reference xHeaderText = getProperty< uno::Reference >(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "HeaderText"); OUString aActual = xHeaderText->getString(); // Encoding in the header was wrong. OUString aExpected("ПК РИК", 11, RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } void Test::testFdo48104() { CPPUNIT_ASSERT_EQUAL(2, getPages()); } void Test::testFdo47107() { uno::Reference xNumberingStyles(getStyles("NumberingStyles")); // Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException xNumberingStyles->getByName("WWNum1"); xNumberingStyles->getByName("WWNum2"); } void Test::testFdo45182() { uno::Reference xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); uno::Reference xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); // Encoding in the footnote was wrong. OUString aExpected("živností", 10, RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } void Test::testFdo44176() { uno::Reference xPageStyles(getStyles("PageStyles")); uno::Reference xFirstPage(xPageStyles->getByName("First Page"), uno::UNO_QUERY); uno::Reference xDefault(xPageStyles->getByName(DEFAULT_STYLE), uno::UNO_QUERY); sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0; xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop; xDefault->getPropertyValue("TopMargin") >>= nDefaultTop; xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader; CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader); } void Test::testFdo39053() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); int nAsCharacter = 0; for (int i = 0; i < xDraws->getCount(); ++i) if (getProperty(xDraws->getByIndex(i), "AnchorType") == text::TextContentAnchorType_AS_CHARACTER) nAsCharacter++; // The image in binary format was ignored. CPPUNIT_ASSERT_EQUAL(1, nAsCharacter); } void Test::testFdo48356() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); int i = 0; while (xParaEnum->hasMoreElements()) { xParaEnum->nextElement(); i++; } // The document used to be imported as two paragraphs. CPPUNIT_ASSERT_EQUAL(1, i); } void Test::testFdo48023() { uno::Reference xTextRange = getRun(getParagraph(1), 1); // Implicit encoding detection based on locale was missing OUString aExpected("Программист", 22, RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } void Test::testFdo48876() { uno::Reference xTextDocument(mxComponent, uno::UNO_QUERY); uno::Reference xParaEnumAccess(xTextDocument->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); CPPUNIT_ASSERT(xParaEnum->hasMoreElements()); CPPUNIT_ASSERT_EQUAL(style::LineSpacingMode::MINIMUM, getProperty(xParaEnum->nextElement(), "ParaLineSpacing").Mode); } void Test::testFdo48193() { CPPUNIT_ASSERT_EQUAL(7, getLength()); } void Test::testFdo44211() { uno::Reference xTextRange = getRun(getParagraph(1), 1); OUString aExpected("ąčę", 6, RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } void Test::testFdo48037() { uno::Reference xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW); lang::Locale aUSLocale, aFRLocale; aUSLocale.Language = "en"; aFRLocale.Language = "fr"; sal_Int32 nExpected = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale); uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); uno::Reference xPropertySet(xFields->nextElement(), uno::UNO_QUERY); sal_Int32 nActual = 0; xPropertySet->getPropertyValue("NumberFormat") >>= nActual; CPPUNIT_ASSERT_EQUAL(nExpected, nActual); } void Test::testFdo47764() { // \cbpat with zero argument should mean the auto (-1) color, not a default color (black) CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty(getParagraph(1), "ParaBackColor")); } void Test::testFdo38786() { uno::Reference xTextFieldsSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFieldsAccess(xTextFieldsSupplier->getTextFields()); uno::Reference xFields(xFieldsAccess->createEnumeration()); // \chpgn was ignored, so exception was thrown xFields->nextElement(); } void Test::testN757651() { // 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() { uno::Reference xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_True, getProperty(xStyle, "IsLandscape")); sal_Int32 nExpected(TWIP_TO_MM100(567)); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "LeftMargin")); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "RightMargin")); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "TopMargin")); CPPUNIT_ASSERT_EQUAL(nExpected, getProperty(xStyle, "BottomMargin")); } void Test::testFdo49271() { CPPUNIT_ASSERT_EQUAL(25.f, getProperty(getParagraph(2), "CharHeight")); } void Test::testFdo49692() { uno::Reference xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence aProps; xLevels->getByIndex(0) >>= aProps; // 1st level for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; if (rProp.Name == "Suffix") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), rProp.Value.get().getLength()); } } void Test::testFdo45190() { // inherited \fi should be reset CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(getParagraph(1), "ParaFirstLineIndent")); // but direct one not CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(-100)), getProperty(getParagraph(2), "ParaFirstLineIndent")); } void Test::testFdo50539() { // \chcbpat with zero argument should mean the auto (-1) color, not a default color (black) CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty(getRun(getParagraph(1), 1), "CharBackColor")); } void Test::testFdo50665() { // Access the second run, which is a textfield uno::Reference xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY); // This used to be the default, as character properties were ignored. CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), getProperty(xRun, "CharFontName")); } void Test::testFdo49659() { // 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 xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); // The graphic was also empty uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xGraphic(getProperty< uno::Reference >(xDraws->getByIndex(0), "Graphic"), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL, getProperty(xGraphic, "GraphicType")); } void Test::testFdo46966() { /* * The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch). * * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin */ uno::Reference xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(720)), getProperty(xPropertySet, "TopMargin")); } void Test::testFdo52066() { /* * The problem was that the height of the shape was too big. * * xray ThisComponent.DrawPage(0).Size.Height */ uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xShape(xDraws->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(19)), xShape->getSize().Height); } void Test::testFdo48033_53594() { /* * 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 xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference xCell(xTable->getCellByName("B1"), uno::UNO_QUERY); uno::Reference xParaEnumAccess(xCell->getText(), uno::UNO_QUERY); uno::Reference xParaEnum = xParaEnumAccess->createEnumeration(); uno::Reference xPara(xParaEnum->nextElement(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("Frame"), getProperty(getRun(xPara, 1), "TextPortionType")); } void Test::testFdo36089() { CPPUNIT_ASSERT_EQUAL(sal_Int16(-50), getProperty(getRun(getParagraph(1), 2), "CharEscapement")); } void Test::testFdo49892() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); for (int i = 0; i < xDraws->getCount(); ++i) { OUString aDescription = getProperty(xDraws->getByIndex(i), "Description"); if (aDescription == "red") CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xDraws->getByIndex(i), "ZOrder")); else if (aDescription == "green") CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(xDraws->getByIndex(i), "ZOrder")); else if (aDescription == "blue") CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty(xDraws->getByIndex(i), "ZOrder")); else if (aDescription == "rect") { CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty(xDraws->getByIndex(i), "HoriOrientRelation")); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty(xDraws->getByIndex(i), "VertOrientRelation")); } } } void Test::testFdo48446() { OUString aExpected("Имя", 6, RTL_TEXTENCODING_UTF8); getParagraph(1, aExpected); } void Test::testFdo47495() { // 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() { BorderTest borderTest; borderTest.testTheBorders(mxComponent); } void Test::testFdo52052() { // 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() { /* * The problem was that the second segment had wrong command count and wrap type. * * oShape = ThisComponent.DrawPage(0) * oPathPropVec = oShape.CustomShapeGeometry(1).Value * oSegments = oPathPropVec(1).Value * msgbox oSegments(1).Count ' was 0x2000 | 10, should be 10 * msgbox oShape.Surround ' was 2, should be 1 */ uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Sequence aProps = getProperty< uno::Sequence >(xDraws->getByIndex(0), "CustomShapeGeometry"); uno::Sequence aPathProps; for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; if (rProp.Name == "Path") rProp.Value >>= aPathProps; } uno::Sequence aSegments; for (int i = 0; i < aPathProps.getLength(); ++i) { const beans::PropertyValue& rProp = aPathProps[i]; if (rProp.Name == "Segments") rProp.Value >>= aSegments; } CPPUNIT_ASSERT_EQUAL(sal_Int16(10), aSegments[1].Count); CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty(xDraws->getByIndex(0), "Surround")); } void Test::testFdo52389() { // The last '!' character at the end of the document was lost CPPUNIT_ASSERT_EQUAL(6, getLength()); } void Test::testFdo49655() { /* * 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 xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount()); } void Test::testFdo52475() { // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO. CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), getProperty(getRun(getParagraph(1), 3), "CharBackColor")); } void Test::testFdo55493() { // The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xShape(xDraws->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width); } void Test::testCopyPastePageStyle() { // 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. paste("copypaste-pagestyle-paste.rtf"); uno::Reference xPropertySet(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(21001), getProperty(xPropertySet, "Width")); // Was letter, i.e. 21590 } void Test::testCopyPasteFootnote() { // 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 xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); uno::Reference xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); paste("copypaste-footnote-paste.rtf", xTextRange); CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString()); } void Test::testShptxtPard() { // The problem was that \pard inside \shptxt caused loss of shape text uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xText(xDraws->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString()); } void Test::testDoDhgt() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); for (int i = 0; i < xDraws->getCount(); ++i) { sal_Int32 nFillColor = getProperty(xDraws->getByIndex(i), "FillColor"); if (nFillColor == 0xc0504d) // red CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty(xDraws->getByIndex(i), "ZOrder")); else if (nFillColor == 0x9bbb59) // green CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty(xDraws->getByIndex(i), "ZOrder")); else if (nFillColor == 0x4f81bd) // blue CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty(xDraws->getByIndex(i), "ZOrder")); } } void Test::testDplinehollow() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xPropertySet(xDraws->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(drawing::LineStyle_NONE, getProperty(xPropertySet, "LineStyle")); } void Test::testLeftmarginDefault() { // The default left/right margin was incorrect when the top margin was set to zero. CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty(getStyles("PageStyles")->getByName(DEFAULT_STYLE), "LeftMargin")); } void Test::testDppolyline() { // This was completely ignored, for now, just make sure we have all 4 lines. uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount()); } void Test::testFdo56512() { uno::Reference xTextFramesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY); uno::Reference xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY); OUString aExpected("עוסק מורשה ", 20, RTL_TEXTENCODING_UTF8); CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } void Test::testFdo52989() { // Same as n#192129, but for JPEG files. uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xShape(xDraws->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(423), xShape->getSize().Width); } void Test::testFdo48442() { // The problem was that \pvmrg is the default in RTF, but not in Writer. uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); uno::Reference xShape(xDraws->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_PRINT_AREA, getProperty(xShape, "VertOrientRelation")); // was FRAME } void Test::testFdo55525() { uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Negative left margin was ~missing, -191 CPPUNIT_ASSERT_EQUAL(sal_Int32(-1877), getProperty(xTable, "LeftMargin")); // Cell width of A1 was 3332 (e.g. not set, 30% percent of total width) uno::Reference xTableRows(xTable->getRows(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int16(1016), getProperty< uno::Sequence >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position); } void Test::testFdo57708() { // There were two issues: the doc was of 2 pages and the picture was missing. CPPUNIT_ASSERT_EQUAL(1, getPages()); uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); // Two objects: a picture and a textframe. CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xDraws->getCount()); } void Test::testFdo54473() { // The problem was that character styles were not imported due to a typo. CPPUNIT_ASSERT_EQUAL(OUString("Anot"), getProperty(getRun(getParagraph(1), 1, "Text "), "CharStyleName")); CPPUNIT_ASSERT_EQUAL(OUString("ForeignTxt"), getProperty(getRun(getParagraph(1), 3, "character "), "CharStyleName")); } void Test::testFdo49934() { // Column break without columns defined should be a page break, but it was just ignored. CPPUNIT_ASSERT_EQUAL(2, getPages()); } void Test::testFdo57886() { // Was 'int from to '. CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"), getFormula(getRun(getParagraph(1), 1))); } void Test::testFdo58076() { // An additional section was created, so the default page style didn't have the custom margins. uno::Reference xStyle(getStyles("PageStyles")->getByName(DEFAULT_STYLE), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2251), getProperty(xStyle, "LeftMargin")); CPPUNIT_ASSERT_EQUAL(sal_Int32(1752), getProperty(xStyle, "RightMargin")); CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty(xStyle, "TopMargin")); CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty(xStyle, "BottomMargin")); } void Test::testFdo57678() { // Paragraphs of the two tables were not converted to tables. uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xIndexAccess(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount()); } void Test::testFdo45183() { uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); // Was text::WrapTextMode_PARALLEL, i.e. shpfblwtxt didn't send the shape below text. CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_THROUGHT, getProperty(xDraws->getByIndex(0), "Surround")); uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); // Was 247, resulting in a table having width almost zero and height of 10+ pages. CPPUNIT_ASSERT_EQUAL(sal_Int32(16237), getProperty(xTables->getByIndex(0), "Width")); } void Test::testFdo54612() { // \dpptx without a \dppolycount caused a crash. uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(8), xDraws->getCount()); } void Test::testFdo58933() { // The problem was that the table had an additional cell in its first line. uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); // This was 4. CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength()); } void Test::testFdo44053() { uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables( ), uno::UNO_QUERY); uno::Reference xTextTable(xTables->getByIndex(0), uno::UNO_QUERY); uno::Reference xTableRows(xTextTable->getRows(), uno::UNO_QUERY); // The with of the table's A1 and A2 cell should equal. CPPUNIT_ASSERT_EQUAL(getProperty< uno::Sequence >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position, getProperty< uno::Sequence >(xTableRows->getByIndex(1), "TableColumnSeparators")[0].Position); } void Test::testFdo48440() { // Page break was ignored. CPPUNIT_ASSERT_EQUAL(2, getPages()); } void Test::testFdo58646line() { // \line symbol was ignored getParagraph(1, "foo\nbar"); } void Test::testFdo58646() { // Page break was ignored inside a continous section, on title page. CPPUNIT_ASSERT_EQUAL(2, getPages()); } void Test::testFdo59419() { // Junk to be ignored broke import of the table. uno::Reference xTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTablesSupplier->getTextTables(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount()); } void Test::testFdo58076_2() { // Position of the picture wasn't correct. uno::Reference xDrawPageSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(8345)), getProperty(xDraws->getByIndex(0), "HoriOrientPosition")); } void Test::testFdo59953() { uno::Reference xTextTablesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY); uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); // Cell width of A1 was 4998 (e.g. not set / not wide enough, ~50% of total width) uno::Reference xTableRows(xTable->getRows(), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL(sal_Int16(7650), getProperty< uno::Sequence >(xTableRows->getByIndex(0), "TableColumnSeparators")[0].Position); } void Test::testFdo59638() { // The problem was that w:lvlOverride inside w:num was ignores by dmapper. uno::Reference xPropertySet(getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY); uno::Reference xLevels(xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY); uno::Sequence aProps; xLevels->getByIndex(0) >>= aProps; // 1st level for (int i = 0; i < aProps.getLength(); ++i) { const beans::PropertyValue& rProp = aProps[i]; if (rProp.Name == "BulletChar") { // Was '*', should be 'o'. CPPUNIT_ASSERT_EQUAL(OUString("\xEF\x82\xB7", 3, RTL_TEXTENCODING_UTF8), rProp.Value.get()); return; } } CPPUNIT_FAIL("no BulletChar property"); } CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */