summaryrefslogtreecommitdiff
path: root/sw/qa/extras/odfexport/odfexport.cxx
diff options
context:
space:
mode:
authorMichael Stahl <michael.stahl@allotropia.de>2021-03-18 17:39:01 +0100
committerSamuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>2021-03-25 09:53:50 +0100
commite9c6fd6b4d09ee59b6a86942cbf001f2ba9782e6 (patch)
tree9cfece98c8b202cdddb77406ff29b8db5223bd57 /sw/qa/extras/odfexport/odfexport.cxx
parent56d8007a197b095b09423c691a51515567648e80 (diff)
tdf#134734 xmloff: ODF import compatibility for BackgroundFullSize
This is annoyingly complex because LO 6.3 changed the way backgrounds are painted in an inconsistent way. Use the generator version to guess what the document should look like, which of course will give the wrong result if it was created before LO 6.3 and then round-tripped with LO 6.3. Since LO 7.0 at least a hard-coded draw:background-size was written. Change-Id: If9c5d2b32bfa50cbe4fb166132f7223763af850f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112770 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'sw/qa/extras/odfexport/odfexport.cxx')
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx163
1 files changed, 163 insertions, 0 deletions
diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx
index e307ea6712d3..841019b3073b 100644
--- a/sw/qa/extras/odfexport/odfexport.cxx
+++ b/sw/qa/extras/odfexport/odfexport.cxx
@@ -1887,6 +1887,169 @@ DECLARE_ODFEXPORT_TEST(testMasterPageWithDrawingPage, "sw_hatch.odt")
CPPUNIT_ASSERT_EQUAL(sal_Int16(0), getProperty<sal_Int16>(xStyle, "FillTransparence"));
}
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testPageStyleBackgroundFullSizeOOo, "pagestyle_background_ooo33.odt")
+{
+ xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+ // Standard
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "border");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "solid");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-color", "#99ccff");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "opacity", "100%");
+ // Endnote
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "border");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "bitmap");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "repeat", "repeat");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
+ // Footnote
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "border");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "bitmap");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "repeat", "stretch");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
+}
+
+DECLARE_ODFEXPORT_EXPORTONLY_TEST(testPageStyleBackgroundFullSizeLO64, "pagestyle_background_lo64.odt")
+{
+ xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");
+ // Standard
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "full");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "solid");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-color", "#99ccff");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Standard']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "opacity", "100%");
+ // Endnote
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "full");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "bitmap");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "repeat", "repeat");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Endnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
+ // Footnote
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "border");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "bitmap");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "repeat", "stretch");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Footnote']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
+ // Landscape
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "border");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "bitmap");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "repeat", "no-repeat");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Landscape']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-image-ref-point", "top-left");
+ // Index
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "full");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "gradient");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "gradient-step-count", "0");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='Index']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "opacity", "100%");
+ // First Page
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "background-size", "full");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill", "hatch");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "fill-hatch-solid", "false");
+ assertXPath(pXmlDoc,
+ "/office:document-styles/office:automatic-styles/style:style[@style:family='drawing-page' and @style:name = "
+ "/office:document-styles/office:master-styles/style:master-page[@style:name='First_20_Page']/attribute::draw:style-name"
+ "]/style:drawing-page-properties", "opacity", "100%");
+}
+
DECLARE_ODFEXPORT_EXPORTONLY_TEST(testPageStyleBackgroundFullSizeLO70, "pagestyle_background_lo70.odt")
{
xmlDocUniquePtr pXmlDoc = parseExport("styles.xml");