1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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 */
9
10 #include <swmodeltestbase.hxx>
11
12 #include <com/sun/star/text/XFootnote.hpp>
13 #include <com/sun/star/text/XFootnotesSupplier.hpp>
14 #include <com/sun/star/text/TextContentAnchorType.hpp>
15 #include <com/sun/star/awt/FontWeight.hpp>
16 #include <com/sun/star/text/XEndnotesSupplier.hpp>
17 #include <com/sun/star/text/XTextField.hpp>
18 #include <com/sun/star/text/XTextFieldsSupplier.hpp>
19 #include <com/sun/star/text/XTextTablesSupplier.hpp>
20 #include <com/sun/star/text/XTextTable.hpp>
21 #include <com/sun/star/text/XTextDocument.hpp>
22 #include <com/sun/star/style/TabStop.hpp>
23
24 #include <comphelper/sequenceashashmap.hxx>
25 #include <tools/UnitConversion.hxx>
26
27 using namespace css;
28
29 class Test : public SwModelTestBase
30 {
31 public:
Test()32 Test()
33 : SwModelTestBase("/sw/qa/extras/rtfexport/data/", "Rich Text Format")
34 {
35 }
36 };
37
38 DECLARE_RTFEXPORT_TEST(testTdf100961_fixedDateTime, "tdf100961_fixedDateTime.rtf")
39 {
40 // This should be a fixed date/time field, not the current time.
41 getParagraph(1, "05.01.19 04:06:08");
42
43 uno::Reference<text::XTextFieldsSupplier> xTFS(mxComponent, uno::UNO_QUERY);
44 uno::Reference<container::XEnumeration> xFields(xTFS->getTextFields()->createEnumeration());
45 CPPUNIT_ASSERT_MESSAGE("constant time", getProperty<bool>(xFields->nextElement(), "IsFixed"));
46 }
47
48 DECLARE_RTFEXPORT_TEST(testTdf108949, "tdf108949_footnoteCharFormat.odt")
49 {
50 CPPUNIT_ASSERT_EQUAL(1, getPages());
51 CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(),
52 getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
53
54 uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
55 uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
56
57 uno::Reference<text::XText> xFootnoteText;
58 xFootnotes->getByIndex(0) >>= xFootnoteText;
59 // This was green (0x00A800), the character property of the footnote character, not the footnote text
60 CPPUNIT_ASSERT_MESSAGE(
61 "Footnote Text color",
62 sal_Int32(0x000000) >= getProperty<sal_Int32>(
63 getRun(getParagraphOfText(1, xFootnoteText), 1), "CharColor"));
64 }
65
66 DECLARE_RTFEXPORT_TEST(testTdf108949_footnote, "tdf108949_footnote.rtf")
67 {
68 CPPUNIT_ASSERT_EQUAL_MESSAGE("Paragraph Numbering style", OUString(),
69 getProperty<OUString>(getParagraph(2), "NumberingStyleName"));
70
71 uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY);
72 uno::Reference<container::XIndexAccess> xFootnotes = xFootnotesSupplier->getFootnotes();
73
74 uno::Reference<text::XFootnote> xFootnote;
75 xFootnotes->getByIndex(0) >>= xFootnote;
76 // The color of the footnote anchor was black (0x000000)
77 CPPUNIT_ASSERT_EQUAL_MESSAGE("Footnote Character color", sal_Int32(0xFF0000),
78 getProperty<sal_Int32>(xFootnote->getAnchor(), "CharColor"));
79 }
80
81 DECLARE_RTFEXPORT_TEST(testTdf130817, "tdf130817.rtf")
82 {
83 uno::Reference<text::XEndnotesSupplier> xEndnotesSupplier(mxComponent, uno::UNO_QUERY);
84 uno::Reference<container::XIndexAccess> xEndnotes = xEndnotesSupplier->getEndnotes();
85
86 uno::Reference<text::XFootnote> xEndnote1;
87 xEndnotes->getByIndex(0) >>= xEndnote1;
88 uno::Reference<text::XText> xEndnoteText1;
89 xEndnotes->getByIndex(0) >>= xEndnoteText1;
90 CPPUNIT_ASSERT_EQUAL(OUString("Titolo 1"), xEndnoteText1->getString().trim());
91 CPPUNIT_ASSERT_EQUAL(OUString("$"), xEndnote1->getAnchor()->getString());
92
93 uno::Reference<text::XFootnote> xEndnote2;
94 xEndnotes->getByIndex(1) >>= xEndnote2;
95 uno::Reference<text::XText> xEndnoteText2;
96 xEndnotes->getByIndex(1) >>= xEndnoteText2;
97 CPPUNIT_ASSERT_EQUAL(OUString("Titolo 2"), xEndnoteText2->getString().trim());
98 CPPUNIT_ASSERT_EQUAL(OUString("$"), xEndnote1->getAnchor()->getString());
99 }
100
101 DECLARE_RTFEXPORT_TEST(testTdf137683_charHighlightNone, "tdf137683_charHighlightNone.rtf")
102 {
103 uno::Reference<beans::XPropertySet> xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY_THROW);
104 // This test was failing with a brown charHighlight of 8421376 (0x808000), instead of COL_TRANSPARENT (0xFFFFFFFF)
105 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(COL_AUTO),
106 getProperty<sal_Int32>(xRun, "CharHighlight"));
107 }
108
109 DECLARE_RTFEXPORT_TEST(testTdf116436_tableBackground, "tdf116436_tableBackground.odt")
110 {
111 CPPUNIT_ASSERT_EQUAL(1, getPages());
112 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
113 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
114 uno::UNO_QUERY);
115 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
116 uno::Reference<table::XCell> xCell = xTable->getCellByName("A1");
117 if (mbExported)
118 CPPUNIT_ASSERT_EQUAL(sal_Int32(0xF8DF7C), getProperty<sal_Int32>(xCell, "BackColor"));
119 xCell.set(xTable->getCellByName("A6"));
120 CPPUNIT_ASSERT_EQUAL(sal_Int32(0x81D41A), getProperty<sal_Int32>(xCell, "BackColor"));
121 xCell.set(xTable->getCellByName("B6"));
122 if (mbExported)
123 CPPUNIT_ASSERT_EQUAL(sal_Int32(0xFFFBCC), getProperty<sal_Int32>(xCell, "BackColor"));
124 }
125
126 DECLARE_RTFEXPORT_TEST(testTdf122589_firstSection, "tdf122589_firstSection.odt")
127 {
128 CPPUNIT_ASSERT_EQUAL(1, getPages());
129 uno::Reference<beans::XPropertySet> xPageStyle(getStyles("PageStyles")->getByName("Standard"),
130 uno::UNO_QUERY);
131 uno::Reference<text::XTextRange> xHeaderText
132 = getProperty<uno::Reference<text::XTextRange>>(xPageStyle, "HeaderText");
133 CPPUNIT_ASSERT_EQUAL(OUString("My header"), xHeaderText->getString());
134
135 CPPUNIT_ASSERT_EQUAL_MESSAGE("# of paragraphs", 2, getParagraphs());
136 }
137
138 DECLARE_RTFEXPORT_TEST(testTdf104035, "tdf104035.rtf")
139 {
140 auto aTabStops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops");
141 CPPUNIT_ASSERT(aTabStops.hasElements());
142 // This was 3330 twips instead, as tabs were assumed to be relative.
143 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(convertTwipToMm100(450)), aTabStops[0].Position);
144 }
145
146 DECLARE_RTFEXPORT_TEST(testGraphicObjectFliph, "graphic-object-fliph.rtf")
147 {
148 CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnEvenPages"));
149 CPPUNIT_ASSERT(getProperty<bool>(getShape(1), "HoriMirroredOnOddPages"));
150 }
151
152 DECLARE_RTFEXPORT_TEST(testTdf114333, "tdf114333.rtf")
153 {
154 uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
155 uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
156 uno::UNO_QUERY);
157 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
158 // Check the distance from left
159 CPPUNIT_ASSERT_EQUAL(sal_Int32(8502), getProperty<sal_Int32>(xTable, "LeftMargin"));
160 // This was 17000 = 8502 + 8498 on import, 15240 on export and following import
161 CPPUNIT_ASSERT_EQUAL(sal_Int32(8498), getProperty<sal_Int32>(xTable, "Width"));
162 }
163
164 DECLARE_RTFEXPORT_TEST(testTdf115180, "tdf115180.docx")
165 {
166 // On export to RTF, column separator positions were written without taking base width
167 // into account and then arrived huge, ~64000, which resulted in wrong table and cell widths
168
169 sal_Int32 rowWidth = parseDump("/root/page/body/tab/row/infos/bounds", "width").toInt32();
170 CPPUNIT_ASSERT_EQUAL_MESSAGE("Row width", sal_Int32(9360), rowWidth);
171 sal_Int32 cell1Width
172 = parseDump("/root/page/body/tab/row/cell[1]/infos/bounds", "width").toInt32();
173 CPPUNIT_ASSERT_MESSAGE("First cell width", cell1Width >= 9140);
174 CPPUNIT_ASSERT_MESSAGE("First cell width", cell1Width <= 9142);
175 sal_Int32 cell2Width
176 = parseDump("/root/page/body/tab/row/cell[2]/infos/bounds", "width").toInt32();
177 CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width >= 218);
178 CPPUNIT_ASSERT_MESSAGE("Second cell width", cell2Width <= 220);
179 }
180
181 DECLARE_ODFEXPORT_TEST(testArabicZeroNumbering, "arabic-zero-numbering.rtf")
182 {
183 auto xNumberingRules
184 = getProperty<uno::Reference<container::XIndexAccess>>(getParagraph(1), "NumberingRules");
185 comphelper::SequenceAsHashMap aMap(xNumberingRules->getByIndex(0));
186 // Without the accompanying fix in place, this test would have failed with:
187 // - Expected: 64
188 // - Actual : 4
189 // i.e. numbering type was ARABIC, not ARABIC_ZERO.
190 CPPUNIT_ASSERT_EQUAL(o3tl::narrowing<sal_uInt16>(style::NumberingType::ARABIC_ZERO),
191 aMap["NumberingType"].get<sal_uInt16>());
192 }
193
194 DECLARE_RTFEXPORT_TEST(testTdf116841, "tdf116841.rtf")
195 {
196 // This was 0, left margin was ignored as we assumed the default is already
197 // fine for us.
198 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1270),
199 getProperty<sal_Int32>(getParagraph(1), "ParaLeftMargin"));
200 }
201
202 DECLARE_RTFEXPORT_TEST(testTdf117268, "tdf117268.rtf")
203 {
204 // Here we check that we correctly mimic Word's treatment of erroneous \itap0 inside tables.
205 // Previously, the first table was import as text, and second top-level one only imported
206 // last row with nested table (first row was also imported as text).
207 uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY_THROW);
208 uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
209 uno::UNO_QUERY_THROW);
210
211 // First (simple) table
212 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY_THROW);
213 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
214 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
215 uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY_THROW);
216 CPPUNIT_ASSERT_EQUAL(OUString("Text 1"), xCell->getString());
217
218 // Nested table
219 xTable.set(xTables->getByIndex(1), uno::UNO_QUERY_THROW);
220 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getRows()->getCount());
221 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
222 xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY_THROW);
223 CPPUNIT_ASSERT_EQUAL(OUString("Text 3"), xCell->getString());
224 uno::Reference<beans::XPropertySet> xNestedAnchor(xTable->getAnchor(), uno::UNO_QUERY_THROW);
225 uno::Reference<text::XTextRange> xAnchorCell(xNestedAnchor->getPropertyValue("Cell"),
226 uno::UNO_QUERY_THROW);
227
228 // Outer table
229 xTable.set(xTables->getByIndex(2), uno::UNO_QUERY_THROW);
230 CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
231 CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xTable->getColumns()->getCount());
232 xCell.set(xTable->getCellByName("A1"), uno::UNO_QUERY_THROW);
233 CPPUNIT_ASSERT_EQUAL(OUString("Text 2"), xCell->getString());
234 xCell.set(xTable->getCellByName("A2"), uno::UNO_QUERY_THROW);
235 CPPUNIT_ASSERT_EQUAL(xCell, xAnchorCell);
236 }
237
238 DECLARE_RTFEXPORT_TEST(testTdf117505, "tdf117505.odt")
239 {
240 CPPUNIT_ASSERT_EQUAL(1, getShapes());
241 CPPUNIT_ASSERT_EQUAL(1, getPages());
242 uno::Reference<container::XNameAccess> xPageStyles(getStyles("PageStyles"));
243 uno::Reference<beans::XPropertySet> xFirstPage(xPageStyles->getByName("First Page"),
244 uno::UNO_QUERY);
245 // This was 499, small header height resulted in visible whitespace from
246 // remaining top margin -> header content moved down.
247 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1499),
248 getProperty<sal_Int32>(xFirstPage, "HeaderHeight"));
249 }
250
251 DECLARE_RTFEXPORT_TEST(testTdf112520, "tdf112520.docx")
252 {
253 if (!mbExported)
254 return;
255
256 // Assert that the white shape is on top of the yellow one.
257 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffff00),
258 getProperty<sal_Int32>(getShape(2), "FillColor"));
259 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,
260 getProperty<text::TextContentAnchorType>(getShape(2), "AnchorType"));
261 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xffffff),
262 getProperty<sal_Int32>(getShape(3), "FillColor"));
263 // Without the accompanying fix in place, this test would have failed with
264 // 'expected: 4, actual: 2'.
265 // This means the draw page was 0/at-char/white, 1/at-char/yellow, 2/at-page/white,
266 // instead of the good 0/at-page/white, 1/at-char/yellow, 2/at-char/white.
267 CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,
268 getProperty<text::TextContentAnchorType>(getShape(3), "AnchorType"));
269 }
270
CPPUNIT_TEST_FIXTURE(Test,testNestedHyperlink)271 CPPUNIT_TEST_FIXTURE(Test, testNestedHyperlink)
272 {
273 // Given a hyperlink contains a footnote which contains a hyperlink:
274 {
275 createSwDoc();
276 uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY);
277 uno::Reference<text::XTextContent> xFootnote(
278 xFactory->createInstance("com.sun.star.text.Footnote"), uno::UNO_QUERY);
279 uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
280 uno::Reference<text::XText> xText = xTextDocument->getText();
281 uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor();
282 xText->insertString(xCursor, "a", /*bAbsorb=*/false);
283 xText->insertTextContent(xCursor, xFootnote, /*bAbsorb=*/false);
284 xText->insertString(xCursor, "b", /*bAbsorb=*/false);
285 xCursor->gotoStart(/*bExpand=*/false);
286 xCursor->gotoEnd(/*bExpand=*/true);
287 uno::Reference<beans::XPropertySet> xCursorProps(xCursor, uno::UNO_QUERY);
288 xCursorProps->setPropertyValue("HyperLinkURL", uno::makeAny(OUString("http://body.com/")));
289 uno::Reference<text::XText> xFootnoteText(xFootnote, uno::UNO_QUERY);
290 xCursor = xFootnoteText->createTextCursor();
291 xFootnoteText->insertString(xCursor, "x", /*bAbsorb=*/false);
292 xCursor->gotoStart(/*bExpand=*/false);
293 xCursor->gotoEnd(/*bExpand=*/true);
294 xCursorProps.set(xCursor, uno::UNO_QUERY);
295 xCursorProps->setPropertyValue("HyperLinkURL",
296 uno::makeAny(OUString("http://footnote.com/")));
297 }
298
299 // When exporting to RTF:
300 // Without the accompanying fix in place, this test would have failed with:
301 // assertion failed
302 // - Expression: xComponent.is()
303 // i.e. the RTF output was not well-formed, loading failed.
304 reload(mpFilter, "nested-hyperlink.rtf");
305
306 // Then make sure both hyperlinks are have the correct URLs.
307 uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
308 uno::Reference<text::XTextRange> xPortion = getRun(xParagraph, 1);
309 CPPUNIT_ASSERT_EQUAL(OUString("http://body.com/"),
310 getProperty<OUString>(xPortion, "HyperLinkURL"));
311 auto xFootnote = getProperty<uno::Reference<text::XText>>(getRun(xParagraph, 2), "Footnote");
312 uno::Reference<text::XTextRange> xFootnotePortion = getRun(getParagraphOfText(1, xFootnote), 1);
313 CPPUNIT_ASSERT_EQUAL(OUString("http://footnote.com/"),
314 getProperty<OUString>(xFootnotePortion, "HyperLinkURL"));
315 }
316
317 DECLARE_RTFEXPORT_TEST(testTdf121623, "tdf121623.rtf")
318 {
319 // This was 2, multicolumn section was ignored at the table.
320 CPPUNIT_ASSERT_EQUAL(1, getPages());
321 }
322
323 DECLARE_RTFEXPORT_TEST(testTdf66543, "tdf66543.rtf")
324 {
325 // Without the accompanying fix in place, this test would have failed with
326 // 'Expected: 2; Actual : 3' after import (off-by-one), then with
327 // 'Expected: 2; Actual : 0' (export not implemented).
328 CPPUNIT_ASSERT_EQUAL(sal_Int32(2),
329 getProperty<sal_Int32>(getParagraph(1), "ParaLineNumberStartValue"));
330 }
331
332 DECLARE_RTFEXPORT_TEST(testUlw, "ulw.rtf")
333 {
334 // Test underlying in individual words mode.
335 CPPUNIT_ASSERT(getProperty<bool>(getRun(getParagraph(1), 1), "CharWordMode"));
336 }
337
338 DECLARE_RTFEXPORT_TEST(testTdf122455, "tdf122455.rtf")
339 {
340 // Without the accompanying fix in place, this test would have failed with
341 // 'Expected: 16; Actual : 32', the font size from a list definition
342 // leaked into the first run's character properties.
343 CPPUNIT_ASSERT_EQUAL(16.0, getProperty<double>(getRun(getParagraph(1), 1), "CharHeight"));
344 }
345
346 DECLARE_RTFEXPORT_TEST(testTdf125719_case_1, "tdf125719_case_1.rtf")
347 {
348 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL,
349 getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
350 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL,
351 getProperty<float>(getRun(getParagraph(3), 1), "CharWeight"));
352 }
353
354 DECLARE_RTFEXPORT_TEST(testTdf125719_case_2, "tdf125719_case_2.rtf")
355 {
356 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD,
357 getProperty<float>(getRun(getParagraph(1), 1), "CharWeight"));
358 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD,
359 getProperty<float>(getRun(getParagraph(3), 1), "CharWeight"));
360 CPPUNIT_ASSERT_EQUAL(awt::FontWeight::NORMAL,
361 getProperty<float>(getRun(getParagraph(5), 1), "CharWeight"));
362 }
363
364 DECLARE_RTFEXPORT_TEST(testTabs, "tabs.rtf")
365 {
366 // Test tab alignment in decimal mode.
367 auto aTabStops = getProperty<uno::Sequence<style::TabStop>>(getParagraph(1), "ParaTabStops");
368 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), aTabStops.getLength());
369 const style::TabStop& rTabStop = aTabStops[0];
370 CPPUNIT_ASSERT_EQUAL(style::TabAlign_DECIMAL, rTabStop.Alignment);
371 }
372
373 DECLARE_RTFEXPORT_TEST(testTdf123703, "tdf123703.rtf")
374 {
375 #if !defined(MACOSX)
376 // This was 1, because of normal space character width in consecutive spaces
377 CPPUNIT_ASSERT_EQUAL(2, getPages());
378 #else
379 // still 1 here
380 CPPUNIT_ASSERT_EQUAL(1, getPages());
381 #endif
382 }
383
384 DECLARE_RTFEXPORT_TEST(testTdf123703_stshfdbch, "tdf123703_stshfdbch.rtf")
385 {
386 // still 1 here
387 CPPUNIT_ASSERT_EQUAL(1, getPages());
388 }
389
390 DECLARE_RTFEXPORT_TEST(testTdf123703_compatible, "tdf123703_compatible.rtf")
391 {
392 #if !defined(MACOSX)
393 // in the case of compatibility font id 31505
394 CPPUNIT_ASSERT_EQUAL(2, getPages());
395 #else
396 // still 1 here
397 CPPUNIT_ASSERT_EQUAL(1, getPages());
398 #endif
399 }
400
401 DECLARE_RTFEXPORT_TEST(testTdf128428_monospaced, "tdf128428_monospaced.rtf")
402 {
403 // still 1 here
404 CPPUNIT_ASSERT_EQUAL(1, getPages());
405 }
406
407 DECLARE_RTFEXPORT_TEST(testTdf128428_compatible_monospaced, "tdf128428_compatible_monospaced.rtf")
408 {
409 // still 1 here
410 CPPUNIT_ASSERT_EQUAL(1, getPages());
411 }
412
413 DECLARE_RTFEXPORT_TEST(testTdf128428_dntblnsbdb, "tdf128428_dntblnsbdb.rtf")
414 {
415 // still 1 here
416 CPPUNIT_ASSERT_EQUAL(1, getPages());
417 }
418
CPPUNIT_TEST_FIXTURE(Test,testRtlGutter)419 CPPUNIT_TEST_FIXTURE(Test, testRtlGutter)
420 {
421 auto verify = [this]() {
422 uno::Reference<beans::XPropertySet> xStandard(
423 getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
424 CPPUNIT_ASSERT(getProperty<bool>(xStandard, "RtlGutter"));
425 };
426
427 // Given a document with RTL gutter, when loading it:
428 load(mpTestDocumentPath, "rtl-gutter.rtf");
429 // Then make sure the section's gutter is still RTL:
430 // Without the accompanying fix in place, this test would have failed as \rtlgutter was missing.
431 verify();
432 reload(mpFilter, "rtl-gutter.rtf");
433 verify();
434 }
435
436 CPPUNIT_PLUGIN_IMPLEMENT();
437
438 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
439