android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / qa / extras / rtfexport / rtfexport2.cxx
blob1998262deca431f7a080f1eecc020707f3ee8919
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <swmodeltestbase.hxx>
12 #include <com/sun/star/graphic/GraphicType.hpp>
13 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
14 #include <com/sun/star/style/CaseMap.hpp>
15 #include <com/sun/star/style/LineSpacing.hpp>
16 #include <com/sun/star/style/LineSpacingMode.hpp>
17 #include <com/sun/star/style/ParagraphAdjust.hpp>
18 #include <com/sun/star/text/TableColumnSeparator.hpp>
19 #include <com/sun/star/text/XFootnotesSupplier.hpp>
20 #include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp>
21 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
22 #include <com/sun/star/text/XTextFramesSupplier.hpp>
23 #include <com/sun/star/text/XTextRangeCompare.hpp>
24 #include <com/sun/star/text/XTextTablesSupplier.hpp>
25 #include <com/sun/star/text/WrapTextMode.hpp>
26 #include <com/sun/star/text/HoriOrientation.hpp>
27 #include <com/sun/star/util/XNumberFormatsSupplier.hpp>
29 #include <tools/UnitConversion.hxx>
30 #include <vcl/svapp.hxx>
31 #include <vcl/settings.hxx>
32 #include <i18nlangtag/languagetag.hxx>
33 #include <comphelper/scopeguard.hxx>
35 #include <bordertest.hxx>
37 class Test : public SwModelTestBase
39 public:
40 Test()
41 : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format")
46 DECLARE_RTFEXPORT_TEST(testFdo45553, "fdo45553.rtf")
48 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
49 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
50 uno::UNO_QUERY);
51 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
52 while (xParaEnum->hasMoreElements())
54 uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(),
55 uno::UNO_QUERY);
56 uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
57 while (xRangeEnum->hasMoreElements())
59 uno::Reference<text::XTextRange> xRange(xRangeEnum->nextElement(), uno::UNO_QUERY);
60 OUString aStr = xRange->getString();
61 if (aStr == "space-before")
62 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(120)),
63 getProperty<sal_Int32>(xRange, "ParaTopMargin"));
64 else if (aStr == "space-after")
65 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(240)),
66 getProperty<sal_Int32>(xRange, "ParaBottomMargin"));
71 DECLARE_RTFEXPORT_TEST(testN192129, "n192129.rtf")
73 // We expect that the result will be 16x16px.
74 Size aExpectedSize(16, 16);
75 MapMode aMap(MapUnit::Map100thMM);
76 aExpectedSize = Application::GetDefaultDevice()->PixelToLogic(aExpectedSize, aMap);
78 uno::Reference<text::XTextGraphicObjectsSupplier> xTextGraphicObjectsSupplier(mxComponent,
79 uno::UNO_QUERY);
80 uno::Reference<container::XIndexAccess> xIndexAccess(
81 xTextGraphicObjectsSupplier->getGraphicObjects(), uno::UNO_QUERY);
82 uno::Reference<drawing::XShape> xShape(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
83 awt::Size aActualSize(xShape->getSize());
84 if ((aExpectedSize.Width() - aActualSize.Width) / 2 != 0)
86 CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Width()), aActualSize.Width);
88 if ((aExpectedSize.Height() - aActualSize.Height) / 2 != 0)
90 CPPUNIT_ASSERT_EQUAL(sal_Int32(aExpectedSize.Height()), aActualSize.Height);
94 DECLARE_RTFEXPORT_TEST(testFdo45543, "fdo45543.rtf") { CPPUNIT_ASSERT_EQUAL(5, getLength()); }
96 DECLARE_RTFEXPORT_TEST(testFdo42465, "fdo42465.rtf") { CPPUNIT_ASSERT_EQUAL(3, getLength()); }
98 DECLARE_RTFEXPORT_TEST(testFdo45187, "fdo45187.rtf")
100 // There should be two shapes.
101 CPPUNIT_ASSERT_EQUAL(2, getShapes());
103 // They should be anchored to different paragraphs.
104 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
105 uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xTextDocument->getText(),
106 uno::UNO_QUERY);
107 uno::Reference<text::XTextRange> xAnchor0
108 = uno::Reference<text::XTextContent>(getShape(1), uno::UNO_QUERY_THROW)->getAnchor();
109 uno::Reference<text::XTextRange> xAnchor1
110 = uno::Reference<text::XTextContent>(getShape(2), uno::UNO_QUERY_THROW)->getAnchor();
111 // Was 0 ("starts at the same position"), should be 1 ("starts before")
112 CPPUNIT_ASSERT_EQUAL(sal_Int16(1), xTextRangeCompare->compareRegionStarts(xAnchor0, xAnchor1));
115 DECLARE_RTFEXPORT_TEST(testN750757, "n750757.rtf")
117 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
118 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
119 uno::UNO_QUERY);
120 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
122 CPPUNIT_ASSERT_EQUAL(false, getProperty<bool>(xParaEnum->nextElement(), "ParaContextMargin"));
123 CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xParaEnum->nextElement(), "ParaContextMargin"));
126 DECLARE_RTFEXPORT_TEST(testFdo45563, "fdo45563.rtf")
128 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
129 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
130 uno::UNO_QUERY);
131 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
132 int i = 0;
133 while (xParaEnum->hasMoreElements())
135 xParaEnum->nextElement();
136 i++;
138 CPPUNIT_ASSERT_EQUAL(4, i);
141 DECLARE_RTFEXPORT_TEST(testFdo43965, "fdo43965.rtf")
143 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
144 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
145 uno::UNO_QUERY);
146 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
148 // First paragraph: the parameter of \up was ignored
149 uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(),
150 uno::UNO_QUERY);
151 uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
152 uno::Reference<beans::XPropertySet> xPropertySet(xRangeEnum->nextElement(), uno::UNO_QUERY);
153 CPPUNIT_ASSERT_EQUAL(sal_Int32(36), getProperty<sal_Int32>(xPropertySet, "CharEscapement"));
154 CPPUNIT_ASSERT_EQUAL(sal_Int32(100),
155 getProperty<sal_Int32>(xPropertySet, "CharEscapementHeight"));
157 // Second paragraph: Word vs Writer border default problem
158 CPPUNIT_ASSERT_EQUAL(
159 sal_uInt32(26),
160 getProperty<table::BorderLine2>(xParaEnum->nextElement(), "TopBorder").LineWidth);
162 // Finally, make sure that we have two pages
163 CPPUNIT_ASSERT_EQUAL(2, getPages());
166 DECLARE_RTFEXPORT_TEST(testN751020, "n751020.rtf")
168 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
169 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
170 uno::UNO_QUERY);
171 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
172 CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
173 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(200)),
174 getProperty<sal_Int32>(xParaEnum->nextElement(), "ParaBottomMargin"));
177 DECLARE_RTFEXPORT_TEST(testFdo79384, "fdo79384.rtf")
179 uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
181 CPPUNIT_ASSERT_EQUAL(OUString(u"Маркеры спискамЫ"), xTextRange->getString());
184 DECLARE_RTFEXPORT_TEST(testFdo47326, "fdo47326.rtf")
186 // This was 15 only, as \super buffered text, then the contents of it got lost.
187 CPPUNIT_ASSERT_EQUAL(19, getLength());
190 DECLARE_RTFEXPORT_TEST(testFdo46955, "fdo46955.rtf")
192 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
193 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
194 uno::UNO_QUERY);
195 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
196 while (xParaEnum->hasMoreElements())
198 uno::Reference<container::XEnumerationAccess> xRangeEnumAccess(xParaEnum->nextElement(),
199 uno::UNO_QUERY);
200 uno::Reference<container::XEnumeration> xRangeEnum = xRangeEnumAccess->createEnumeration();
201 while (xRangeEnum->hasMoreElements())
202 CPPUNIT_ASSERT_EQUAL(style::CaseMap::UPPERCASE,
203 getProperty<sal_Int16>(xRangeEnum->nextElement(), "CharCaseMap"));
207 DECLARE_RTFEXPORT_TEST(testFdo81892, "fdo81892.rtf")
209 // table was not centered
210 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
211 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
212 uno::UNO_QUERY);
213 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
214 CPPUNIT_ASSERT_EQUAL(text::HoriOrientation::CENTER,
215 getProperty<sal_Int16>(xTable, "HoriOrient"));
217 // fdo#81893: paragraph with \page was not centered
218 uno::Reference<text::XTextRange> xPara(getParagraph(2, "Performance"));
219 CPPUNIT_ASSERT_EQUAL(
220 style::ParagraphAdjust_CENTER,
221 static_cast<style::ParagraphAdjust>(getProperty<sal_Int16>(xPara, "ParaAdjust")));
224 DECLARE_RTFEXPORT_TEST(testFdo45394, "fdo45394.rtf")
226 uno::Reference<text::XText> xHeaderText = getProperty<uno::Reference<text::XText>>(
227 getStyles("PageStyles")->getByName("Standard"), "HeaderText");
228 OUString aActual = xHeaderText->getString();
229 // Encoding in the header was wrong.
230 CPPUNIT_ASSERT_EQUAL(OUString(u"\u041F\u041A \u0420\u0418\u041A"), aActual);
232 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
233 uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
234 uno::UNO_QUERY);
235 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
238 DECLARE_RTFEXPORT_TEST(testFdo48104, "fdo48104.rtf") { CPPUNIT_ASSERT_EQUAL(2, getPages()); }
240 DECLARE_RTFEXPORT_TEST(testFdo47107, "fdo47107.rtf")
242 uno::Reference<container::XNameAccess> xNumberingStyles(getStyles("NumberingStyles"));
243 // Make sure numbered and bullet legacy syntax is recognized, this used to throw a NoSuchElementException
244 xNumberingStyles->getByName("WWNum1");
245 xNumberingStyles->getByName("WWNum2");
248 DECLARE_RTFEXPORT_TEST(testFdo44176, "fdo44176.rtf")
250 uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
251 uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"),
252 uno::UNO_QUERY);
253 uno::Reference<beans::XPropertySet> xDefault(xPageStyles->getByName("Standard"),
254 uno::UNO_QUERY);
255 sal_Int32 nFirstTop = 0, nDefaultTop = 0, nDefaultHeader = 0;
256 xFirstPage->getPropertyValue("TopMargin") >>= nFirstTop;
257 xDefault->getPropertyValue("TopMargin") >>= nDefaultTop;
258 xDefault->getPropertyValue("HeaderHeight") >>= nDefaultHeader;
259 CPPUNIT_ASSERT_EQUAL(nFirstTop, nDefaultTop + nDefaultHeader);
262 DECLARE_RTFEXPORT_TEST(testFdo39053, "fdo39053.rtf")
264 int nShapes = getShapes();
265 CPPUNIT_ASSERT_EQUAL(1, nShapes);
266 int nAsCharacter = 0;
267 for (int i = 0; i < nShapes; ++i)
268 if (getProperty<text::TextContentAnchorType>(getShape(i + 1), "AnchorType")
269 == text::TextContentAnchorType_AS_CHARACTER)
270 nAsCharacter++;
271 // The image in binary format was ignored.
272 CPPUNIT_ASSERT_EQUAL(1, nAsCharacter);
275 DECLARE_RTFEXPORT_TEST(testFdo48356, "fdo48356.rtf")
277 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
278 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
279 uno::UNO_QUERY);
280 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
281 int i = 0;
282 while (xParaEnum->hasMoreElements())
284 xParaEnum->nextElement();
285 i++;
287 // The document used to be imported as two paragraphs.
288 CPPUNIT_ASSERT_EQUAL(1, i);
291 CPPUNIT_TEST_FIXTURE(Test, testFdo48023)
293 auto verify = [this]() {
294 uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
296 // Implicit encoding detection based on locale was missing
297 CPPUNIT_ASSERT_EQUAL(
298 OUString(u"\u041F\u0440\u043E\u0433\u0440\u0430\u043C\u043C\u0438\u0441\u0442"),
299 xTextRange->getString());
302 AllSettings aSavedSettings = Application::GetSettings();
303 AllSettings aSettings(aSavedSettings);
304 aSettings.SetLanguageTag(LanguageTag("ru"));
305 Application::SetSettings(aSettings);
306 comphelper::ScopeGuard g([&aSavedSettings] { Application::SetSettings(aSavedSettings); });
308 createSwDoc("fdo48023.rtf");
309 verify();
310 saveAndReload("Rich Text Format");
311 verify();
314 DECLARE_RTFEXPORT_TEST(testFdo48876, "fdo48876.rtf")
316 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
317 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
318 uno::UNO_QUERY);
319 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
320 CPPUNIT_ASSERT(xParaEnum->hasMoreElements());
321 CPPUNIT_ASSERT_EQUAL(
322 style::LineSpacingMode::MINIMUM,
323 getProperty<style::LineSpacing>(xParaEnum->nextElement(), "ParaLineSpacing").Mode);
326 DECLARE_RTFEXPORT_TEST(testFdo48193, "fdo48193.rtf") { CPPUNIT_ASSERT_EQUAL(7, getLength()); }
328 CPPUNIT_TEST_FIXTURE(Test, testFdo44211)
330 auto verify = [this]() {
331 uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
333 CPPUNIT_ASSERT_EQUAL(OUString(u"\u0105\u010D\u0119"), xTextRange->getString());
336 AllSettings aSavedSettings = Application::GetSettings();
337 AllSettings aSettings(aSavedSettings);
338 aSettings.SetLanguageTag(LanguageTag("lt"));
339 Application::SetSettings(aSettings);
340 comphelper::ScopeGuard g([&aSavedSettings] { Application::SetSettings(aSavedSettings); });
342 createSwDoc("fdo44211.rtf");
343 verify();
344 saveAndReload("Rich Text Format");
345 verify();
348 DECLARE_RTFEXPORT_TEST(testFdo48037, "fdo48037.rtf")
350 uno::Reference<util::XNumberFormatsSupplier> xNumberSupplier(mxComponent, uno::UNO_QUERY_THROW);
351 lang::Locale aUSLocale, aFRLocale;
352 aUSLocale.Language = "en";
353 aFRLocale.Language = "fr";
354 sal_Int32 nExpected
355 = xNumberSupplier->getNumberFormats()->addNewConverted("d MMMM yyyy", aUSLocale, aFRLocale);
357 uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
358 uno::Reference<container::XEnumerationAccess> xFieldsAccess(
359 xTextFieldsSupplier->getTextFields());
360 uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
361 uno::Reference<beans::XPropertySet> xPropertySet(xFields->nextElement(), uno::UNO_QUERY);
362 sal_Int32 nActual = 0;
363 xPropertySet->getPropertyValue("NumberFormat") >>= nActual;
365 CPPUNIT_ASSERT_EQUAL(nExpected, nActual);
368 DECLARE_RTFEXPORT_TEST(testFdo47764, "fdo47764.rtf")
370 // \cbpat with zero argument should mean the auto (-1) color, not a default color (black)
371 CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getParagraph(1), "ParaBackColor"));
374 DECLARE_RTFEXPORT_TEST(testFdo38786, "fdo38786.rtf")
376 uno::Reference<text::XTextFieldsSupplier> xTextFieldsSupplier(mxComponent, uno::UNO_QUERY);
377 uno::Reference<container::XEnumerationAccess> xFieldsAccess(
378 xTextFieldsSupplier->getTextFields());
379 uno::Reference<container::XEnumeration> xFields(xFieldsAccess->createEnumeration());
380 // \chpgn was ignored, so exception was thrown
381 xFields->nextElement();
384 DECLARE_RTFEXPORT_TEST(testN757651, "n757651.rtf")
386 // The bug was that due to buggy layout the text expanded to two pages.
387 if (Application::GetDefaultDevice()->IsFontAvailable(u"Times New Roman"))
388 CPPUNIT_ASSERT_EQUAL(1, getPages());
391 DECLARE_RTFEXPORT_TEST(testFdo49501, "fdo49501.rtf")
393 uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"),
394 uno::UNO_QUERY);
396 CPPUNIT_ASSERT_EQUAL(true, getProperty<bool>(xStyle, "IsLandscape"));
397 sal_Int32 nExpected(convertTwipToMm100(567));
398 CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "LeftMargin"));
399 CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "RightMargin"));
400 CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "TopMargin"));
401 CPPUNIT_ASSERT_EQUAL(nExpected, getProperty<sal_Int32>(xStyle, "BottomMargin"));
404 DECLARE_RTFEXPORT_TEST(testFdo49271, "fdo49271.rtf")
406 CPPUNIT_ASSERT_EQUAL(25.f, getProperty<float>(getParagraph(2), "CharHeight"));
409 DECLARE_RTFEXPORT_TEST(testFdo50539, "fdo50539.rtf")
411 // \chcbpat with zero argument should mean the auto (-1) color, not a default color (black)
412 CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getRun(getParagraph(1), 1), "CharBackColor"));
415 DECLARE_RTFEXPORT_TEST(testFdo50665, "fdo50665.rtf")
417 // Access the second run, which is a textfield
418 uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 2), uno::UNO_QUERY);
419 // This used to be the default, as character properties were ignored.
420 CPPUNIT_ASSERT_EQUAL(OUString("Book Antiqua"), getProperty<OUString>(xRun, "CharFontName"));
423 DECLARE_RTFEXPORT_TEST(testFdo49659, "fdo49659.rtf")
425 // Both tables were ignored: 1) was in the header, 2) was ignored due to missing empty par at the end of the doc
426 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
427 uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
428 uno::UNO_QUERY);
429 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
431 // The graphic was also empty
432 uno::Reference<beans::XPropertySet> xGraphic
433 = getProperty<uno::Reference<beans::XPropertySet>>(getShape(1), "Graphic");
434 CPPUNIT_ASSERT_EQUAL(graphic::GraphicType::PIXEL,
435 getProperty<sal_Int8>(xGraphic, "GraphicType"));
438 DECLARE_RTFEXPORT_TEST(testFdo46966, "fdo46966.rtf")
441 * The problem was the top margin was 1440 (1 inch), but it should be 720 (0.5 inch).
443 * xray ThisComponent.StyleFamilies.PageStyles.Default.TopMargin
445 uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"),
446 uno::UNO_QUERY);
447 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(720)),
448 getProperty<sal_Int32>(xPropertySet, "TopMargin"));
451 DECLARE_RTFEXPORT_TEST(testFdo76633, "fdo76633.rtf")
453 // check that there is only a graphic object, not an additional rectangle
454 CPPUNIT_ASSERT_EQUAL(1, getShapes());
455 uno::Reference<lang::XServiceInfo> xShape(getShape(1), uno::UNO_QUERY);
456 CPPUNIT_ASSERT(xShape.is());
457 CPPUNIT_ASSERT(xShape->supportsService("com.sun.star.text.TextGraphicObject"));
460 DECLARE_RTFEXPORT_TEST(testFdo48033, "fdo48033.rtf")
463 * The problem was that the picture (48033) or OLE object (53594) was in the first cell,
464 * instead of the second one.
466 * oTable = ThisComponent.TextTables(0)
467 * oParas = oTable.getCellByName("B1").Text.createEnumeration
468 * oPara = oParas.nextElement
469 * oRuns = oPara.createEnumeration
470 * oRun = oRuns.nextElement
471 * xray oRun.TextPortionType ' Frame, was Text
473 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
474 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
475 uno::UNO_QUERY);
476 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
477 uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
478 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
479 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
480 uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
481 CPPUNIT_ASSERT_EQUAL(OUString("Frame"),
482 getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
485 DECLARE_RTFEXPORT_TEST(testFdo53594, "fdo53594.rtf")
488 * The problem was that the picture (48033) or OLE object (53594) was in the first cell,
489 * instead of the second one.
491 * oTable = ThisComponent.TextTables(0)
492 * oParas = oTable.getCellByName("B1").Text.createEnumeration
493 * oPara = oParas.nextElement
494 * oRuns = oPara.createEnumeration
495 * oRun = oRuns.nextElement
496 * xray oRun.TextPortionType ' Frame, was Text
498 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
499 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
500 uno::UNO_QUERY);
501 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
502 uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
503 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
504 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
505 uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
506 CPPUNIT_ASSERT_EQUAL(OUString("Frame"),
507 getProperty<OUString>(getRun(xPara, 1), "TextPortionType"));
510 DECLARE_RTFEXPORT_TEST(testFdo36089, "fdo36089.rtf")
512 CPPUNIT_ASSERT_EQUAL(sal_Int16(-50),
513 getProperty<sal_Int16>(getRun(getParagraph(1), 2), "CharEscapement"));
516 DECLARE_RTFEXPORT_TEST(testFdo48446, "fdo48446.rtf") { getParagraph(1, u"\u0418\u043C\u044F"); }
518 DECLARE_RTFEXPORT_TEST(testFdo47495, "fdo47495.rtf")
520 // Used to have 4 paragraphs, as a result the original bugdoc had 2 pages instead of 1.
521 CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
524 DECLARE_RTFEXPORT_TEST(testAllGapsWord, "all_gaps_word.rtf")
526 BorderTest borderTest;
527 BorderTest::testTheBorders(mxComponent, false);
530 DECLARE_RTFEXPORT_TEST(testFdo52389, "fdo52389.rtf")
532 // The last '!' character at the end of the document was lost
533 CPPUNIT_ASSERT_EQUAL(6, getLength());
536 DECLARE_RTFEXPORT_TEST(testFdo49655, "fdo49655.rtf")
539 * 49655 :
540 * The problem was that the table was not imported due to the ' ' string in the middle of the table definition.
542 * xray ThisComponent.TextTables.Count 'was 0
544 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
545 uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
546 uno::UNO_QUERY);
547 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
550 DECLARE_RTFEXPORT_TEST(testFdo62805, "fdo62805.rtf")
553 * 62805 :
554 * The problem was that the table was not imported due to the absence of \pard after \row.
555 * The table was instead in a group (the '}' replace the \pard).
557 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
558 uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
559 uno::UNO_QUERY);
560 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xIndexAccess->getCount());
563 DECLARE_RTFEXPORT_TEST(testFdo52475, "fdo52475.rtf")
565 // The problem was that \chcbpat0 resulted in no color, instead of COL_AUTO.
566 CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(getRun(getParagraph(1), 3), "CharBackColor"));
569 DECLARE_RTFEXPORT_TEST(testFdo55493, "fdo55493.rtf")
571 // The problem was that the width of the PNG was detected as 15,24cm, instead of 3.97cm
572 uno::Reference<drawing::XShape> xShape = getShape(1);
573 CPPUNIT_ASSERT_EQUAL(sal_Int32(3969), xShape->getSize().Width);
576 CPPUNIT_TEST_FIXTURE(Test, testCopyPastePageStyle)
578 createSwDoc("copypaste-pagestyle.rtf");
579 // The problem was that RTF import during copy&paste did not ignore page styles.
580 // Once we have more copy&paste tests, makes sense to refactor this to some helper method.
581 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
582 uno::Reference<text::XTextRange> xText = xTextDocument->getText();
583 uno::Reference<text::XTextRange> xEnd = xText->getEnd();
584 paste(u"rtfexport/data/copypaste-pagestyle-paste.rtf", "com.sun.star.comp.Writer.RtfFilter",
585 xEnd);
587 uno::Reference<beans::XPropertySet> xPropertySet(getStyles("PageStyles")->getByName("Standard"),
588 uno::UNO_QUERY);
589 CPPUNIT_ASSERT_EQUAL(sal_Int32(21001),
590 getProperty<sal_Int32>(xPropertySet, "Width")); // Was letter, i.e. 21590
593 CPPUNIT_TEST_FIXTURE(Test, testCopyPasteFootnote)
595 createSwDoc("copypaste-footnote.rtf");
596 // The RTF import did not handle the case when the position wasn't the main document XText, but something different, e.g. a footnote.
597 uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
598 uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
599 uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY);
600 paste(u"rtfexport/data/copypaste-footnote-paste.rtf", "com.sun.star.comp.Writer.RtfFilter",
601 xTextRange);
603 CPPUNIT_ASSERT_EQUAL(OUString("bbb"), xTextRange->getString());
606 CPPUNIT_TEST_FIXTURE(Test, testFdo63428)
608 createSwDoc("hello.rtf");
609 // Pasting content that contained an annotation caused a crash.
610 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
611 uno::Reference<text::XTextRange> xText = xTextDocument->getText();
612 uno::Reference<text::XTextRange> xEnd = xText->getEnd();
613 paste(u"rtfexport/data/fdo63428.rtf", "com.sun.star.comp.Writer.RtfFilter", xEnd);
615 // Additionally, commented range was imported as a normal comment.
616 CPPUNIT_ASSERT_EQUAL(OUString("Annotation"),
617 getProperty<OUString>(getRun(getParagraph(1), 2), "TextPortionType"));
618 CPPUNIT_ASSERT_EQUAL(OUString("AnnotationEnd"),
619 getProperty<OUString>(getRun(getParagraph(1), 4), "TextPortionType"));
622 DECLARE_RTFEXPORT_TEST(testFdo69384, "fdo69384-paste.rtf")
624 // Ensure non-default style is loaded
625 getStyles("ParagraphStyles")->getByName("Text body justified");
626 // Ensure default styles were modified, vs testFdo69384Inserted where it is not
627 uno::Reference<beans::XPropertySet> xPropertySet(
628 getStyles("ParagraphStyles")->getByName("Text body"), uno::UNO_QUERY);
629 CPPUNIT_ASSERT_EQUAL(68.f, getProperty<float>(xPropertySet, "CharHeight"));
632 CPPUNIT_TEST_FIXTURE(Test, testFdo69384Inserted)
634 createSwDoc("hello.rtf");
635 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
636 uno::Reference<text::XTextRange> xText = xTextDocument->getText();
637 uno::Reference<text::XTextRange> xEnd = xText->getEnd();
638 paste(u"rtfexport/data/fdo69384-paste.rtf", "com.sun.star.comp.Writer.RtfFilter", xEnd);
640 // During insert of the RTF document we do not change pre-existing styles
641 // vs testFdo69384 where it is
642 uno::Reference<beans::XPropertySet> xPropertySet(
643 getStyles("ParagraphStyles")->getByName("Text body"), uno::UNO_QUERY);
644 CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(xPropertySet, "CharHeight"));
647 CPPUNIT_TEST_FIXTURE(Test, testFdo61193)
649 createSwDoc("hello.rtf");
650 // Pasting content that contained a footnote caused a crash.
651 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
652 uno::Reference<text::XTextRange> xText = xTextDocument->getText();
653 uno::Reference<text::XTextRange> xEnd = xText->getEnd();
654 paste(u"rtfexport/data/fdo61193.rtf", "com.sun.star.comp.Writer.RtfFilter", xEnd);
657 CPPUNIT_TEST_FIXTURE(Test, testTdf108123)
659 createSwDoc("hello.rtf");
660 // This crashed, the shape push/pop and table manager stack went out of
661 // sync -> we tried to de-reference an empty stack.
662 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
663 uno::Reference<text::XTextRange> xText = xTextDocument->getText();
664 uno::Reference<text::XTextRange> xEnd = xText->getEnd();
665 paste(u"rtfexport/data/tdf108123.rtf", "com.sun.star.comp.Writer.RtfFilter", xEnd);
668 DECLARE_RTFEXPORT_TEST(testShptxtPard, "shptxt-pard.rtf")
670 // The problem was that \pard inside \shptxt caused loss of shape text
671 uno::Reference<text::XText> xText(getShape(1), uno::UNO_QUERY);
672 CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
675 DECLARE_RTFEXPORT_TEST(testDoDhgt, "do-dhgt.rtf")
677 int nShapes = getShapes();
678 CPPUNIT_ASSERT_EQUAL(3, nShapes);
679 for (int i = 0; i < nShapes; ++i)
681 Color nFillColor = getProperty<Color>(getShape(i + 1), "FillColor");
682 if (nFillColor == 0xc0504d) // red
683 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(getShape(i + 1), "ZOrder"));
684 else if (nFillColor == 0x9bbb59) // green
685 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(getShape(i + 1), "ZOrder"));
686 else if (nFillColor == 0x4f81bd) // blue
687 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(getShape(i + 1), "ZOrder"));
691 DECLARE_RTFEXPORT_TEST(testDplinehollow, "dplinehollow.rtf")
693 uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
694 table::BorderLine2 line(getProperty<table::BorderLine2>(xPropertySet, "TopBorder"));
695 CPPUNIT_ASSERT_EQUAL(table::BorderLineStyle::NONE, line.LineStyle);
698 DECLARE_RTFEXPORT_TEST(testLeftmarginDefault, "leftmargin-default.rtf")
700 // The default left/right margin was incorrect when the top margin was set to zero.
701 CPPUNIT_ASSERT_EQUAL(
702 sal_Int32(2540),
703 getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Standard"), "LeftMargin"));
706 DECLARE_RTFEXPORT_TEST(testDppolyline, "dppolyline.rtf")
708 // This was completely ignored, for now, just make sure we have all 4 lines.
709 CPPUNIT_ASSERT_EQUAL(4, getShapes());
712 DECLARE_RTFEXPORT_TEST(testFdo56512, "fdo56512.rtf")
714 uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
715 uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(),
716 uno::UNO_QUERY);
717 uno::Reference<text::XTextRange> xTextRange(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
718 CPPUNIT_ASSERT_EQUAL(OUString(u"\u05E2\u05D5\u05E1\u05E7 \u05DE\u05D5\u05E8\u05E9\u05D4 "),
719 xTextRange->getString());
722 DECLARE_RTFEXPORT_TEST(testFdo52989, "fdo52989.rtf")
724 // Same as n#192129, but for JPEG files.
725 uno::Reference<drawing::XShape> xShape = getShape(1);
726 OString aMessage = "xShape->getSize().Width() = " + OString::number(xShape->getSize().Width);
728 // This was 2, should be 423 (or 369?).
729 CPPUNIT_ASSERT_MESSAGE(aMessage.getStr(), xShape->getSize().Width >= 273);
732 DECLARE_RTFEXPORT_TEST(testFdo54473, "fdo54473.rtf")
734 // The problem was that character styles were not imported due to a typo.
735 CPPUNIT_ASSERT_EQUAL(
736 OUString("Anot"),
737 getProperty<OUString>(getRun(getParagraph(1), 1, "Text "), "CharStyleName"));
738 CPPUNIT_ASSERT_EQUAL(
739 OUString("ForeignTxt"),
740 getProperty<OUString>(getRun(getParagraph(1), 3, "character "), "CharStyleName"));
743 DECLARE_RTFEXPORT_TEST(testFdo49934, "fdo49934.rtf")
745 // Column break without columns defined should be a page break, but it was just ignored.
746 CPPUNIT_ASSERT_EQUAL(2, getPages());
749 DECLARE_RTFEXPORT_TEST(testFdo57886, "fdo57886.rtf")
751 // Was 'int from <?> to <?> <?>'.
752 CPPUNIT_ASSERT_EQUAL(OUString("int from {firstlower} to {firstupper} {firstbody}"),
753 getFormula(getRun(getParagraph(1), 1)));
756 DECLARE_RTFEXPORT_TEST(testFdo58076, "fdo58076.rtf")
758 // An additional section was created, so the default page style didn't have the custom margins.
759 uno::Reference<beans::XPropertySet> xStyle(getStyles("PageStyles")->getByName("Standard"),
760 uno::UNO_QUERY);
761 CPPUNIT_ASSERT_EQUAL(sal_Int32(2251), getProperty<sal_Int32>(xStyle, "LeftMargin"));
762 CPPUNIT_ASSERT_EQUAL(sal_Int32(1752), getProperty<sal_Int32>(xStyle, "RightMargin"));
763 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "TopMargin"));
764 CPPUNIT_ASSERT_EQUAL(sal_Int32(635), getProperty<sal_Int32>(xStyle, "BottomMargin"));
767 DECLARE_RTFEXPORT_TEST(testFdo57678, "fdo57678.rtf")
769 // Paragraphs of the two tables were not converted to tables.
770 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
771 uno::Reference<container::XIndexAccess> xIndexAccess(xTextTablesSupplier->getTextTables(),
772 uno::UNO_QUERY);
773 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
776 DECLARE_RTFEXPORT_TEST(testFdo54612, "fdo54612.rtf")
778 // \dpptx without a \dppolycount caused a crash.
779 CPPUNIT_ASSERT_EQUAL(8, getShapes());
782 DECLARE_RTFEXPORT_TEST(testFdo58933, "fdo58933.rtf")
784 // The problem was that the table had an additional cell in its first line.
785 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
786 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
787 uno::UNO_QUERY);
788 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
789 // This was 4.
790 CPPUNIT_ASSERT_EQUAL(sal_Int32(3), xTable->getCellNames().getLength());
793 DECLARE_RTFEXPORT_TEST(testFdo44053, "fdo44053.rtf")
795 uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
796 uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
797 uno::UNO_QUERY);
798 uno::Reference<text::XTextTable> xTextTable(xTables->getByIndex(0), uno::UNO_QUERY);
799 uno::Reference<table::XTableRows> xTableRows = xTextTable->getRows();
800 // The with of the table's A1 and A2 cell should equal.
801 CPPUNIT_ASSERT_EQUAL(getProperty<uno::Sequence<text::TableColumnSeparator>>(
802 xTableRows->getByIndex(0), "TableColumnSeparators")[0]
803 .Position,
804 getProperty<uno::Sequence<text::TableColumnSeparator>>(
805 xTableRows->getByIndex(1), "TableColumnSeparators")[0]
806 .Position);
809 DECLARE_RTFEXPORT_TEST(testFdo48440, "fdo48440.rtf")
811 // Page break was ignored.
812 CPPUNIT_ASSERT_EQUAL(2, getPages());
815 DECLARE_RTFEXPORT_TEST(testFdo58646line, "fdo58646line.rtf")
817 // \line symbol was ignored
818 getParagraph(1, "foo\nbar");
821 DECLARE_RTFEXPORT_TEST(testFdo78502, "fdo78502.rtf")
823 // ";" separators were inserted as text
824 getParagraph(1, "foo");
827 DECLARE_RTFEXPORT_TEST(testFdo58646, "fdo58646.rtf")
829 // Page break was ignored inside a continuous section, on title page.
830 CPPUNIT_ASSERT_EQUAL(2, getPages());
833 DECLARE_RTFEXPORT_TEST(testFdo59419, "fdo59419.rtf")
835 // Junk to be ignored broke import of the table.
836 uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
837 uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
838 uno::UNO_QUERY);
839 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTables->getCount());
842 DECLARE_RTFEXPORT_TEST(testHexCRLF, "hexcrlf.rtf")
844 // hex-escaped \r and \n should create a paragraph break
845 getParagraph(1, "foo");
846 getParagraph(2, "bar");
847 getParagraph(3, "baz");
848 getParagraph(4, "");
849 getParagraph(5, "quux");
852 DECLARE_RTFEXPORT_TEST(testFdo58076_2, "fdo58076-2.rtf")
854 // Position of the picture wasn't correct.
855 CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(8345)),
856 getProperty<sal_Int32>(getShape(1), "HoriOrientPosition"));
859 DECLARE_RTFEXPORT_TEST(testFdo59638, "fdo59638.rtf")
861 // The problem was that w:lvlOverride inside w:num was ignores by dmapper.
863 uno::Reference<beans::XPropertySet> xPropertySet(
864 getStyles("NumberingStyles")->getByName("WWNum1"), uno::UNO_QUERY);
865 uno::Reference<container::XIndexAccess> xLevels(
866 xPropertySet->getPropertyValue("NumberingRules"), uno::UNO_QUERY);
867 uno::Sequence<beans::PropertyValue> aProps;
868 xLevels->getByIndex(0) >>= aProps; // 1st level
870 for (beans::PropertyValue const& rProp : std::as_const(aProps))
872 if (rProp.Name == "BulletChar")
874 // Was '*', should be 'o'.
875 CPPUNIT_ASSERT_EQUAL(OUString(u"\uF0B7"), rProp.Value.get<OUString>());
876 return;
879 CPPUNIT_FAIL("no BulletChar property");
882 DECLARE_RTFEXPORT_TEST(testFdo60722, "fdo60722.rtf")
884 // The problem was that the larger shape was over the smaller one, and not the other way around.
885 uno::Reference<beans::XPropertySet> xShape(getShape(1), uno::UNO_QUERY);
886 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xShape, "ZOrder"));
887 CPPUNIT_ASSERT_EQUAL(OUString("larger"), getProperty<OUString>(xShape, "Description"));
889 xShape.set(getShape(2), uno::UNO_QUERY);
890 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder"));
891 CPPUNIT_ASSERT_EQUAL(OUString("smaller"), getProperty<OUString>(xShape, "Description"));
893 // Color of the line was blue, and it had zero width.
894 xShape.set(getShape(3), uno::UNO_QUERY);
895 CPPUNIT_ASSERT_EQUAL(sal_uInt32(26), getProperty<sal_uInt32>(xShape, "LineWidth"));
896 CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty<Color>(xShape, "LineColor"));
899 DECLARE_RTFEXPORT_TEST(testDoDhgtOld, "do-dhgt-old.rtf")
901 // The file contains 3 shapes which have the same dhgt (z-order).
902 // Test that the order is 1) a 2) black rectangle 3) b, and not something else
903 uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY);
904 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xShape, "ZOrder"));
905 CPPUNIT_ASSERT_EQUAL(OUString("a"), xShape->getString());
907 xShape.set(getShape(2), uno::UNO_QUERY);
908 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xShape, "ZOrder"));
909 CPPUNIT_ASSERT_EQUAL(COL_BLACK, getProperty<Color>(xShape, "FillColor"));
911 xShape.set(getShape(3), uno::UNO_QUERY);
912 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xShape, "ZOrder"));
913 CPPUNIT_ASSERT_EQUAL(OUString("b"), xShape->getString());
916 DECLARE_RTFEXPORT_TEST(testFdo61909, "fdo61909.rtf")
918 uno::Reference<text::XTextRange> xTextRange = getRun(getParagraph(1), 1);
919 // Was the Writer default font.
920 CPPUNIT_ASSERT_EQUAL(OUString("Courier New"),
921 getProperty<OUString>(xTextRange, "CharFontName"));
922 CPPUNIT_ASSERT_EQUAL(COL_AUTO, getProperty<Color>(xTextRange, "CharBackColor"));
925 DECLARE_RTFEXPORT_TEST(testFdo62288, "fdo62288.rtf")
927 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
928 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
929 uno::UNO_QUERY);
930 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
931 uno::Reference<text::XTextRange> xCell(xTable->getCellByName("B1"), uno::UNO_QUERY);
932 uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xCell->getText(), uno::UNO_QUERY);
933 uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
934 uno::Reference<text::XTextRange> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
935 // Margins were inherited from the previous cell, even there was a \pard there.
936 CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin"));
939 DECLARE_RTFEXPORT_TEST(testFdo37716, "fdo37716.rtf")
941 uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
942 uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(),
943 uno::UNO_QUERY);
944 // \nowrap got ignored, so Surround was text::WrapTextMode_PARALLEL
945 CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE,
946 getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround"));
949 DECLARE_RTFEXPORT_TEST(testFdo51916, "fdo51916.rtf")
951 // Complex nested table caused a crash.
954 CPPUNIT_PLUGIN_IMPLEMENT();
956 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */