diff options
Diffstat (limited to 'sw/qa/core/text')
-rw-r--r-- | sw/qa/core/text/data/footnote-connect.fodt | 132 | ||||
-rw-r--r-- | sw/qa/core/text/text.cxx | 83 |
2 files changed, 215 insertions, 0 deletions
diff --git a/sw/qa/core/text/data/footnote-connect.fodt b/sw/qa/core/text/data/footnote-connect.fodt new file mode 100644 index 000000000..dd26db98c --- /dev/null +++ b/sw/qa/core/text/data/footnote-connect.fodt @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ooo="http://openoffice.org/2004/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:settings> + <config:config-item-set config:name="ooo:configuration-settings"> + <config:config-item config:name="UseFormerTextWrapping" config:type="boolean">false</config:config-item> + <config:config-item config:name="ContinuousEndnotes" config:type="boolean">true</config:config-item> + </config:config-item-set> + </office:settings> + <office:font-face-decls> + <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="roman" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:text-properties style:font-name="Liberation Sans" fo:font-size="12pt"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"> + <style:text-properties style:font-name="Liberation Sans" fo:font-size="12pt"/> + </style:style> + <style:style style:name="Endnote" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:text-properties fo:font-size="10pt" style:font-size-asian="10pt"/> + </style:style> + <style:style style:name="Frame" style:family="graphic"> + </style:style> + </office:styles> + <office:automatic-styles> + <style:style style:name="Table6" style:family="table"> + <style:table-properties style:width="15.983cm" table:align="margins" style:writing-mode="lr-tb"/> + </style:style> + <style:style style:name="Table6.A" style:family="table-column"> + <style:table-column-properties style:column-width="15.983cm" style:rel-column-width="65535*"/> + </style:style> + <style:style style:name="Table6.1" style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:style> + <style:style style:name="Table6.A1" style:family="table-cell"> + <style:table-cell-properties style:vertical-align="top" fo:padding-left="0cm" fo:padding-right="0cm" fo:padding-top="0cm" fo:padding-bottom="0.199cm" fo:border="none" style:writing-mode="lr-tb"/> + </style:style> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard" style:master-page-name="Standard"> + </style:style> + <style:style style:name="P3" style:family="paragraph" style:parent-style-name="Standard"> + <style:paragraph-properties fo:break-before="page"/> + </style:style> + <style:style style:name="fr1" style:family="graphic" style:parent-style-name="Frame"> + <style:graphic-properties fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm" fo:margin-bottom="0cm" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:vertical-pos="from-top" style:vertical-rel="page" style:horizontal-pos="left" style:horizontal-rel="page-content" fo:background-color="#ffffff" style:background-transparency="100%" draw:fill="solid" draw:fill-color="#ffffff" draw:opacity="0%" fo:padding="0cm" fo:border="none" style:writing-mode="lr-tb" draw:wrap-influence-on-position="once-successive" loext:allow-overlap="true"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="1.27cm" fo:margin-bottom="3.071cm" fo:margin-left="3cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="39" style:layout-grid-base-height="0.635cm" style:layout-grid-ruby-height="0cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:layout-grid-base-width="0.423cm" style:layout-grid-snap-to="true" style:footnote-max-height="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style> + <style:header-footer-properties fo:min-height="0.653cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.554cm" style:dynamic-spacing="true"/> + </style:footer-style> + </style:page-layout> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"> + <style:footer> + <text:p></text:p> + </style:footer> + <loext:footer-first> + <text:p text:style-name="Footer"><draw:frame draw:style-name="fr1" draw:name="Frame1" text:anchor-type="paragraph" svg:y="25.506cm" svg:width="15.983cm" draw:z-index="0"><draw:text-box fo:min-height="0.058cm"><table:table table:name="Table6" table:style-name="Table6"><table:table-column table:style-name="Table6.A"/><table:table-row table:style-name="Table6.1"><table:table-cell table:style-name="Table6.A1" office:value-type="string"><text:p text:style-name="Standard">A1</text:p></table:table-cell></table:table-row></table:table></draw:text-box></draw:frame></text:p> + </loext:footer-first> + </style:master-page> + </office:master-styles> + <office:body> + <office:text text:use-soft-page-breaks="true"> + <text:p text:style-name="P1">P01</text:p> + <text:p text:style-name="Standard">P02</text:p> + <text:p text:style-name="Standard">P03</text:p> + <text:p text:style-name="Standard">P04</text:p> + <text:p text:style-name="Standard">P05</text:p> + <text:p text:style-name="Standard">P06</text:p> + <text:p text:style-name="Standard">P07</text:p> + <text:p text:style-name="Standard">P08</text:p> + <text:p text:style-name="Standard">P09</text:p> + <text:p text:style-name="Standard">P10</text:p> + <text:p text:style-name="Standard">P11</text:p> + <text:p text:style-name="Standard">P12</text:p> + <text:p text:style-name="Standard">P13</text:p> + <text:p text:style-name="Standard">P14</text:p> + <text:p text:style-name="Standard">P15</text:p> + <text:p text:style-name="Standard">P16</text:p> + <text:p text:style-name="Standard">P17</text:p> + <text:p text:style-name="Standard">P18</text:p> + <text:p text:style-name="Standard">P19</text:p> + <text:p text:style-name="Standard">P20</text:p> + <text:p text:style-name="Standard">P21</text:p> + <text:p text:style-name="Standard">P22</text:p> + <text:p text:style-name="Standard">P23</text:p> + <text:p text:style-name="Standard">P24</text:p> + <text:p text:style-name="Standard">P25</text:p> + <text:p text:style-name="Standard">P26</text:p> + <text:p text:style-name="Standard">P27</text:p> + <text:p text:style-name="Standard">P28</text:p> + <text:p text:style-name="Standard">P29</text:p> + <text:p text:style-name="Standard">P30</text:p> + <text:p text:style-name="Standard">P31</text:p> + <text:p text:style-name="Standard">P32</text:p> + <text:p text:style-name="Standard">P33</text:p> + <text:p text:style-name="Standard">P34</text:p> + <text:p text:style-name="Standard">P35</text:p> + <text:p text:style-name="Standard">P36</text:p> + <text:p text:style-name="Standard">P37</text:p> + <text:p text:style-name="Standard">P38</text:p> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:p text:style-name="P3">P2P01</text:p> + <text:p text:style-name="Standard">P2P02</text:p> + <text:p text:style-name="Standard">P2P03</text:p> + <text:p text:style-name="Standard">P2P04</text:p> + <text:p text:style-name="Standard">P2P05</text:p> + <text:p text:style-name="Standard">P2P06</text:p> + <text:p text:style-name="Standard">P2P07</text:p> + <text:p text:style-name="Standard">P2P08</text:p> + <text:p text:style-name="Standard">P2P09</text:p> + <text:p text:style-name="Standard">P2P10</text:p> + <text:p text:style-name="Standard">P2P11</text:p> + <text:p text:style-name="Standard">P2P12<text:note text:id="ftn1" text:note-class="endnote"><text:note-citation>1</text:note-citation><text:note-body></text:note-body></text:note> First line<text:line-break/>second line</text:p> + <text:p text:style-name="P3"/> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/core/text/text.cxx b/sw/qa/core/text/text.cxx new file mode 100644 index 000000000..3f7cfb527 --- /dev/null +++ b/sw/qa/core/text/text.cxx @@ -0,0 +1,83 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <swmodeltestbase.hxx> + +#include <vcl/gdimtf.hxx> + +#include <wrtsh.hxx> + +static char const DATA_DIRECTORY[] = "/sw/qa/core/text/data/"; + +/// Covers sw/source/core/text/ fixes. +class SwCoreTextTest : public SwModelTestBase +{ +public: + SwDoc* createDoc(const char* pName = nullptr); +}; + +SwDoc* SwCoreTextTest::createDoc(const char* pName) +{ + load(DATA_DIRECTORY, pName); + + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + return pTextDoc->GetDocShell()->GetDoc(); +} + +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testFootnoteConnect) +{ + SwDoc* pDoc = createDoc("footnote-connect.fodt"); + SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + // Jump to the start of the next page. + pWrtShell->SttNxtPg(); + // Remove the page break. + pWrtShell->DelLeft(); + // Split the multi-line text frame, containing an endnote. + pWrtShell->DelLeft(); + // Join the split text frame. + pWrtShell->DelLeft(); + // Turn the 3 page document into a 2 page one, so the endnote frame is moved. + // Without the accompanying fix in place, this test would have crashed due to a use-after-free + // in SwFootnoteFrame::GetRef(). + pWrtShell->DelLeft(); +} + +CPPUNIT_TEST_FIXTURE(SwCoreTextTest, testSemiTransparentText) +{ + // Create an in-memory empty document. + loadURL("private:factory/swriter", nullptr); + + // Set text to half-transparent and type a character. + uno::Reference<beans::XPropertySet> xParagraph(getParagraph(1), uno::UNO_QUERY); + CPPUNIT_ASSERT(xParagraph.is()); + sal_Int16 nTransparence = 50; + xParagraph->setPropertyValue("CharTransparence", uno::makeAny(nTransparence)); + uno::Reference<text::XTextRange> xTextRange(xParagraph, uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextRange.is()); + xTextRange->setString("x"); + + // Render the document to a metafile. + SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get()); + CPPUNIT_ASSERT(pTextDoc); + SwDocShell* pDocShell = pTextDoc->GetDocShell(); + CPPUNIT_ASSERT(pDocShell); + std::shared_ptr<GDIMetaFile> xMetaFile = pDocShell->GetPreviewMetaFile(); + CPPUNIT_ASSERT(xMetaFile); + + // Make sure that DrawTransparent() was used during rendering. + MetafileXmlDump dumper; + xmlDocUniquePtr pXmlDoc = dumpAndParse(dumper, *xMetaFile); + CPPUNIT_ASSERT(pXmlDoc); + assertXPath(pXmlDoc, "//floattransparent"); +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |