|
|
|
@@ -65,7 +65,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testPreserveJpg)
|
|
|
|
|
|
|
|
|
|
// Make sure that the original JPG data is reused and we don't perform a PNG re-compress.
|
|
|
|
|
xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
|
|
|
|
|
OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image", "href");
|
|
|
|
|
OUString aAttributeValue = getXPath(pXmlDoc, "//svg:image"_ostr, "href"_ostr);
|
|
|
|
|
|
|
|
|
|
// Without the accompanying fix in place, this test would have failed with:
|
|
|
|
|
// - Expression: aAttributeValue.startsWith("data:image/jpeg")
|
|
|
|
@@ -93,7 +93,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentLine)
|
|
|
|
|
// Get the style of the group around the actual <path> element.
|
|
|
|
|
xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
|
|
|
|
|
OUString aStyle = getXPath(
|
|
|
|
|
pXmlDoc, "//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g", "style");
|
|
|
|
|
pXmlDoc, "//svg:g[@class='com.sun.star.drawing.LineShape']/svg:g/svg:g"_ostr, "style"_ostr);
|
|
|
|
|
// Without the accompanying fix in place, this test would have failed, as the style was
|
|
|
|
|
// "mask:url(#mask1)", not "opacity: <value>".
|
|
|
|
|
CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", &aStyle));
|
|
|
|
@@ -119,8 +119,9 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentFillWithTransparentLine)
|
|
|
|
|
|
|
|
|
|
// Get the style of the group around the actual <path> element.
|
|
|
|
|
xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
|
|
|
|
|
OUString aStyle = getXPath(
|
|
|
|
|
pXmlDoc, "//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:g", "style");
|
|
|
|
|
OUString aStyle
|
|
|
|
|
= getXPath(pXmlDoc, "//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:g"_ostr,
|
|
|
|
|
"style"_ostr);
|
|
|
|
|
CPPUNIT_ASSERT(aStyle.startsWith("opacity: ", &aStyle));
|
|
|
|
|
int nPercent = std::round(aStyle.toDouble() * 100);
|
|
|
|
|
// Make sure that the line is still 50% opaque
|
|
|
|
@@ -128,7 +129,8 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentFillWithTransparentLine)
|
|
|
|
|
|
|
|
|
|
// Get the stroke of the fill of the EllipseShape (it must be "none")
|
|
|
|
|
OUString aStroke = getXPath(
|
|
|
|
|
pXmlDoc, "//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:path", "stroke");
|
|
|
|
|
pXmlDoc, "//svg:g[@class='com.sun.star.drawing.EllipseShape']/svg:g/svg:path"_ostr,
|
|
|
|
|
"stroke"_ostr);
|
|
|
|
|
// Without the accompanying fix in place, this test would have failed, as the stroke was
|
|
|
|
|
// "rgb(255,255,255)", not "none".
|
|
|
|
|
CPPUNIT_ASSERT_EQUAL(OUString("none"), aStroke);
|
|
|
|
@@ -163,13 +165,13 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentText)
|
|
|
|
|
// - Actual : 1
|
|
|
|
|
// i.e. the 2nd shape lots its text.
|
|
|
|
|
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text", 2);
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:text"_ostr, 2);
|
|
|
|
|
|
|
|
|
|
// First shape has semi-transparent text.
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']");
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:text[1]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity='0.8']"_ostr);
|
|
|
|
|
|
|
|
|
|
// Second shape has normal text.
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]", 0);
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:text[2]/svg:tspan/svg:tspan/svg:tspan[@fill-opacity]"_ostr, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentMultiParaText)
|
|
|
|
@@ -207,20 +209,20 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testSemiTransparentMultiParaText)
|
|
|
|
|
|
|
|
|
|
// Then make sure that the two semi-transparent paragraphs have the same X position:
|
|
|
|
|
xmlDocUniquePtr pXmlDoc = parseXmlStream(&aStream);
|
|
|
|
|
assertXPath(pXmlDoc, "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]", "x",
|
|
|
|
|
"250");
|
|
|
|
|
assertXPath(pXmlDoc, "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]"_ostr,
|
|
|
|
|
"x"_ostr, "250");
|
|
|
|
|
assertXPath(pXmlDoc,
|
|
|
|
|
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]/svg:tspan",
|
|
|
|
|
"fill-opacity", "0.8");
|
|
|
|
|
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[1]/svg:tspan"_ostr,
|
|
|
|
|
"fill-opacity"_ostr, "0.8");
|
|
|
|
|
// Without the accompanying fix in place, this test would have failed with:
|
|
|
|
|
// - Expected: 250
|
|
|
|
|
// - Actual : 8819
|
|
|
|
|
// i.e. the X position of the second paragraph was wrong.
|
|
|
|
|
assertXPath(pXmlDoc, "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]", "x",
|
|
|
|
|
"250");
|
|
|
|
|
assertXPath(pXmlDoc, "(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]"_ostr,
|
|
|
|
|
"x"_ostr, "250");
|
|
|
|
|
assertXPath(pXmlDoc,
|
|
|
|
|
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]/svg:tspan",
|
|
|
|
|
"fill-opacity", "0.8");
|
|
|
|
|
"(//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition'])[2]/svg:tspan"_ostr,
|
|
|
|
|
"fill-opacity"_ostr, "0.8");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testShapeNographic)
|
|
|
|
@@ -266,7 +268,8 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testCustomBullet)
|
|
|
|
|
// i.e. the custom bullet used '<use transform="scale(285,285)"
|
|
|
|
|
// xlink:href="#bullet-char-template-45"/>', but nobody produced a bullet-char-template-45,
|
|
|
|
|
// instead we need the path of the glyph inline.
|
|
|
|
|
CPPUNIT_ASSERT(!getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path", "d").isEmpty());
|
|
|
|
|
CPPUNIT_ASSERT(
|
|
|
|
|
!getXPath(pXmlDoc, "//svg:g[@class='BulletChars']//svg:path"_ostr, "d"_ostr).isEmpty());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest)
|
|
|
|
@@ -298,17 +301,17 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, attributeRedefinedTest)
|
|
|
|
|
// <tspan id="id14" id="id15" id="id17" class="TextParagraph" font-family="Bahnschrift Light" font-size="1129px" font-weight="400">
|
|
|
|
|
|
|
|
|
|
OString xPath = "//svg:g[@class='TextShape']//svg:text[@class='SVGTextShape']//"
|
|
|
|
|
"svg:tspan[@class='TextParagraph']";
|
|
|
|
|
"svg:tspan[@class='TextParagraph']"_ostr;
|
|
|
|
|
assertXPath(pXmlDoc, xPath, 4);
|
|
|
|
|
|
|
|
|
|
//assert that each tspan element with TextParagraph class has id and the tspan element of
|
|
|
|
|
//each empty paragraph does not contain tspan element with class TextPosition
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[1]", "id", "id4");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[2]", "id", "id5");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[1]", "id"_ostr, "id4");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[2]", "id"_ostr, "id5");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[2]//svg:tspan[@class='TextPosition']", 0);
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[3]", "id", "id6");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[3]", "id"_ostr, "id6");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[3]//svg:tspan[@class='TextPosition']", 0);
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[4]", "id", "id7");
|
|
|
|
|
assertXPath(pXmlDoc, xPath + "[4]", "id"_ostr, "id7");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab)
|
|
|
|
@@ -343,7 +346,7 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTab)
|
|
|
|
|
// - Expected: 2
|
|
|
|
|
// - Actual : 1
|
|
|
|
|
// i.e. the 2nd text portion was not positioned, which looked as if the tab is lost.
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']", 2);
|
|
|
|
|
assertXPath(pXmlDoc, "//svg:g[@class='TextShape']//svg:tspan[@class='TextPosition']"_ostr, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CPPUNIT_PLUGIN_IMPLEMENT();
|
|
|
|
|