tdf#150124: do nothing when parent is of unkown type
Change-Id: I745b2a81200b0d8138b5f1b844849f20571d9546 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153878 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
@@ -135,6 +135,20 @@ CPPUNIT_TEST_FIXTURE(Test, testSymbol)
|
||||
assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor", "color", "#00d000");
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf150124)
|
||||
{
|
||||
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf150124.svg");
|
||||
CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequence.getLength()));
|
||||
|
||||
drawinglayer::Primitive2dXmlDump dumper;
|
||||
xmlDocUniquePtr pDocument = dumper.dumpAndParse(aSequence);
|
||||
|
||||
CPPUNIT_ASSERT (pDocument);
|
||||
|
||||
assertXPathChildren(pDocument, "/primitive2D", 1);
|
||||
assertXPath(pDocument, "/primitive2D/hiddengeometry", 1);
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_FIXTURE(Test, testTdf155819)
|
||||
{
|
||||
Primitive2DSequence aSequence = parseSvg(u"/svgio/qa/cppunit/data/tdf155819.svg");
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<svg id="svg-root" width="100%" height="100%"
|
||||
viewBox="0 0 480 360" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<invented>
|
||||
<rect id='r1' x='0' y='0' width='50' height='50' fill='red'/>
|
||||
<g>
|
||||
<rect id='r2' x='60' y='0' width='50' height='50' fill='green'/>
|
||||
</g>
|
||||
<circle id="myCircle" cx="50" cy="50" r="40" stroke="blue" />
|
||||
</invented>
|
||||
<use href="myCircle" x="20" fill="white" stroke="red" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 454 B |
@@ -413,8 +413,7 @@ namespace
|
||||
|
||||
default:
|
||||
{
|
||||
/// invalid token, ignore
|
||||
SAL_INFO( "svgio", "Unknown Base SvgToken <" + aName + "> (!)" );
|
||||
mpTarget = new SvgNode(SVGToken::Unknown, maDocument, mpTarget);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -498,6 +497,8 @@ namespace
|
||||
/// structural element pattern
|
||||
case SVGToken::Pattern:
|
||||
|
||||
default:
|
||||
|
||||
/// content handling after parsing
|
||||
{
|
||||
if(mpTarget)
|
||||
@@ -516,10 +517,6 @@ namespace
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
/// invalid token, ignore
|
||||
}
|
||||
}
|
||||
|
||||
if(pSvgTitleDescNode && mpTarget)
|
||||
|
||||
@@ -395,21 +395,11 @@ namespace {
|
||||
mbDecomposing(false),
|
||||
mbCssStyleVectorBuilt(false)
|
||||
{
|
||||
OSL_ENSURE(SVGToken::Unknown != maType, "SvgNode with unknown type created (!)");
|
||||
|
||||
if(pParent)
|
||||
// tdf#150124 ignore when parent is unknown
|
||||
if(pParent && pParent->getType() != SVGToken::Unknown)
|
||||
{
|
||||
pParent->maChildren.emplace_back(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef DBG_UTIL
|
||||
if(SVGToken::Svg != getType())
|
||||
{
|
||||
OSL_ENSURE(false, "No parent for this node (!)");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
SvgNode::~SvgNode()
|
||||
|
||||
Reference in New Issue
Block a user