summaryrefslogtreecommitdiff
path: root/svgio
diff options
context:
space:
mode:
Diffstat (limited to 'svgio')
-rw-r--r--svgio/qa/cppunit/SvgImportTest.cxx20
-rw-r--r--svgio/qa/cppunit/data/tdf156236.svg7
-rw-r--r--svgio/source/svgreader/svgrectnode.cxx11
3 files changed, 28 insertions, 10 deletions
diff --git a/svgio/qa/cppunit/SvgImportTest.cxx b/svgio/qa/cppunit/SvgImportTest.cxx
index 0f8b31d4b1cc..9f0b8ff7b9d7 100644
--- a/svgio/qa/cppunit/SvgImportTest.cxx
+++ b/svgio/qa/cppunit/SvgImportTest.cxx
@@ -1048,11 +1048,11 @@ CPPUNIT_TEST_FIXTURE(Test, testClipRule)
// - Actual : 10
assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygon/polygon/point", 5);
assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor", "color", "#0000ff");
- assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 5);
+ assertXPath(pDocument, "/primitive2D/transform/mask[1]/polypolygoncolor/polypolygon/polygon/point", 4);
assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygon/polygon/point", 5);
assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor", "color", "#ff0000");
- assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 5);
+ assertXPath(pDocument, "/primitive2D/transform/mask[2]/polypolygoncolor/polypolygon/polygon/point", 4);
}
CPPUNIT_TEST_FIXTURE(Test, testi125329)
@@ -1271,6 +1271,22 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf94765)
assertXPath(pDocument, "/primitive2D/transform/transform/svglineargradient[2]", "endy", "0");
}
+CPPUNIT_TEST_FIXTURE(Test, testTdf156236)
+{
+ Primitive2DSequence aSequenceTdf94765 = parseSvg(u"/svgio/qa/cppunit/data/tdf156236.svg");
+ CPPUNIT_ASSERT_EQUAL(1, static_cast<int>(aSequenceTdf94765.getLength()));
+
+ drawinglayer::Primitive2dXmlDump dumper;
+ xmlDocUniquePtr pDocument = dumper.dumpAndParse(Primitive2DContainer(aSequenceTdf94765));
+
+ CPPUNIT_ASSERT (pDocument);
+
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[1]/polypolygon", "path", "m50 180h-30v-60h60v60z");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[2]/polypolygon", "path", "m150 180h15c8.2842712474619 0 15-6.7157287525381 15-15v-30c0-8.2842712474619-6.7157287525381-15-15-15h-30c-8.2842712474619 0-15 6.7157287525381-15 15v30c0 8.2842712474619 6.7157287525381 15 15 15z");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[3]/polypolygon", "path", "m250 180h15c8.2842712474619 0 15-6.7157287525381 15-15v-30c0-8.2842712474619-6.7157287525381-15-15-15h-30c-8.2842712474619 0-15 6.7157287525381-15 15v30c0 8.2842712474619 6.7157287525381 15 15 15z");
+ assertXPath(pDocument, "/primitive2D/transform/polypolygoncolor[4]/polypolygon", "path", "m350 180c16.5685424949238 0 30-6.7157287525381 30-15v-30c0-8.2842712474619-13.4314575050762-15-30-15s-30 6.7157287525381-30 15v30c0 8.2842712474619 13.4314575050762 15 30 15z");
+}
+
CPPUNIT_TEST_FIXTURE(Test, testBehaviourWhenWidthAndHeightIsOrIsNotSet)
{
// This test checks the behaviour when width and height attributes
diff --git a/svgio/qa/cppunit/data/tdf156236.svg b/svgio/qa/cppunit/data/tdf156236.svg
new file mode 100644
index 000000000000..12268652c03b
--- /dev/null
+++ b/svgio/qa/cppunit/data/tdf156236.svg
@@ -0,0 +1,7 @@
+<svg viewBox="0 0 500 200" xmlns="http://www.w3.org/2000/svg">
+ <rect x="20" y="120" width="60" height="60" rx="0" ry="15" />
+ <rect x="120" y="120" width="60" height="60" ry="15" />
+ <rect x="220" y="120" width="60" height="60" rx="-150" ry="15" />
+ <rect x="320" y="120" width="60" height="60" rx="150" ry="15" />
+</svg>
+
diff --git a/svgio/source/svgreader/svgrectnode.cxx b/svgio/source/svgreader/svgrectnode.cxx
index 291d8540912f..c063ecf87195 100644
--- a/svgio/source/svgreader/svgrectnode.cxx
+++ b/svgio/source/svgreader/svgrectnode.cxx
@@ -32,9 +32,7 @@ namespace svgio::svgreader
maX(0),
maY(0),
maWidth(0),
- maHeight(0),
- maRx(0),
- maRy(0)
+ maHeight(0)
{
}
@@ -176,14 +174,11 @@ namespace svgio::svgreader
double frX(getRx().isSet() ? getRx().solve(*this, NumberType::xcoordinate) : 0.0);
double frY(getRy().isSet() ? getRy().solve(*this, NumberType::ycoordinate) : 0.0);
- frX = std::max(0.0, frX);
- frY = std::max(0.0, frY);
-
- if(0.0 == frY && frX > 0.0)
+ if(!getRy().isSet() && 0.0 == frY && frX > 0.0)
{
frY = frX;
}
- else if(0.0 == frX && frY > 0.0)
+ else if(!getRx().isSet() && 0.0 == frX && frY > 0.0)
{
frX = frY;
}