Kaydet (Commit) 75003438 authored tarafından Xisco Fauli's avatar Xisco Fauli Kaydeden (comit) Xisco Faulí

tdf#101237 SVGIO: Use black as default when parents' fill...

...attributes are empty or none and there's a reference
to a clip-path present.

Change-Id: I4dc4e3bcaac43a007fbdb8a1d006cbd39c737396
Reviewed-on: https://gerrit.libreoffice.org/28500Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarXisco Faulí <anistenis@gmail.com>
üst 93d7fc90
...@@ -61,6 +61,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools ...@@ -61,6 +61,7 @@ class Test : public test::BootstrapFixture, public XmlTestTools
void test47446b(); void test47446b();
void testMaskText(); void testMaskText();
void testTdf99994(); void testTdf99994();
void testTdf101237();
Primitive2DSequence parseSvg(const char* aSource); Primitive2DSequence parseSvg(const char* aSource);
...@@ -91,6 +92,7 @@ public: ...@@ -91,6 +92,7 @@ public:
CPPUNIT_TEST(test47446b); CPPUNIT_TEST(test47446b);
CPPUNIT_TEST(testMaskText); CPPUNIT_TEST(testMaskText);
CPPUNIT_TEST(testTdf99994); CPPUNIT_TEST(testTdf99994);
CPPUNIT_TEST(testTdf101237);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
}; };
...@@ -620,6 +622,24 @@ void Test::testTdf99994() ...@@ -620,6 +622,24 @@ void Test::testTdf99994()
assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans"); assertXPath(pDocument, "/primitive2D/transform/textsimpleportion[1]", "familyname", "Sans");
} }
void Test::testTdf101237()
{
//Check that fill color, stroke color and stroke-width are inherited from use element
//when the element is within a clipPath element
Primitive2DSequence aSequenceTdf101237 = parseSvg("/svgio/qa/cppunit/data/tdf101237.svg");
CPPUNIT_ASSERT_EQUAL(1, (int)aSequenceTdf101237.getLength());
Primitive2dXmlDump dumper;
xmlDocPtr pDocument = dumper.dumpAndParse(comphelper::sequenceToContainer<Primitive2DContainer>(aSequenceTdf101237));
CPPUNIT_ASSERT (pDocument);
assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#ff0000");
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "color", "#000000");
assertXPath(pDocument, "/primitive2D/transform/polypolygonstroke/line", "width", "5");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
} }
......
This diff was suppressed by a .gitattributes entry.
...@@ -2007,14 +2007,26 @@ namespace svgio ...@@ -2007,14 +2007,26 @@ namespace svgio
if(pSvgStyleAttributes) if(pSvgStyleAttributes)
{ {
return pSvgStyleAttributes->getFill(); const basegfx::BColor* pFill = pSvgStyleAttributes->getFill();
if(mbIsClipPathContent)
{
if (pFill)
{
return pFill;
}
else
{
static basegfx::BColor aBlack(0.0, 0.0, 0.0);
return &aBlack;
}
}
else
{
return pFill;
}
} }
} }
else if(mbIsClipPathContent)
{
static basegfx::BColor aBlack(0.0, 0.0, 0.0);
return &aBlack;
}
return nullptr; return nullptr;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment