diff options
author | Armin Le Grand <alg@apache.org> | 2013-10-29 14:11:45 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-10-31 15:56:14 +0000 |
commit | 223f6b631c1b087754c0f9051fb55f029f2503ce (patch) | |
tree | 14582be2894a88d16c6b0debbc8491350f9a5cce /basegfx/test | |
parent | 9069e26d1fe1fbbe7bceab0bae8a186d8cdb47cc (diff) |
Resolves: #i123433# Detect pseudo-vertices at svg import...
unify svg:d handling, correct svg:d import for relative sub-polygons in svg
import; changed default for moveto writes for svg:d in ODF to absolute
(cherry picked from commit f15874d8f976f3874bdbcb53429eeefa65c28841)
Conflicts:
basegfx/inc/basegfx/polygon/b2dpolygontools.hxx
basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
basegfx/inc/basegfx/polygon/b3dpolypolygontools.hxx
basegfx/source/polygon/b2dpolypolygontools.cxx
basegfx/source/polygon/b2dsvgpolypolygon.cxx
basegfx/source/polygon/b3dpolypolygontools.cxx
basegfx/source/tools/makefile.mk
basegfx/test/boxclipper.cxx
basegfx/test/clipstate.cxx
basegfx/test/genericclipper.cxx
canvas/source/tools/surfaceproxy.cxx
sdext/source/pdfimport/tree/drawtreevisiting.cxx
sdext/source/pdfimport/tree/writertreevisiting.cxx
xmloff/inc/xexptran.hxx
xmloff/source/draw/XMLImageMapContext.cxx
xmloff/source/draw/XMLImageMapExport.cxx
xmloff/source/draw/shapeexport2.cxx
xmloff/source/draw/shapeexport3.cxx
xmloff/source/draw/xexptran.cxx
xmloff/source/draw/ximp3dobject.cxx
xmloff/source/draw/ximpshap.cxx
xmloff/source/style/MarkerStyle.cxx
xmloff/source/text/XMLTextFrameContext.cxx
xmloff/source/text/txtparae.cxx
Change-Id: I5171b4a3559ea116bea45152e1f2685666463635
Diffstat (limited to 'basegfx/test')
-rw-r--r-- | basegfx/test/basegfx2d.cxx | 40 | ||||
-rw-r--r-- | basegfx/test/boxclipper.cxx | 21 | ||||
-rw-r--r-- | basegfx/test/clipstate.cxx | 13 | ||||
-rw-r--r-- | basegfx/test/genericclipper.cxx | 14 |
4 files changed, 38 insertions, 50 deletions
diff --git a/basegfx/test/basegfx2d.cxx b/basegfx/test/basegfx2d.cxx index 67ecb3e32d0b..15446780d6d6 100644 --- a/basegfx/test/basegfx2d.cxx +++ b/basegfx/test/basegfx2d.cxx @@ -142,23 +142,20 @@ public: OUString aExport; CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D", - tools::importFromSvgD( aPoly, - aPath0 )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aPath0, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); const char* sExportString = "m10 10h-20v-20h20z"; CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D", !aExport.compareToAscii(sExportString) ); CPPUNIT_ASSERT_MESSAGE("importing simple rectangle from SVG-D (round-trip", - tools::importFromSvgD( aPoly, - aExport )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aExport, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); CPPUNIT_ASSERT_MESSAGE("exporting rectangle to SVG-D (round-trip)", !aExport.compareToAscii(sExportString)); CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", - tools::importFromSvgD( aPoly, - aPath1 )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aPath1, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); // Adaptions for B2DPolygon bezier change (see #i77162#): // @@ -185,11 +182,11 @@ public: // a 2nd good test is that re-importing of aExport has to create the same // B2DPolPolygon again: B2DPolyPolygon aReImport; - CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport)); + CPPUNIT_ASSERT_MESSAGE("importing simple bezier polygon from SVG-D", tools::importFromSvgD( aReImport, aExport, false, 0)); CPPUNIT_ASSERT_MESSAGE("re-imported polygon needs to be identical", aReImport == aPoly); - CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2 )); - aExport = tools::exportToSvgD( aPoly ); + CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D", tools::importFromSvgD( aPoly, aPath2, false, NULL)); + aExport = tools::exportToSvgD( aPoly, true, true, false ); // Adaptions for B2DPolygon bezier change (see #i77162#): // @@ -205,22 +202,20 @@ public: "8 752-224 1128-21 101-31 183-31 245 0 39 9 70 26 93 17 24 39 36 67 36 145 0 279-80 400-240s182-365 182-615c0-2" "88-107-533-322-734s-487-301-816-301c-395 0-715 124-960 373s-368 569-368 958q0 577.5 357 900c237 216 557 324 95" "8 325 189-1 389-27 600-77 211-52 378-110 503-174q40.5 105 81 210z"; - CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport)); + CPPUNIT_ASSERT_MESSAGE("re-importing '@' from SVG-D", tools::importFromSvgD( aReImport, aExport, false, 0)); CPPUNIT_ASSERT_MESSAGE("re-imported '@' needs to be identical", aReImport == aPoly); CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D", !aExport.compareToAscii(sExportString1)); CPPUNIT_ASSERT_MESSAGE("importing '@' from SVG-D (round-trip", - tools::importFromSvgD( aPoly, - aExport )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aExport, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); CPPUNIT_ASSERT_MESSAGE("exporting '@' to SVG-D (round-trip)", !aExport.compareToAscii(sExportString1)); CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D", - tools::importFromSvgD( aPoly, - aPath3 )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aPath3, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); const char* sExportString2 = "m1598 125h306v2334h-306v-1105h-1293v1105h-305v-2334h305v973h1293" "zm2159 1015 78-44 85 235-91 47-91 40-90 34-90 29-89 21-88 16-88 10-88 3-102-4-97" @@ -245,15 +240,14 @@ public: CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D", !aExport.compareToAscii(sExportString2)); CPPUNIT_ASSERT_MESSAGE("importing complex polygon from SVG-D (round-trip", - tools::importFromSvgD( aPoly, - aExport )); - aExport = tools::exportToSvgD( aPoly ); + tools::importFromSvgD( aPoly, aExport, false, 0 )); + aExport = tools::exportToSvgD( aPoly, true, true, false ); CPPUNIT_ASSERT_MESSAGE("exporting complex polygon to SVG-D (round-trip)", !aExport.compareToAscii(sExportString2)); const B2DPolygon aRect( tools::createPolygonFromRect( B2DRange(0.0,0.0,4000.0,4000.0) )); - aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false); + aExport = tools::exportToSvgD( B2DPolyPolygon(aRect), false, false, false ); const char* sExportStringRect = "M0 0H4000V4000H0Z"; CPPUNIT_ASSERT_MESSAGE("exporting to rectangle svg-d string", diff --git a/basegfx/test/boxclipper.cxx b/basegfx/test/boxclipper.cxx index a296871d7fe9..bb02dc521d48 100644 --- a/basegfx/test/boxclipper.cxx +++ b/basegfx/test/boxclipper.cxx @@ -165,7 +165,7 @@ public: B2DPolyPolygon randomPoly; tools::importFromSvgD( randomPoly, - OUString::createFromAscii(randomSvg)); + OUString::createFromAscii(randomSvg), false, 0); std::for_each(randomPoly.begin(), randomPoly.end(), boost::bind( @@ -240,16 +240,15 @@ public: B2DPolyPolygon aTmp1; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp1, - OUString::createFromAscii(sSvg))); + aTmp1, OUString::createFromAscii(sSvg), false, 0)); const OUString aSvg= - tools::exportToSvgD(toTest.solveCrossovers()); + tools::exportToSvgD(toTest.solveCrossovers(), true, true, false); B2DPolyPolygon aTmp2; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp2, - aSvg)); + aTmp2, aSvg, false, 0)); + CPPUNIT_ASSERT_MESSAGE( sName, normalizePoly(aTmp2) == normalizePoly(aTmp1)); @@ -321,7 +320,7 @@ public: #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "%s - svg:d=\"%s\"\n", pName, OUStringToOString( - basegfx::tools::exportToSvgD(rPoly), + basegfx::tools::exportToSvgD(rPoly, , true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif } @@ -365,15 +364,14 @@ public: fprintf(stderr, "%s input - svg:d=\"%s\"\n", pName, OUStringToOString( basegfx::tools::exportToSvgD( - genericClip), + genericClip, , true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif const B2DPolyPolygon boxClipResult=rRange.solveCrossovers(); const OUString boxClipSvg( basegfx::tools::exportToSvgD( - normalizePoly( - boxClipResult))); + normalizePoly(boxClipResult), true, true, false)); #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "%s boxclipper - svg:d=\"%s\"\n", pName, OUStringToOString( @@ -384,8 +382,7 @@ public: genericClip = tools::solveCrossovers(genericClip); const OUString genericClipSvg( basegfx::tools::exportToSvgD( - normalizePoly( - genericClip))); + normalizePoly(genericClip), true, true, false)); #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "%s genclipper - svg:d=\"%s\"\n", pName, OUStringToOString( diff --git a/basegfx/test/clipstate.cxx b/basegfx/test/clipstate.cxx index f2b0ef0e94b7..ffdc35397fb8 100644 --- a/basegfx/test/clipstate.cxx +++ b/basegfx/test/clipstate.cxx @@ -95,23 +95,21 @@ public: #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "%s - svg:d=\"%s\"\n", sName, OUStringToOString( - basegfx::tools::exportToSvgD(toTest.getClipPoly()), + basegfx::tools::exportToSvgD(toTest.getClipPoly(), true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif B2DPolyPolygon aTmp1; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp1, - OUString::createFromAscii(sSvg))); + aTmp1, OUString::createFromAscii(sSvg), false, 0)); const OUString aSvg= - tools::exportToSvgD(toTest.getClipPoly()); + tools::exportToSvgD(toTest.getClipPoly(), true, true, false); B2DPolyPolygon aTmp2; CPPUNIT_ASSERT_MESSAGE(sName, tools::importFromSvgD( - aTmp2, - aSvg)); + aTmp2, aSvg, false, 0)); CPPUNIT_ASSERT_MESSAGE( sName, @@ -142,8 +140,7 @@ public: B2DPolyPolygon aTmp1; tools::importFromSvgD( - aTmp1, - OUString::createFromAscii(unionSvg)); + aTmp1, OUString::createFromAscii(unionSvg), false, 0); aMixedClip.intersectPolyPolygon(aTmp1); aMixedClip.subtractRange(B2DRange(-20,-150,20,0)); diff --git a/basegfx/test/genericclipper.cxx b/basegfx/test/genericclipper.cxx index c1af17d369c5..8a428dd725e4 100644 --- a/basegfx/test/genericclipper.cxx +++ b/basegfx/test/genericclipper.cxx @@ -79,12 +79,12 @@ public: fprintf(stderr, "%s input LHS - svg:d=\"%s\"\n", pName, OUStringToOString( basegfx::tools::exportToSvgD( - aSelfIntersect), + aSelfIntersect, true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); fprintf(stderr, "%s input RHS - svg:d=\"%s\"\n", pName, OUStringToOString( basegfx::tools::exportToSvgD( - aRect), + aRect, true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif @@ -94,14 +94,14 @@ public: #if OSL_DEBUG_LEVEL > 2 fprintf(stderr, "%s - svg:d=\"%s\"\n", pName, OUStringToOString( - basegfx::tools::exportToSvgD(aRes), + basegfx::tools::exportToSvgD(aRes, true, true, false), RTL_TEXTENCODING_UTF8).getStr() ); #endif OUString aValid=OUString::createFromAscii(pValidSvgD); CPPUNIT_ASSERT_MESSAGE(pName, - basegfx::tools::exportToSvgD(aRes) == aValid); + basegfx::tools::exportToSvgD(aRes, true, true, false) == aValid); } void validateOr() @@ -136,13 +136,13 @@ public: OUString aValid=OUString::createFromAscii(pValidSvgD); B2DPolyPolygon aInputPoly, aValidPoly; - tools::importFromSvgD(aInputPoly, aInput); - tools::importFromSvgD(aValidPoly, aValid); + tools::importFromSvgD(aInputPoly, aInput, false, NULL); + tools::importFromSvgD(aValidPoly, aValid, false, NULL); CPPUNIT_ASSERT_MESSAGE( pName, basegfx::tools::exportToSvgD( - tools::solveCrossovers(aInputPoly)) == aValid); + tools::solveCrossovers(aInputPoly), true, true, false) == aValid); } void checkCrossoverSolver() |