tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sw / qa / extras / layout / layout5.cxx
blob1ad056f4b2a780316b3f8a76b19839691fce4fb8
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/text/XTextFrame.hpp>
13 #include <com/sun/star/text/XTextTable.hpp>
14 #include <com/sun/star/text/XTextTablesSupplier.hpp>
15 #include <com/sun/star/linguistic2/XHyphenator.hpp>
16 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
18 #include <comphelper/scopeguard.hxx>
19 #include <unotools/syslocaleoptions.hxx>
20 #include <editeng/unolingu.hxx>
22 #include <rootfrm.hxx>
23 #include <wrtsh.hxx>
24 #include <txtfrm.hxx>
25 #include <IDocumentLayoutAccess.hxx>
26 #include <frameformats.hxx>
27 #include <unotextrange.hxx>
28 #include <fmtanchr.hxx>
30 /// Test to assert layout / rendering result of Writer.
31 class SwLayoutWriter5 : public SwModelTestBase
33 public:
34 SwLayoutWriter5()
35 : SwModelTestBase(u"/sw/qa/extras/layout/data/"_ustr)
40 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf138194)
42 createSwDoc("xaxis-labelbreak.docx");
43 SwDocShell* pShell = getSwDocShell();
45 // Dump the rendering of the first page as an XML file.
46 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
47 MetafileXmlDump dumper;
48 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
49 CPPUNIT_ASSERT(pXmlDoc);
50 // Without the accompanying fix in place, this test would have failed with:
51 // - Expected: 8
52 // - Actual : 7
53 // i.e. the X axis label flowed out of chart area.
54 assertXPath(pXmlDoc, "//textarray", 8);
57 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf146272)
59 createSwDoc("tdf146272.odt");
61 uno::Reference<beans::XPropertySet> xPicture(getShape(2), uno::UNO_QUERY);
62 uno::Reference<beans::XPropertySet> xDrawing(getShape(1), uno::UNO_QUERY);
63 uno::Reference<beans::XPropertySet> xFrame(xDrawing->getPropertyValue(u"TextBoxContent"_ustr),
64 uno::UNO_QUERY);
66 CPPUNIT_ASSERT(xPicture);
67 CPPUNIT_ASSERT(xDrawing);
68 CPPUNIT_ASSERT(xFrame);
70 const sal_uInt64 nPitureZorder = xPicture->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
71 const sal_uInt64 nDrawingZorder = xDrawing->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
72 const sal_uInt64 nFrameZorder = xFrame->getPropertyValue(u"ZOrder"_ustr).get<sal_uInt64>();
74 CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nDrawingZorder < nFrameZorder);
75 CPPUNIT_ASSERT_MESSAGE("Bad ZOrder!", nFrameZorder < nPitureZorder);
78 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf138773)
80 createSwDoc("tdf138773.docx");
81 SwDocShell* pShell = getSwDocShell();
83 // Dump the rendering of the first page as an XML file.
84 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
85 MetafileXmlDump dumper;
86 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
87 CPPUNIT_ASSERT(pXmlDoc);
89 const sal_Int32 nFirstLabelLines
90 = getXPathContent(pXmlDoc, "count(//text[contains(text(),\"2000-01\")])").toInt32();
92 // This failed, if the first X axis label broke to multiple lines.
93 CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), nFirstLabelLines);
96 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf124796)
98 createSwDoc("tdf124796.odt");
99 SwDocShell* pShell = getSwDocShell();
101 // Dump the rendering of the first page as an XML file.
102 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
103 MetafileXmlDump dumper;
104 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
105 CPPUNIT_ASSERT(pXmlDoc);
107 // This failed, if the minimum value of Y axis is not -10.
108 assertXPathContent(pXmlDoc, "(//textarray)[5]/text", u"-10");
110 // This failed, if the maximum value of Y axis is not 15.
111 assertXPathContent(pXmlDoc, "(//textarray)[10]/text", u"15");
114 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf72727)
116 createSwDoc("tdf72727.odt");
117 SwDocShell* pShell = getSwDocShell();
119 // Dump the rendering of the first page as an XML file.
120 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
121 MetafileXmlDump dumper;
122 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
123 CPPUNIT_ASSERT(pXmlDoc);
125 // Without the fix in place, this test would have failed with
126 // - Expected: 1
127 // - Actual : Series1
128 assertXPathContent(pXmlDoc, "(//textarray)[1]/text", u"1");
129 assertXPathContent(pXmlDoc, "(//textarray)[2]/text", u"2");
130 assertXPathContent(pXmlDoc, "(//textarray)[3]/text", u"3");
133 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf130969)
135 createSwDoc("tdf130969.docx");
136 SwDocShell* pShell = getSwDocShell();
138 // Dump the rendering of the first page as an XML file.
139 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
140 MetafileXmlDump dumper;
141 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
142 CPPUNIT_ASSERT(pXmlDoc);
144 // This failed, if the minimum value of Y axis is not 0.35781
145 assertXPathContent(pXmlDoc, "(//textarray)[5]/text", u"0.35781");
148 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf40260)
150 createSwDoc("tdf40260.odt");
151 SwDocShell* pShell = getSwDocShell();
153 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
154 MetafileXmlDump dumper;
155 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
156 CPPUNIT_ASSERT(pXmlDoc);
158 // Without the fix in place, this test would have failed with
159 // - Expected: f(x) = 1.26510397865547E-06 x − 5.95245604996327E-12
160 // - Actual : f(x) = 0 x − 0
161 assertXPathContent(pXmlDoc, "(//textarray)[19]/text",
162 Concat2View("f(x) = 1.26510397865547E-06 x " + OUStringChar(u'\x2212')
163 + " 5.95245604996327E-12"));
166 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf129054)
168 createSwDoc("tdf129054.docx");
169 SwDocShell* pShell = getSwDocShell();
171 // Dump the rendering of the first page as an XML file.
172 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
173 MetafileXmlDump dumper;
174 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
175 CPPUNIT_ASSERT(pXmlDoc);
177 // Test the size of diameter of Pie chart.
178 sal_Int32 nYTop
179 = getXPath(pXmlDoc,
180 "/metafile/push[1]/push[1]/push[1]/push[6]/push[1]/push[4]/polyline[1]/point[1]",
181 "y")
182 .toInt32();
183 sal_Int32 nYBottom
184 = getXPath(
185 pXmlDoc,
186 "/metafile/push[1]/push[1]/push[1]/push[6]/push[1]/push[4]/polyline[1]/point[31]",
187 "y")
188 .toInt32();
189 CPPUNIT_ASSERT_DOUBLES_EQUAL(4615, nYTop - nYBottom, 5);
192 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf129173)
194 createSwDoc("testAreaChartNumberFormat.docx");
195 SwDocShell* pShell = getSwDocShell();
197 // Dump the rendering of the first page as an XML file.
198 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
199 MetafileXmlDump dumper;
200 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
201 CPPUNIT_ASSERT(pXmlDoc);
203 // Check the first data label of area chart.
204 assertXPathContent(pXmlDoc, "(//textarray)[22]/text", u"56");
207 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134866)
209 createSwDoc("tdf134866.docx");
210 SwDocShell* pShell = getSwDocShell();
212 // Dump the rendering of the first page as an XML file.
213 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
214 MetafileXmlDump dumper;
215 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
216 CPPUNIT_ASSERT(pXmlDoc);
218 // Check the data label of pie chart.
219 assertXPathContent(pXmlDoc, "(//textarray)[2]/text", u"100%");
222 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf137116)
224 createSwDoc("tdf137116.docx");
225 SwDocShell* pShell = getSwDocShell();
227 // Dump the rendering of the first page as an XML file.
228 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
229 MetafileXmlDump dumper;
230 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
231 CPPUNIT_ASSERT(pXmlDoc);
232 sal_Int32 nX2 = getXPath(pXmlDoc, "(//textarray)[2]", "x").toInt32(); // second data label
233 sal_Int32 nX4 = getXPath(pXmlDoc, "(//textarray)[4]", "x").toInt32(); // fourth data label
234 // Without the accompanying fix in place, this test would have failed with:
235 // - Expected: 1229
236 // - Actual : -225
237 // - Delta : 100
238 // i.e. the second data label appeared inside the pie slice.
239 CPPUNIT_ASSERT_DOUBLES_EQUAL(1117, nX2 - nX4, 100);
242 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf137154)
244 createSwDoc("tdf137154.docx");
245 SwDocShell* pShell = getSwDocShell();
247 // Dump the rendering of the first page as an XML file.
248 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
249 MetafileXmlDump dumper;
250 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
251 CPPUNIT_ASSERT(pXmlDoc);
252 sal_Int32 nX1 = getXPath(pXmlDoc, "(//textarray)[1]", "x").toInt32(); // first data label
253 sal_Int32 nX4 = getXPath(pXmlDoc, "(//textarray)[4]", "x").toInt32(); // fourth data label
254 // Without the accompanying fix in place, this test would have failed with:
255 // - Expected: 10865
256 // - Actual : 10252
257 // - Delta : 50
258 // i.e. the first data label appeared too close to the pie.
259 CPPUNIT_ASSERT_DOUBLES_EQUAL(nX4, nX1, 50);
262 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf138777)
264 createSwDoc("outside_long_data_label.docx");
265 SwDocShell* pShell = getSwDocShell();
267 // Dump the rendering of the first page as an XML file.
268 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
269 MetafileXmlDump dumper;
270 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
271 CPPUNIT_ASSERT(pXmlDoc);
273 const sal_Int32 nFirstLabelLines
274 = getXPathContent(pXmlDoc, "count(//text[contains(text(),\"really\")])").toInt32();
276 // This failed, if the first data label didn't break to multiple lines.
277 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(1), nFirstLabelLines);
280 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf130031)
282 createSwDoc("tdf130031.docx");
283 SwDocShell* pShell = getSwDocShell();
285 // Dump the rendering of the first page as an XML file.
286 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
287 MetafileXmlDump dumper;
288 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
289 CPPUNIT_ASSERT(pXmlDoc);
290 sal_Int32 nY = getXPath(pXmlDoc, "(//textarray)[11]", "y").toInt32();
291 // Without the accompanying fix in place, this test would have failed with:
292 // - Expected: 4653
293 // - Actual : 2182
294 // - Delta : 50
295 // i.e. the data label appeared above the data point.
296 CPPUNIT_ASSERT_DOUBLES_EQUAL(4653, nY, 50);
299 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf130242)
301 createSwDoc("tdf130242.odt");
302 SwDocShell* pShell = getSwDocShell();
304 // Dump the rendering of the first page as an XML file.
305 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
306 MetafileXmlDump dumper;
307 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
308 CPPUNIT_ASSERT(pXmlDoc);
309 sal_Int32 nY = getXPath(pXmlDoc, "(//textarray)[11]", "y").toInt32();
310 // Without the accompanying fix in place, this test would have failed with:
311 // - Expected: 5758
312 // - Actual : 3352
313 // - Delta : 50
314 // i.e. the data label appeared above the data point.
315 CPPUNIT_ASSERT_DOUBLES_EQUAL(5758, nY, 50);
317 nY = getXPath(pXmlDoc, "(//textarray)[13]", "y").toInt32();
318 // Without the accompanying fix in place, this test would have failed with:
319 // - Expected: 2335
320 // - Actual : 2343
321 // - Delta : 50
322 // i.e. the data label appeared above the data point.
323 CPPUNIT_ASSERT_DOUBLES_EQUAL(2335, nY, 50);
326 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134121)
328 createSwDoc("piechart_leaderline.odt");
329 SwDocShell* pShell = getSwDocShell();
331 // Dump the rendering of the first page as an XML file.
332 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
333 MetafileXmlDump dumper;
334 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
335 CPPUNIT_ASSERT(pXmlDoc);
337 // Check the custom leader line on pie chart.
338 assertXPath(pXmlDoc, "//polyline", 1);
341 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf138018)
343 createSwDoc("tdf138018.docx");
344 SwDocShell* pShell = getSwDocShell();
346 // Dump the rendering of the first page as an XML file.
347 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
348 MetafileXmlDump dumper;
349 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
350 CPPUNIT_ASSERT(pXmlDoc);
351 // Without the accompanying fix in place, this test would have failed with:
352 // - Expected: 2
353 // - Actual : 3
354 // i.e. the leader line was visible.
355 assertXPath(pXmlDoc, "//polyline", 2);
358 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf130380)
360 createSwDoc("tdf130380.docx");
361 SwDocShell* pShell = getSwDocShell();
363 // Dump the rendering of the first page as an XML file.
364 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
365 MetafileXmlDump dumper;
366 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
367 CPPUNIT_ASSERT(pXmlDoc);
368 sal_Int32 nY = getXPath(pXmlDoc,
369 "/metafile/push[1]/push[1]/push[1]/push[6]/push[1]/push[1]/polypolygon/"
370 "polygon/point[1]",
371 "y")
372 .toInt32();
373 // Without the accompanying fix in place, this test would have failed with:
374 // - Expected: 6727
375 // - Actual : 4411
376 // - Delta : 50
377 // i.e. the area chart shrank.
378 CPPUNIT_ASSERT_DOUBLES_EQUAL(6727, nY, 50);
381 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf129095)
383 createSwDoc("tdf129095.docx");
384 SwDocShell* pShell = getSwDocShell();
386 // Dump the rendering of the first page as an XML file.
387 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
388 MetafileXmlDump dumper;
389 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
390 CPPUNIT_ASSERT(pXmlDoc);
392 // check the inner chart area (relative size) visibility with testing the X axis label
393 assertXPathContent(pXmlDoc, "//textarray/text", u"Category 1");
396 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf132956)
398 createSwDoc("tdf132956.docx");
399 SwDocShell* pShell = getSwDocShell();
401 // Dump the rendering of the first page as an XML file.
402 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
403 MetafileXmlDump dumper;
404 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
405 CPPUNIT_ASSERT(pXmlDoc);
407 // check the inner chart area (default size) visibility with testing the X axis label
408 assertXPathContent(pXmlDoc, "//textarray/text", u"Category 1");
411 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf137819)
413 // Open the bugdoc and check if it went wrong
414 createSwDoc("tdf137819.fodt");
416 // Change the anchor if the textbox to As_char
417 uno::Reference<beans::XPropertySet> xShapePropSet(getShape(1), uno::UNO_QUERY);
418 xShapePropSet->setPropertyValue(
419 u"AnchorType"_ustr,
420 uno::Any(text::TextContentAnchorType::TextContentAnchorType_AS_CHARACTER));
422 // Make the layout xml dump after the change
423 auto pXml = parseLayoutDump();
424 auto sTextRightSidePosition
425 = getXPath(pXml, "/root/page/body/txt[6]/anchored/fly/infos/bounds", "right");
426 auto sShapeRightSidePosition
427 = getXPath(pXml, "/root/page/body/txt[6]/anchored/SwAnchoredDrawObject/bounds", "right");
428 // Before the textframe did not follow the shape, now it supposed to
429 // so the right side of the shape must be greater than the right side of
430 // textframe:
431 CPPUNIT_ASSERT(sTextRightSidePosition.toInt32() < sShapeRightSidePosition.toInt32());
434 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testParagraphMarkInCell)
436 createSwDoc("572-min.rtf");
438 uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
439 uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(
440 xModel->getCurrentController(), uno::UNO_QUERY);
441 uno::Reference<beans::XPropertySet> xViewSettings(xViewSettingsSupplier->getViewSettings());
442 uno::Any aOldHidden{ xViewSettings->getPropertyValue(u"ShowHiddenCharacters"_ustr) };
443 uno::Any aOldNon{ xViewSettings->getPropertyValue(u"ShowNonprintingCharacters"_ustr) };
444 comphelper::ScopeGuard g([&] {
445 xViewSettings->setPropertyValue(u"ShowHiddenCharacters"_ustr, aOldHidden);
446 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, aOldNon);
449 xViewSettings->setPropertyValue(u"ShowHiddenCharacters"_ustr, uno::Any(true));
450 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, uno::Any(true));
453 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
454 assertXPath(pXmlDoc, "/root/page/body/txt[1]/infos/bounds", "height", u"230");
455 assertXPath(pXmlDoc, "/root/page/body/tab[1]/row[1]/infos/bounds", "height", u"690");
456 assertXPath(pXmlDoc, "/root/page/body/tab[1]/row[2]/infos/bounds", "height", u"230");
457 assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds", "height", u"230");
460 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, uno::Any(false));
463 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
464 assertXPath(pXmlDoc, "/root/page/body/txt[1]/infos/bounds", "height", u"230");
465 // the problem was that the table rows were not hidden
466 assertXPath(pXmlDoc, "/root/page/body/tab[1]/row[1]/infos/bounds", "height", u"0");
467 assertXPath(pXmlDoc, "/root/page/body/tab[1]/row[2]/infos/bounds", "height", u"0");
468 assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds", "height", u"230");
471 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, uno::Any(true));
474 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
475 assertXPath(pXmlDoc, "/root/page/body/txt[1]/infos/bounds", "height", u"230");
476 assertXPath(pXmlDoc, "/root/page/body/tab[1]/row[1]/infos/bounds", "height", u"690");
477 assertXPath(pXmlDoc, "/root/page/body/tab[1]/row[2]/infos/bounds", "height", u"230");
478 assertXPath(pXmlDoc, "/root/page/body/txt[2]/infos/bounds", "height", u"230");
482 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testParagraphMarkLineHeight)
484 createSwDoc("A020-min.rtf");
486 uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
487 uno::Reference<view::XViewSettingsSupplier> xViewSettingsSupplier(
488 xModel->getCurrentController(), uno::UNO_QUERY);
489 uno::Reference<beans::XPropertySet> xViewSettings(xViewSettingsSupplier->getViewSettings());
490 uno::Any aOldHidden{ xViewSettings->getPropertyValue(u"ShowHiddenCharacters"_ustr) };
491 uno::Any aOldNon{ xViewSettings->getPropertyValue(u"ShowNonprintingCharacters"_ustr) };
492 comphelper::ScopeGuard g([&] {
493 xViewSettings->setPropertyValue(u"ShowHiddenCharacters"_ustr, aOldHidden);
494 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, aOldNon);
497 xViewSettings->setPropertyValue(u"ShowHiddenCharacters"_ustr, uno::Any(true));
498 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, uno::Any(true));
501 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
502 assertXPath(pXmlDoc, "/root/page/header/txt[1]/SwParaPortion/SwLineLayout[1]", "height",
503 u"184");
504 assertXPath(pXmlDoc, "/root/page/header/txt[1]/SwParaPortion/SwLineLayout[2]", "height",
505 u"184");
506 assertXPath(pXmlDoc, "/root/page/header/txt[1]/SwParaPortion/SwLineLayout[3]", "height",
507 u"184");
508 assertXPath(pXmlDoc, "/root/page/header/txt[2]/SwParaPortion/SwLineLayout[1]", "height",
509 u"184");
510 assertXPath(pXmlDoc, "/root/page/header/txt[2]/SwParaPortion/SwLineLayout[2]", "height",
511 u"184");
512 assertXPath(pXmlDoc, "/root/page/header/txt[2]/SwParaPortion/SwLineLayout[3]", "height",
513 u"184");
514 assertXPath(pXmlDoc, "/root/page/header/txt[2]/SwParaPortion/SwLineLayout[4]", "height",
515 u"184");
516 assertXPath(pXmlDoc, "/root/page/header/txt[2]/SwParaPortion/SwLineLayout[5]", "height",
517 u"253");
520 xViewSettings->setPropertyValue(u"ShowNonprintingCharacters"_ustr, uno::Any(false));
523 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
524 assertXPath(pXmlDoc, "/root/page/header/txt[1]/SwParaPortion/SwLineLayout[1]", "height",
525 u"253");
529 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf122014)
531 createSwDoc("tdf122014.docx");
532 SwDocShell* pShell = getSwDocShell();
534 // Dump the rendering of the first page as an XML file.
535 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
536 MetafileXmlDump dumper;
537 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
538 CPPUNIT_ASSERT(pXmlDoc);
540 // This failed, if the chart title is aligned to left.
541 sal_Int32 nX1 = getXPath(pXmlDoc, "(//textarray)[13]", "x").toInt32();
542 sal_Int32 nX2 = getXPath(pXmlDoc, "(//textarray)[14]", "x").toInt32();
543 CPPUNIT_ASSERT_GREATER(nX1 + 100, nX2);
546 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134659)
548 createSwDoc("tdf134659.docx");
549 SwDocShell* pShell = getSwDocShell();
551 // Dump the rendering of the first page as an XML file.
552 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
553 MetafileXmlDump dumper;
554 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
555 CPPUNIT_ASSERT(pXmlDoc);
557 // This failed, if the axis label is aligned to left.
558 sal_Int32 nX1 = getXPath(pXmlDoc, "(//textarray)[1]", "x").toInt32();
559 sal_Int32 nX2 = getXPath(pXmlDoc, "(//textarray)[2]", "x").toInt32();
560 CPPUNIT_ASSERT_GREATER(nX1 + 250, nX2);
563 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134235)
565 createSwDoc("tdf134235.docx");
566 SwDocShell* pShell = getSwDocShell();
568 // Dump the rendering of the first page as an XML file.
569 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
570 MetafileXmlDump dumper;
571 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
572 CPPUNIT_ASSERT(pXmlDoc);
573 // Without the accompanying fix in place, this test would have failed with:
574 // - Expected: 14
575 // - Actual : 13
576 // i.e. the chart title flowed out of chart area.
577 assertXPath(pXmlDoc, "//textarray", 14);
580 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134676)
582 createSwDoc("tdf134676.docx");
583 SwDocShell* pShell = getSwDocShell();
585 // Dump the rendering of the first page as an XML file.
586 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
587 MetafileXmlDump dumper;
588 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
589 CPPUNIT_ASSERT(pXmlDoc);
590 // Without the accompanying fix in place, this test would have failed with:
591 // - Expected: 14
592 // - Actual : 13
593 // i.e. the X axis title didn't break to multiple lines.
594 assertXPath(pXmlDoc, "//textarray", 14);
597 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134146)
599 createSwDoc("tdf134146.docx");
600 SwDocShell* pShell = getSwDocShell();
602 // Dump the rendering of the first page as an XML file.
603 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
604 MetafileXmlDump dumper;
605 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
606 CPPUNIT_ASSERT(pXmlDoc);
608 const sal_Int32 nTitleLines
609 = getXPathContent(pXmlDoc, "count(//text[contains(text(),\"Horizontal\")])").toInt32();
611 // Without the accompanying fix in place, this test would have failed.
612 // i.e. the Y axis title didn't break to multiple lines.
613 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(1), nTitleLines);
616 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf136061)
618 createSwDoc("tdf136061.docx");
619 SwDocShell* pShell = getSwDocShell();
621 // Dump the rendering of the first page as an XML file.
622 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
623 MetafileXmlDump dumper;
624 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
625 CPPUNIT_ASSERT(pXmlDoc);
626 // This failed, if the custom text of data label is missing.
627 assertXPathContent(pXmlDoc, "(//textarray)[16]/text", u"Customlabel");
630 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf116925)
632 createSwDoc("tdf116925.docx");
633 SwDocShell* pShell = getSwDocShell();
635 // Dump the rendering of the first page as an XML file.
636 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
637 MetafileXmlDump dumper;
638 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
639 CPPUNIT_ASSERT(pXmlDoc);
641 assertXPathContent(pXmlDoc,
642 "/metafile/push[1]/push[1]/push[1]/push[6]/push[1]/push[3]/textarray/text",
643 u"hello");
644 // This failed, text color was #000000.
645 assertXPath(
646 pXmlDoc,
647 "/metafile/push[1]/push[1]/push[1]/push[6]/push[1]/push[3]/textcolor[@color='#ffffff']", 1);
650 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf117028)
652 createSwDoc("tdf117028.docx");
653 SwDocShell* pShell = getSwDocShell();
655 // Dump the rendering of the first page as an XML file.
656 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
657 MetafileXmlDump dumper;
658 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
659 CPPUNIT_ASSERT(pXmlDoc);
661 // The only polypolygon in the rendering result was the white background we
662 // want to avoid.
663 assertXPath(pXmlDoc, "//polypolygon", 0);
665 // Make sure the text is still rendered.
666 assertXPathContent(pXmlDoc, "//textarray/text", u"Hello");
669 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf106390)
671 createSwDoc("tdf106390.odt");
672 SwDocShell* pShell = getSwDocShell();
674 // Dump the rendering of the first page as an XML file.
675 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
676 MetafileXmlDump dumper;
677 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
678 CPPUNIT_ASSERT(pXmlDoc);
679 sal_Int32 nBottom = getXPath(pXmlDoc, "//sectrectclipregion", "bottom").toInt32();
681 // No end point of line segments shall go below the bottom of the clipping area.
682 const OString sXPath = "//polyline/point[@y>" + OString::number(nBottom) + "]";
684 assertXPath(pXmlDoc, sXPath, 0);
687 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTableExtrusion1)
689 createSwDoc("table-extrusion1.odt");
690 SwDocShell* pShell = getSwDocShell();
692 // Dump the rendering of the first page as an XML file.
693 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
694 MetafileXmlDump dumper;
695 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
696 CPPUNIT_ASSERT(pXmlDoc);
697 sal_Int32 nRight = getXPath(pXmlDoc, "//sectrectclipregion", "right").toInt32();
698 sal_Int32 nLeft = static_cast<sal_Int32>(nRight * 0.95);
700 // Expect table borders in right page margin.
701 const OString sXPath = "//polyline/point[@x>" + OString::number(nLeft) + " and @x<"
702 + OString::number(nRight) + "]";
704 assertXPath(pXmlDoc, sXPath, 4);
707 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTableExtrusion2)
709 createSwDoc("table-extrusion2.odt");
710 SwDocShell* pShell = getSwDocShell();
712 // Dump the rendering of the first page as an XML file.
713 std::shared_ptr<GDIMetaFile> xMetaFile = pShell->GetPreviewMetaFile();
714 MetafileXmlDump dumper;
715 xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile);
716 CPPUNIT_ASSERT(pXmlDoc);
717 // End point position of the outer table.
718 sal_Int32 nX = getXPath(pXmlDoc, "(//polyline[1]/point)[2]", "x").toInt32();
720 // Do not allow inner table extrude outer table.
721 const OString sXPath = "//polyline/point[@x>" + OString::number(nX) + "]";
723 assertXPath(pXmlDoc, sXPath, 0);
726 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf116848)
728 createSwDoc("tdf116848.odt");
729 // This resulted in a layout loop.
730 calcLayout();
733 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf117245)
735 createSwDoc("tdf117245.odt");
736 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
737 // This was 2, TabOverMargin did not use a single line when there was
738 // enough space for the text.
739 assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout", 1);
741 // This was 2, same problem elsewhere due to code duplication.
742 assertXPath(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout", 1);
745 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf118672)
747 createSwDoc("tdf118672.odt");
748 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
750 // Check if we have hyphenation support, otherwise can't test SwHyphPortion.
751 uno::Reference<linguistic2::XHyphenator> xHyphenator = LinguMgr::GetHyphenator();
752 if (!xHyphenator->hasLocale(lang::Locale(u"en"_ustr, u"US"_ustr, OUString())))
753 return;
755 // This ended as "fol*1 2 3 4 5 6 7 8 9", i.e. "10con-" was moved to the next line.
756 // Bizarrely, Word lets the text run into the right margin (loaded from .rtf)
757 assertXPath(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]", "portion",
758 u"He heard quiet steps behind him. That didn't bode well. Who could be fol*1 2 "
759 "3 4 5 6 7 8 9 10consetetur");
762 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf150200)
764 createSwDoc("tdf150200.odt");
765 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
766 // dash
767 OUString sFirstLine
768 = getXPathContent(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]/@portion");
769 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"-(dash)"));
770 CPPUNIT_ASSERT_EQUAL(sal_Int32(93), sFirstLine.getLength());
771 // en-dash
772 sFirstLine
773 = getXPathContent(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[1]/@portion");
774 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"–(en-dash)"));
775 CPPUNIT_ASSERT_EQUAL(sal_Int32(88), sFirstLine.getLength());
776 // em-dash
777 sFirstLine
778 = getXPathContent(pXmlDoc, "/root/page/body/txt[3]/SwParaPortion/SwLineLayout[1]/@portion");
779 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"—(em-dash)"));
780 CPPUNIT_ASSERT_EQUAL(sal_Int32(77), sFirstLine.getLength());
781 // figure dash
782 sFirstLine
783 = getXPathContent(pXmlDoc, "/root/page/body/txt[4]/SwParaPortion/SwLineLayout[1]/@portion");
784 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"‒(figure dash)"));
785 CPPUNIT_ASSERT_EQUAL(sal_Int32(87), sFirstLine.getLength());
788 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf150200_DOCX)
790 createSwDoc("tdf150200.docx");
791 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
792 // dash
793 OUString sFirstLine
794 = getXPathContent(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]/@portion");
795 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"-(dash)"));
796 CPPUNIT_ASSERT_EQUAL(sal_Int32(93), sFirstLine.getLength());
797 // en-dash
798 sFirstLine
799 = getXPathContent(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[1]/@portion");
800 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"–(en-dash)"));
801 CPPUNIT_ASSERT_EQUAL(sal_Int32(88), sFirstLine.getLength());
802 // em-dash
803 sFirstLine
804 = getXPathContent(pXmlDoc, "/root/page/body/txt[3]/SwParaPortion/SwLineLayout[1]/@portion");
805 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"—(em-dash)"));
806 CPPUNIT_ASSERT_EQUAL(sal_Int32(77), sFirstLine.getLength());
807 // figure dash
808 sFirstLine
809 = getXPathContent(pXmlDoc, "/root/page/body/txt[4]/SwParaPortion/SwLineLayout[1]/@portion");
810 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"‒(figure dash)"));
811 CPPUNIT_ASSERT_EQUAL(sal_Int32(87), sFirstLine.getLength());
814 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf150438)
816 createSwDoc("tdf150438.odt");
817 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
818 // left double quotation mark
819 OUString sFirstLine
820 = getXPathContent(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]/@portion");
821 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"“Lorem ipsum"));
822 CPPUNIT_ASSERT_EQUAL(sal_Int32(92), sFirstLine.getLength());
823 // right double quotation mark
824 sFirstLine
825 = getXPathContent(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[1]/@portion");
826 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"”Nunc viverra imperdiet enim."));
827 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), sFirstLine.getLength());
828 // left single quotation mark
829 sFirstLine
830 = getXPathContent(pXmlDoc, "/root/page/body/txt[3]/SwParaPortion/SwLineLayout[1]/@portion");
831 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"‘Aenean nec lorem."));
832 CPPUNIT_ASSERT_EQUAL(sal_Int32(85), sFirstLine.getLength());
833 // right single quotation mark or apostrophe
834 sFirstLine
835 = getXPathContent(pXmlDoc, "/root/page/body/txt[4]/SwParaPortion/SwLineLayout[1]/@portion");
836 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"’Aenean nec lorem."));
837 CPPUNIT_ASSERT_EQUAL(sal_Int32(85), sFirstLine.getLength());
840 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf150438_DOCX)
842 createSwDoc("tdf150438.docx");
843 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
844 // left double quotation mark
845 OUString sFirstLine
846 = getXPathContent(pXmlDoc, "/root/page/body/txt[1]/SwParaPortion/SwLineLayout[1]/@portion");
847 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"“Lorem ipsum"));
848 CPPUNIT_ASSERT_EQUAL(sal_Int32(92), sFirstLine.getLength());
849 // right double quotation mark
850 sFirstLine
851 = getXPathContent(pXmlDoc, "/root/page/body/txt[2]/SwParaPortion/SwLineLayout[1]/@portion");
852 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"”Nunc viverra imperdiet enim."));
853 CPPUNIT_ASSERT_EQUAL(sal_Int32(97), sFirstLine.getLength());
854 // left single quotation mark
855 sFirstLine
856 = getXPathContent(pXmlDoc, "/root/page/body/txt[3]/SwParaPortion/SwLineLayout[1]/@portion");
857 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"‘Aenean nec lorem."));
858 CPPUNIT_ASSERT_EQUAL(sal_Int32(85), sFirstLine.getLength());
859 // right single quotation mark or apostrophe
860 sFirstLine
861 = getXPathContent(pXmlDoc, "/root/page/body/txt[4]/SwParaPortion/SwLineLayout[1]/@portion");
862 CPPUNIT_ASSERT_EQUAL(true, sFirstLine.startsWith(u"’Aenean nec lorem."));
863 CPPUNIT_ASSERT_EQUAL(sal_Int32(85), sFirstLine.getLength());
866 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf117923)
868 createSwDoc("tdf117923.doc");
869 // Ensure that all text portions are calculated before testing.
870 SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
871 CPPUNIT_ASSERT(pViewShell);
872 pViewShell->Reformat();
874 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
876 // Check that we actually test the line we need
877 assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", u"GHI GHI GHI GHI");
878 assertXPath(pXmlDoc,
879 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion",
880 "type", u"PortionType::Number");
881 assertXPath(pXmlDoc,
882 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion",
883 "expand", u"2.");
884 // The numbering height was 960.
885 assertXPath(
886 pXmlDoc,
887 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion/SwFont",
888 "height", u"220");
891 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf127606)
893 createSwDoc("tdf117923.docx");
894 // Ensure that all text portions are calculated before testing.
895 SwViewShell* pViewShell = getSwDoc()->getIDocumentLayoutAccess().GetCurrentViewShell();
896 CPPUNIT_ASSERT(pViewShell);
897 pViewShell->Reformat();
899 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
901 // Check that we actually test the line we need
902 assertXPathContent(pXmlDoc, "/root/page/body/tab/row/cell/txt[3]", u"GHI GHI GHI GHI");
903 assertXPath(pXmlDoc,
904 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion",
905 "type", u"PortionType::Number");
906 assertXPath(pXmlDoc,
907 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion",
908 "expand", u"2.");
909 // The numbering height was 960 in DOC format.
910 assertXPath(
911 pXmlDoc,
912 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion/SwFont",
913 "height", u"220");
915 // tdf#127606: now it's possible to change formatting of numbering
916 // increase font size (220 -> 260)
917 dispatchCommand(mxComponent, u".uno:SelectAll"_ustr, {});
918 dispatchCommand(mxComponent, u".uno:Grow"_ustr, {});
919 pViewShell->Reformat();
920 pXmlDoc = parseLayoutDump();
921 assertXPath(
922 pXmlDoc,
923 "/root/page/body/tab/row/cell/txt[3]/SwParaPortion/SwLineLayout/SwFieldPortion/SwFont",
924 "height", u"260");
927 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf127118)
929 createSwDoc("tdf127118.docx");
930 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
931 // This was Horizontal: merged cell split between pages didn't keep vertical writing direction
932 assertXPath(pXmlDoc, "/root/page[2]/body/tab/row[1]/cell[1]/txt[1]", "WritingMode",
933 u"VertBTLR");
936 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf141220)
938 createSwDoc("tdf141220.docx");
940 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
941 sal_Int32 nShapeTop
942 = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "top").toInt32();
943 sal_Int32 nTextBoxTop = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "top").toInt32();
944 // Make sure the textbox stays inside the shape.
945 CPPUNIT_ASSERT_LESS(static_cast<sal_Int32>(15), nTextBoxTop - nShapeTop);
948 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, TestTextBoxChangeViaUNO)
950 createSwDoc("TextBoxFrame.odt");
951 // this file has a shape and a frame inside. Try to set up
952 // the frame for the shape as textbox. Before this was not
953 // implemented. This will be necessary for proper WPG import.
955 CPPUNIT_ASSERT_EQUAL_MESSAGE("There must be a shape and a frame!", 2, getShapes());
957 CPPUNIT_ASSERT_EQUAL_MESSAGE("This must be a custom shape!",
958 u"com.sun.star.drawing.CustomShape"_ustr,
959 getShape(1)->getShapeType());
960 CPPUNIT_ASSERT_EQUAL_MESSAGE("This must be a frame shape!", u"FrameShape"_ustr,
961 getShape(2)->getShapeType());
963 CPPUNIT_ASSERT_MESSAGE("This is not supposed to be a textbox!",
964 !uno::Reference<beans::XPropertySet>(getShape(1), uno::UNO_QUERY_THROW)
965 ->getPropertyValue(u"TextBox"_ustr)
966 .get<bool>());
967 // Without the fix it will crash at this line:
968 CPPUNIT_ASSERT_MESSAGE("This is not supposed to be a textbox!",
969 !uno::Reference<beans::XPropertySet>(getShape(1), uno::UNO_QUERY_THROW)
970 ->getPropertyValue(u"TextBoxContent"_ustr)
971 .hasValue());
973 // So now set the frame as textbox for the shape!
974 uno::Reference<beans::XPropertySet>(getShape(1), uno::UNO_QUERY_THROW)
975 ->setPropertyValue(u"TextBoxContent"_ustr, uno::Any(uno::Reference<text::XTextFrame>(
976 getShape(2), uno::UNO_QUERY_THROW)));
978 CPPUNIT_ASSERT_MESSAGE("This is supposed to be a textbox!",
979 uno::Reference<beans::XPropertySet>(getShape(1), uno::UNO_QUERY_THROW)
980 ->getPropertyValue(u"TextBox"_ustr)
981 .get<bool>());
983 CPPUNIT_ASSERT_MESSAGE("This is supposed to be a textbox!",
984 uno::Reference<beans::XPropertySet>(getShape(1), uno::UNO_QUERY_THROW)
985 ->getPropertyValue(u"TextBoxContent"_ustr)
986 .hasValue());
989 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf121509)
991 createSwDoc("Tdf121509.odt");
992 auto pDoc = getSwDoc();
994 // Get all shape/frame formats
995 auto vFrameFormats = pDoc->GetSpzFrameFormats();
996 // Get the textbox
997 auto xTextFrame = SwTextBoxHelper::getUnoTextFrame(getShape(1));
998 // Get The triangle
999 auto pTriangleShapeFormat = vFrameFormats->GetFormat(2);
1000 CPPUNIT_ASSERT(xTextFrame);
1001 CPPUNIT_ASSERT(pTriangleShapeFormat);
1003 // Get the position inside the textbox
1004 auto xTextContentStart = xTextFrame->getText()->getStart();
1005 SwUnoInternalPaM aCursor(*pDoc);
1006 CPPUNIT_ASSERT(sw::XTextRangeToSwPaM(aCursor, xTextContentStart));
1008 // Put the triangle into the textbox
1009 SwFormatAnchor aNewAnch(pTriangleShapeFormat->GetAnchor());
1010 aNewAnch.SetAnchor(aCursor.Start());
1011 CPPUNIT_ASSERT(pTriangleShapeFormat->SetFormatAttr(aNewAnch));
1013 save(u"Office Open XML Text"_ustr);
1015 // The second part: check if the reloaded doc has flys inside a fly
1016 // FIXME: if we use 'saveAndReload' or 'loadFromURL' here, it fails with
1017 // Assertion `!m_pFirst && !m_pLast && "There are still indices registered"' failed.
1018 loadFromDesktop(maTempFile.GetURL(), u"com.sun.star.text.TextDocument"_ustr);
1019 auto pSecondDoc = getSwDoc();
1020 auto pSecondFormats = pSecondDoc->GetSpzFrameFormats();
1022 bool bFlyInFlyFound = false;
1023 for (auto secondformat : *pSecondFormats)
1025 const SwNode* pNd = secondformat->GetAnchor().GetAnchorNode();
1026 if (pNd->FindFlyStartNode())
1028 // So there is a fly inside another -> problem.
1029 bFlyInFlyFound = true;
1030 break;
1033 // Drop the tempfile
1034 maTempFile.CloseStream();
1036 // With the fix this cannot be true, if it is, that means Word unable to read the file..
1037 CPPUNIT_ASSERT_MESSAGE("Corrupt exported docx file!", !bFlyInFlyFound);
1040 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf134685)
1042 createSwDoc("tdf134685.docx");
1043 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
1044 sal_Int32 nWidth
1045 = getXPath(pXmlDoc, "/root/page/body/tab/row[6]/cell[1]/infos/bounds", "width").toInt32();
1046 // This was 2223: the content was only partially visible according to the lost cell width
1047 CPPUNIT_ASSERT_GREATER(static_cast<sal_Int32>(14000), nWidth);
1050 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf109077)
1052 createSwDoc("tdf109077.docx");
1053 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
1054 sal_Int32 nShapeTop
1055 = getXPath(pXmlDoc, "//anchored/SwAnchoredDrawObject/bounds", "top").toInt32();
1056 sal_Int32 nTextBoxTop = getXPath(pXmlDoc, "//anchored/fly/infos/bounds", "top").toInt32();
1057 // This was 281: the top of the shape and its textbox should match, though
1058 // tolerate differences <= 1px (about 15 twips).
1059 CPPUNIT_ASSERT_LESS(static_cast<sal_Int32>(15), nTextBoxTop - nShapeTop);
1062 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testUserFieldTypeLanguage)
1064 // Set the system locale to German, the document will be English.
1065 SvtSysLocaleOptions aOptions;
1066 OUString sLocaleConfigString = aOptions.GetLanguageTag().getBcp47();
1067 aOptions.SetLocaleConfigString(u"de-DE"_ustr);
1068 aOptions.Commit();
1069 comphelper::ScopeGuard g1([&aOptions, &sLocaleConfigString] {
1070 aOptions.SetLocaleConfigString(sLocaleConfigString);
1071 aOptions.Commit();
1074 createSwDoc("user-field-type-language.fodt");
1075 SwDoc* pDoc = getSwDoc();
1076 SwViewShell* pViewShell = pDoc->getIDocumentLayoutAccess().GetCurrentViewShell();
1077 pViewShell->UpdateFields();
1078 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
1079 // This was "123,456.00", via a buggy 1234.56 -> 1234,56 -> 123456 ->
1080 // 123,456.00 transform chain.
1081 assertXPath(
1082 pXmlDoc,
1083 "/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion[@type='PortionType::Field']",
1084 "expand", u"1,234.56");
1086 // Now change the system locale to English (before this was failing, 1234,56 -> 0.00)
1087 aOptions.SetLocaleConfigString(u"en-GB"_ustr);
1088 aOptions.Commit();
1089 comphelper::ScopeGuard g2([&aOptions, &sLocaleConfigString] {
1090 aOptions.SetLocaleConfigString(sLocaleConfigString);
1091 aOptions.Commit();
1093 pViewShell->UpdateFields();
1094 pXmlDoc = parseLayoutDump();
1095 // We expect, that the field value is not changed. Otherwise there is a problem:
1096 assertXPath(
1097 pXmlDoc,
1098 "/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion[@type='PortionType::Field']",
1099 "expand", u"1,234.56");
1100 // Now change the system locale to German
1101 aOptions.SetLocaleConfigString(u"de-DE"_ustr);
1102 aOptions.Commit();
1103 comphelper::ScopeGuard g3([&aOptions, &sLocaleConfigString] {
1104 aOptions.SetLocaleConfigString(sLocaleConfigString);
1105 aOptions.Commit();
1107 pViewShell->UpdateFields();
1108 pXmlDoc = parseLayoutDump();
1109 // We expect, that the field value is not changed. Otherwise there is a problem:
1110 assertXPath(
1111 pXmlDoc,
1112 "/root/page/body/txt/SwParaPortion/SwLineLayout/SwFieldPortion[@type='PortionType::Field']",
1113 "expand", u"1,234.56");
1116 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf124261)
1118 #if !defined(_WIN32) && !defined(MACOSX)
1119 // Make sure that pressing a key in a btlr cell frame causes an immediate, correct repaint.
1120 createSwDoc("tdf124261.docx");
1121 SwDoc* pDoc = getSwDoc();
1122 SwRootFrame* pLayout = pDoc->getIDocumentLayoutAccess().GetCurrentLayout();
1123 SwFrame* pPageFrame = pLayout->GetLower();
1124 CPPUNIT_ASSERT(pPageFrame->IsPageFrame());
1126 SwFrame* pBodyFrame = pPageFrame->GetLower();
1127 CPPUNIT_ASSERT(pBodyFrame->IsBodyFrame());
1129 SwFrame* pTabFrame = pBodyFrame->GetLower();
1130 CPPUNIT_ASSERT(pTabFrame->IsTabFrame());
1132 SwFrame* pRowFrame = pTabFrame->GetLower();
1133 CPPUNIT_ASSERT(pRowFrame->IsRowFrame());
1135 SwFrame* pCellFrame = pRowFrame->GetLower();
1136 CPPUNIT_ASSERT(pCellFrame->IsCellFrame());
1138 SwFrame* pFrame = pCellFrame->GetLower();
1139 CPPUNIT_ASSERT(pFrame->IsTextFrame());
1141 // Make sure that the text frame's area and the paint rectangle match.
1142 // Without the accompanying fix in place, this test would have failed with 'Expected: 1721;
1143 // Actual: 1547', i.e. an area other than the text frame was invalidated for a single-line
1144 // paragraph.
1145 SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pFrame);
1146 SwRect aRect = pTextFrame->GetPaintSwRect();
1147 CPPUNIT_ASSERT_EQUAL(pTextFrame->getFrameArea().Top(), aRect.Top());
1148 #endif
1151 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf135991)
1153 createSwDoc("tdf135991.odt");
1154 auto pDump = parseLayoutDump();
1155 // There used to be negative values that made the column frames invisible.
1156 assertXPath(pDump, "//bounds[@top<0]", 0);
1159 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf150642)
1161 createSwDoc("tdf150642.odt");
1162 auto pDump = parseLayoutDump();
1163 // There used to be negative values that made the cell frame invisible.
1164 assertXPath(pDump, "//bounds[@left<0]", 0);
1165 assertXPath(pDump, "//bounds[@right<0]", 0);
1168 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf152085)
1170 createSwDoc("tdf152085-section-tblr.odt");
1171 auto pDump = parseLayoutDump();
1172 sal_Int32 nSectionHeight
1173 = getXPath(pDump, "//section/infos/bounds", "bottom").toInt32(); // was 8391
1174 sal_Int32 nColumnHeight
1175 = getXPath(pDump, "(//column/infos/bounds)[2]", "bottom").toInt32(); // was 16216
1176 CPPUNIT_ASSERT_MESSAGE("The column in a TBRL page should be shorter than the section.",
1177 nColumnHeight <= nSectionHeight);
1180 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf152031)
1182 createSwDoc("tdf152031-stair.odt");
1184 // reproduce the bug by shrinking the table width.
1185 uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY);
1186 uno::Reference<container::XIndexAccess> xTables(xTablesSupplier->getTextTables(),
1187 uno::UNO_QUERY);
1188 uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
1189 // Shrink table width from 5" to 4"
1190 sal_Int32 nWidth = getProperty<sal_Int32>(xTable, u"Width"_ustr) * 4 / 5;
1192 uno::Reference<beans::XPropertySet> xSet(xTable, uno::UNO_QUERY);
1193 xSet->setPropertyValue(u"Width"_ustr, uno::Any(nWidth));
1195 auto pDump = parseLayoutDump();
1196 // There was a stair effect after change the table size.
1197 sal_Int32 nLeft_Row1 = getXPath(pDump, "(//row/infos/bounds)[1]", "left").toInt32();
1198 sal_Int32 nLeft_Row2 = getXPath(pDump, "(//row/infos/bounds)[2]", "left").toInt32();
1199 CPPUNIT_ASSERT_EQUAL_MESSAGE("left values of SwRowFrames should be consistent.", nLeft_Row1,
1200 nLeft_Row2);
1203 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testTdf153136)
1205 createSwDoc("tdf153136.docx");
1206 xmlDocUniquePtr pXmlDoc = parseLayoutDump();
1208 const sal_Int32 small = 300; // Small-height lines are around 276 twip
1209 const sal_Int32 large = 1000; // Large-height lines are 1104 twip or more
1211 // Page 1: standalone paragraphs
1213 // U+0009 CHARACTER TABULATION: height is ignored
1214 sal_Int32 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[1]", "height").toInt32();
1215 CPPUNIT_ASSERT_LESS(small, height);
1217 // U+0020 SPACE: height is ignored
1218 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[2]", "height").toInt32();
1219 CPPUNIT_ASSERT_LESS(small, height);
1221 // U+00A0 NO-BREAK SPACE: height is considered
1222 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[3]", "height").toInt32();
1223 CPPUNIT_ASSERT_GREATER(large, height);
1225 // U+1680 OGHAM SPACE MARK: height is considered; not tested, because Liberation Serif lacks it
1227 // U+2000 EN QUAD: height is considered
1228 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[4]", "height").toInt32();
1229 CPPUNIT_ASSERT_GREATER(large, height);
1231 // U+2001 EM QUAD: height is considered
1232 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[5]", "height").toInt32();
1233 CPPUNIT_ASSERT_GREATER(large, height);
1235 // U+2002 EN SPACE: height is ignored
1236 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[6]", "height").toInt32();
1237 CPPUNIT_ASSERT_LESS(small, height);
1239 // U+2003 EM SPACE: height is ignored
1240 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[7]", "height").toInt32();
1241 CPPUNIT_ASSERT_LESS(small, height);
1243 // U+2004 THREE-PER-EM SPACE: height is considered
1244 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[8]", "height").toInt32();
1245 CPPUNIT_ASSERT_GREATER(large, height);
1247 // U+2005 FOUR-PER-EM SPACE: height is ignored
1248 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[9]", "height").toInt32();
1249 CPPUNIT_ASSERT_LESS(small, height);
1251 // U+2006 SIX-PER-EM SPACE: height is considered
1252 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[10]", "height").toInt32();
1253 CPPUNIT_ASSERT_GREATER(large, height);
1255 // U+2007 FIGURE SPACE: height is considered
1256 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[11]", "height").toInt32();
1257 CPPUNIT_ASSERT_GREATER(large, height);
1259 // U+2008 PUNCTUATION SPACE: height is considered
1260 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[12]", "height").toInt32();
1261 CPPUNIT_ASSERT_GREATER(large, height);
1263 // U+2009 THIN SPACE: height is considered
1264 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[13]", "height").toInt32();
1265 CPPUNIT_ASSERT_GREATER(large, height);
1267 // U+200A HAIR SPACE: height is considered
1268 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[14]", "height").toInt32();
1269 CPPUNIT_ASSERT_GREATER(large, height);
1271 // U+202F NARROW NO-BREAK SPACE: height is considered
1272 height = getXPath(pXmlDoc, "(/root/page[1]//SwLineLayout)[15]", "height").toInt32();
1273 CPPUNIT_ASSERT_GREATER(large, height);
1275 // U+205F MEDIUM MATHEMATICAL SPACE: height is considered; not tested, because Liberation Serif lacks it
1276 // U+3000 IDEOGRAPHIC SPACE: height is ignored; not tested, because Liberation Serif lacks it
1278 // Page 2: table rows (no paragraph-level size DF)
1280 // U+0020 SPACE: height is ignored
1281 height = getXPath(pXmlDoc, "(/root/page[2]//row)[1]/infos/bounds", "height").toInt32();
1282 CPPUNIT_ASSERT_LESS(small, height);
1284 // U+00A0 NO-BREAK SPACE: height is considered (1104 or so)
1285 height = getXPath(pXmlDoc, "(/root/page[2]//row)[2]/infos/bounds", "height").toInt32();
1286 CPPUNIT_ASSERT_GREATER(large, height);
1288 // U+1680 OGHAM SPACE MARK: height is considered; not tested, because Liberation Serif lacks it
1290 // U+2000 EN QUAD: height is considered
1291 height = getXPath(pXmlDoc, "(/root/page[2]//row)[3]/infos/bounds", "height").toInt32();
1292 CPPUNIT_ASSERT_GREATER(large, height);
1294 // U+2001 EM QUAD: height is considered
1295 height = getXPath(pXmlDoc, "(/root/page[2]//row)[4]/infos/bounds", "height").toInt32();
1296 CPPUNIT_ASSERT_GREATER(large, height);
1298 // U+2002 EN SPACE: height is ignored
1299 height = getXPath(pXmlDoc, "(/root/page[2]//row)[5]/infos/bounds", "height").toInt32();
1300 CPPUNIT_ASSERT_LESS(small, height);
1302 // U+2003 EM SPACE: height is ignored
1303 height = getXPath(pXmlDoc, "(/root/page[2]//row)[6]/infos/bounds", "height").toInt32();
1304 CPPUNIT_ASSERT_LESS(small, height);
1306 // U+2004 THREE-PER-EM SPACE: height is considered
1307 height = getXPath(pXmlDoc, "(/root/page[2]//row)[7]/infos/bounds", "height").toInt32();
1308 CPPUNIT_ASSERT_GREATER(large, height);
1310 // U+2005 FOUR-PER-EM SPACE: height is ignored
1311 height = getXPath(pXmlDoc, "(/root/page[2]//row)[8]/infos/bounds", "height").toInt32();
1312 CPPUNIT_ASSERT_LESS(small, height);
1314 // U+2006 SIX-PER-EM SPACE: height is considered
1315 height = getXPath(pXmlDoc, "(/root/page[2]//row)[9]/infos/bounds", "height").toInt32();
1316 CPPUNIT_ASSERT_GREATER(large, height);
1318 // U+2007 FIGURE SPACE: height is considered
1319 height = getXPath(pXmlDoc, "(/root/page[2]//row)[10]/infos/bounds", "height").toInt32();
1320 CPPUNIT_ASSERT_GREATER(large, height);
1322 // U+2008 PUNCTUATION SPACE: height is considered
1323 height = getXPath(pXmlDoc, "(/root/page[2]//row)[11]/infos/bounds", "height").toInt32();
1324 CPPUNIT_ASSERT_GREATER(large, height);
1326 // U+2009 THIN SPACE: height is considered
1327 height = getXPath(pXmlDoc, "(/root/page[2]//row)[12]/infos/bounds", "height").toInt32();
1328 CPPUNIT_ASSERT_GREATER(large, height);
1330 // U+200A HAIR SPACE: height is considered
1331 height = getXPath(pXmlDoc, "(/root/page[2]//row)[13]/infos/bounds", "height").toInt32();
1332 CPPUNIT_ASSERT_GREATER(large, height);
1334 // U+202F NARROW NO-BREAK SPACE: height is considered
1335 height = getXPath(pXmlDoc, "(/root/page[2]//row)[14]/infos/bounds", "height").toInt32();
1336 CPPUNIT_ASSERT_GREATER(large, height);
1338 // U+205F MEDIUM MATHEMATICAL SPACE: height is considered; not tested, because Liberation Serif lacks it
1339 // U+3000 IDEOGRAPHIC SPACE: height is ignored; not tested, because Liberation Serif lacks it
1341 // TODO: page 3, with table having paragraphs with paragraph-level size DF;
1342 // all rows should have large height
1344 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[1]/infos/bounds", "height").toInt32();
1345 // CPPUNIT_ASSERT_GREATER(large, height);
1346 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[2]/infos/bounds", "height").toInt32();
1347 // CPPUNIT_ASSERT_GREATER(large, height);
1348 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[3]/infos/bounds", "height").toInt32();
1349 // CPPUNIT_ASSERT_GREATER(large, height);
1350 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[4]/infos/bounds", "height").toInt32();
1351 // CPPUNIT_ASSERT_GREATER(large, height);
1352 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[5]/infos/bounds", "height").toInt32();
1353 // CPPUNIT_ASSERT_GREATER(large, height);
1354 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[6]/infos/bounds", "height").toInt32();
1355 // CPPUNIT_ASSERT_GREATER(large, height);
1356 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[7]/infos/bounds", "height").toInt32();
1357 // CPPUNIT_ASSERT_GREATER(large, height);
1358 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[8]/infos/bounds", "height").toInt32();
1359 // CPPUNIT_ASSERT_GREATER(large, height);
1360 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[9]/infos/bounds", "height").toInt32();
1361 // CPPUNIT_ASSERT_GREATER(large, height);
1362 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[10]/infos/bounds", "height").toInt32();
1363 // CPPUNIT_ASSERT_GREATER(large, height);
1364 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[11]/infos/bounds", "height").toInt32();
1365 // CPPUNIT_ASSERT_GREATER(large, height);
1366 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[12]/infos/bounds", "height").toInt32();
1367 // CPPUNIT_ASSERT_GREATER(large, height);
1368 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[13]/infos/bounds", "height").toInt32();
1369 // CPPUNIT_ASSERT_GREATER(large, height);
1370 // height = getXPath(pXmlDoc, "(/root/page[3]//row)[14]/infos/bounds", "height").toInt32();
1371 // CPPUNIT_ASSERT_GREATER(large, height);
1374 CPPUNIT_TEST_FIXTURE(SwLayoutWriter5, testFoMargin)
1376 createSwDoc("fomargin.fodt");
1377 auto pXmlDoc = parseLayoutDump();
1379 auto nPage1Width
1380 = getXPath(pXmlDoc, "/root/page[1]/body/txt[1]/infos/bounds", "width").toInt32();
1381 CPPUNIT_ASSERT_GREATER(sal_Int32(9600), nPage1Width);
1382 CPPUNIT_ASSERT_LESS(sal_Int32(9700), nPage1Width);
1384 auto nPage1Height
1385 = getXPath(pXmlDoc, "/root/page[1]/body/txt[1]/infos/bounds", "height").toInt32();
1386 CPPUNIT_ASSERT_GREATER(sal_Int32(13800), nPage1Height);
1387 CPPUNIT_ASSERT_LESS(sal_Int32(14000), nPage1Height);
1389 auto nPage2Width
1390 = getXPath(pXmlDoc, "/root/page[2]/body/txt[1]/infos/bounds", "width").toInt32();
1391 CPPUNIT_ASSERT_GREATER(sal_Int32(9600), nPage2Width);
1392 CPPUNIT_ASSERT_LESS(sal_Int32(9700), nPage2Width);
1394 auto nPage2Height
1395 = getXPath(pXmlDoc, "/root/page[2]/body/txt[1]/infos/bounds", "height").toInt32();
1396 CPPUNIT_ASSERT_GREATER(sal_Int32(13100), nPage2Height);
1397 CPPUNIT_ASSERT_LESS(sal_Int32(13400), nPage2Height);
1400 CPPUNIT_PLUGIN_IMPLEMENT();
1402 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */