Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
d86f83b6
Kaydet (Commit)
d86f83b6
authored
Ock 10, 2017
tarafından
Stephan Bergmann
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
New loplugin:conststringvar: basegfx
Change-Id: Ia298e6a3515de9bde212dfd6159032859a965df1
üst
4e1d0357
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
44 deletions
+41
-44
basegfx2d.cxx
basegfx/test/basegfx2d.cxx
+13
-13
boxclipper.cxx
basegfx/test/boxclipper.cxx
+17
-19
clipstate.cxx
basegfx/test/clipstate.cxx
+7
-8
genericclipper.cxx
basegfx/test/genericclipper.cxx
+4
-4
No files found.
basegfx/test/basegfx2d.cxx
Dosyayı görüntüle @
d86f83b6
...
...
@@ -140,14 +140,14 @@ public:
CPPUNIT_ASSERT_MESSAGE
(
"importing simple rectangle from SVG-D"
,
tools
::
importFromSvgD
(
aPoly
,
aPath0
,
false
,
nullptr
));
aExport
=
tools
::
exportToSvgD
(
aPoly
,
true
,
true
,
false
);
const
char
*
sExportString
=
"m10 10h-20v-20h20z"
;
const
char
sExportString
[]
=
"m10 10h-20v-20h20z"
;
CPPUNIT_ASSERT_MESSAGE
(
"exporting rectangle to SVG-D"
,
aExport
.
equalsAscii
(
sExportString
)
);
aExport
==
sExportString
);
CPPUNIT_ASSERT_MESSAGE
(
"importing simple rectangle from SVG-D (round-trip"
,
tools
::
importFromSvgD
(
aPoly
,
aExport
,
false
,
nullptr
));
aExport
=
tools
::
exportToSvgD
(
aPoly
,
true
,
true
,
false
);
CPPUNIT_ASSERT_MESSAGE
(
"exporting rectangle to SVG-D (round-trip)"
,
aExport
.
equalsAscii
(
sExportString
)
);
aExport
==
sExportString
);
CPPUNIT_ASSERT_MESSAGE
(
"importing simple bezier polygon from SVG-D"
,
tools
::
importFromSvgD
(
aPoly
,
aPath1
,
false
,
nullptr
));
...
...
@@ -167,11 +167,11 @@ public:
// so for correct unit test i add the new exported string here as sExportStringSimpleBezier
// and compare to it.
const
char
*
sExportStringSimpleBezier
=
const
char
sExportStringSimpleBezier
[]
=
"m11430 0c-8890 3810 5715 6985 5715 6985"
"l-17145-1905c0 0 22860-10160 16510 6350"
"s-3810-11430-3810-11430z"
;
CPPUNIT_ASSERT_MESSAGE
(
"exporting bezier polygon to SVG-D"
,
aExport
.
equalsAscii
(
sExportStringSimpleBezier
)
);
CPPUNIT_ASSERT_MESSAGE
(
"exporting bezier polygon to SVG-D"
,
aExport
==
sExportStringSimpleBezier
);
// Adaptions for B2DPolygon bezier change (see #i77162#):
...
...
@@ -188,7 +188,7 @@ public:
// same here, the corrected export with the corrected B2DPolygon is simply more efficient,
// so i needed to change the compare string. Also adding the re-import comparison below.
const
char
*
sExportString1
=
const
char
sExportString1
[]
=
"m1917 1114c-89-189-233-284-430-284-167 0-306 91-419 273s-170 370-17"
"0 564c0 145 33 259 98 342 65 84 150 126 257 126q115.5 0 231-57s147-97 210-176 99-143 109-190c38-199 76-398 114"
"-598zm840 1646c-133 73-312 139-537 197-225 57-440 86-644 87-483-1-866-132-1150-392-284-261-426-619-426-1076 0-"
...
...
@@ -201,17 +201,17 @@ public:
CPPUNIT_ASSERT_MESSAGE
(
"re-importing '@' from SVG-D"
,
tools
::
importFromSvgD
(
aReImport
,
aExport
,
false
,
nullptr
));
CPPUNIT_ASSERT_MESSAGE
(
"re-imported '@' needs to be identical"
,
aReImport
==
aPoly
);
CPPUNIT_ASSERT_MESSAGE
(
"exporting '@' to SVG-D"
,
aExport
.
equalsAscii
(
sExportString1
)
);
CPPUNIT_ASSERT_MESSAGE
(
"exporting '@' to SVG-D"
,
aExport
==
sExportString1
);
CPPUNIT_ASSERT_MESSAGE
(
"importing '@' from SVG-D (round-trip"
,
tools
::
importFromSvgD
(
aPoly
,
aExport
,
false
,
nullptr
));
aExport
=
tools
::
exportToSvgD
(
aPoly
,
true
,
true
,
false
);
CPPUNIT_ASSERT_MESSAGE
(
"exporting '@' to SVG-D (round-trip)"
,
aExport
.
equalsAscii
(
sExportString1
)
);
aExport
==
sExportString1
);
CPPUNIT_ASSERT_MESSAGE
(
"importing complex polygon from SVG-D"
,
tools
::
importFromSvgD
(
aPoly
,
aPath3
,
false
,
nullptr
));
aExport
=
tools
::
exportToSvgD
(
aPoly
,
true
,
true
,
false
);
const
char
*
sExportString2
=
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"
"-12-91-19-85-26-40-16-39-18-38-20-36-22-34-24-33-26-32-27-30-30-29-31-27-33-25-3"
...
...
@@ -233,20 +233,20 @@ public:
"11-95-3-100 3-101 11-95 17-90 24-85 30-79 38-75 21-35 23-35 25-32 26-32 28-30 29"
"-28 30-26 31-24 33-22 34-20 35-18 36-16 37-15 39-12 40-11z"
;
CPPUNIT_ASSERT_MESSAGE
(
"exporting complex polygon to SVG-D"
,
aExport
.
equalsAscii
(
sExportString2
)
);
aExport
==
sExportString2
);
CPPUNIT_ASSERT_MESSAGE
(
"importing complex polygon from SVG-D (round-trip"
,
tools
::
importFromSvgD
(
aPoly
,
aExport
,
false
,
nullptr
));
aExport
=
tools
::
exportToSvgD
(
aPoly
,
true
,
true
,
false
);
CPPUNIT_ASSERT_MESSAGE
(
"exporting complex polygon to SVG-D (round-trip)"
,
aExport
.
equalsAscii
(
sExportString2
)
);
aExport
==
sExportString2
);
const
B2DPolygon
aRect
(
tools
::
createPolygonFromRect
(
B2DRange
(
0.0
,
0.0
,
4000.0
,
4000.0
)
));
aExport
=
tools
::
exportToSvgD
(
B2DPolyPolygon
(
aRect
),
false
,
false
,
false
);
const
char
*
sExportStringRect
=
"M0 0H4000V4000H0Z"
;
const
char
sExportStringRect
[]
=
"M0 0H4000V4000H0Z"
;
CPPUNIT_ASSERT_MESSAGE
(
"exporting to rectangle svg-d string"
,
aExport
.
equalsAscii
(
sExportStringRect
)
);
aExport
==
sExportStringRect
);
}
// Change the following lines only, if you add, remove or rename
...
...
basegfx/test/boxclipper.cxx
Dosyayı görüntüle @
d86f83b6
...
...
@@ -159,11 +159,9 @@ public:
aRandomIntersections
.
appendElement
(
aRandomRange
,
B2VectorOrientation
::
Negative
);
}
#else
const
char
*
randomSvg
=
"m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z"
;
const
char
randomSvg
[]
=
"m394 783h404v57h-404zm-197-505h571v576h-571zm356-634h75v200h-75zm-40-113h403v588h-403zm93-811h111v494h-111zm-364-619h562v121h-562zm-134-8h292v27h-292zm110 356h621v486h-621zm78-386h228v25h-228zm475-345h201v201h-201zm-2-93h122v126h-122zm-417-243h567v524h-567zm-266-738h863v456h-863zm262-333h315v698h-315zm-328-826h43v393h-43zm830-219h120v664h-120zm-311-636h221v109h-221zm-500 137h628v19h-628zm681-94h211v493h-211zm-366-646h384v355h-384zm-189-199h715v247h-715zm165-459h563v601h-563zm258-479h98v606h-98zm270-517h65v218h-65zm-44-259h96v286h-96zm-599-202h705v468h-705zm216-803h450v494h-450zm-150-22h26v167h-26zm-55-599h50v260h-50zm190-278h490v387h-490zm-290-453h634v392h-634zm257 189h552v300h-552zm-151-690h136v455h-136zm12-597h488v432h-488zm501-459h48v39h-48zm-224-112h429v22h-429zm-281 102h492v621h-492zm519-158h208v17h-208zm-681-563h56v427h-56zm126-451h615v392h-615zm-47-410h598v522h-598zm-32 316h79v110h-79zm-71-129h18v127h-18zm126-993h743v589h-743zm211-430h428v750h-428zm61-554h100v220h-100zm-353-49h658v157h-658zm778-383h115v272h-115zm-249-541h119v712h-119zm203 86h94v40h-94z"
;
B2DPolyPolygon
randomPoly
;
tools
::
importFromSvgD
(
randomPoly
,
OUString
::
createFromAscii
(
randomSvg
),
false
,
nullptr
);
tools
::
importFromSvgD
(
randomPoly
,
randomSvg
,
false
,
nullptr
);
for
(
auto
const
&
aPolygon
:
randomPoly
)
aRandomIntersections
.
appendElement
(
aPolygon
.
getB2DRange
(),
B2VectorOrientation
::
Negative
);
#endif
...
...
@@ -237,28 +235,28 @@ public:
void
verifyPoly
()
{
const
char
*
disjunct
=
"m-100-100v200h200v-200zm900 900v200h200v-200z"
;
const
char
*
equal
=
"m-100-100v200h200v-200zm200 0h-200v200h200v-200z"
;
const
char
*
intersectionN
=
"m-100-100v100h200v-100zm200 0v-100h-200v100 200h200v-200z"
;
const
char
*
intersectionE
=
"m0-100v200h100v-200zm0 0h-100v200h100 200v-200z"
;
const
char
*
intersectionS
=
"m-100 0v100h200v-100zm0-100v200 100h200v-100-200z"
;
const
char
*
intersectionW
=
"m-100-100v200h100v-200zm0 0h-100v200h100 200v-200z"
;
const
char
*
intersectionNE
=
"m0-100v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z"
;
const
char
*
intersectionSE
=
"m0 0v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z"
;
const
char
*
intersectionSW
=
"m-100 0v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z"
;
const
char
*
intersectionNW
=
"m-100-100v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z"
;
const
char
*
ringIntersection
=
"m50-150v100h100v-100zm0 200v100h100v-100zm100-200v-200h-300v300h200v100h-200v300h300v-200h200v-300z"
;
const
char
*
ringIntersection2
=
"m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v100z"
const
char
*
const
disjunct
=
"m-100-100v200h200v-200zm900 900v200h200v-200z"
;
const
char
*
const
equal
=
"m-100-100v200h200v-200zm200 0h-200v200h200v-200z"
;
const
char
*
const
intersectionN
=
"m-100-100v100h200v-100zm200 0v-100h-200v100 200h200v-200z"
;
const
char
*
const
intersectionE
=
"m0-100v200h100v-200zm0 0h-100v200h100 200v-200z"
;
const
char
*
const
intersectionS
=
"m-100 0v100h200v-100zm0-100v200 100h200v-100-200z"
;
const
char
*
const
intersectionW
=
"m-100-100v200h100v-200zm0 0h-100v200h100 200v-200z"
;
const
char
*
const
intersectionNE
=
"m0-100v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z"
;
const
char
*
const
intersectionSE
=
"m0 0v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z"
;
const
char
*
const
intersectionSW
=
"m-100 0v100h100v-100zm0-100v100h-100v200h200v-100h100v-200z"
;
const
char
*
const
intersectionNW
=
"m-100-100v100h100v-100zm100 0v-100h-200v200h100v100h200v-200z"
;
const
char
*
const
ringIntersection
=
"m50-150v100h100v-100zm0 200v100h100v-100zm100-200v-200h-300v300h200v100h-200v300h300v-200h200v-300z"
;
const
char
*
const
ringIntersection2
=
"m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v100z"
"m100-200v100h100v-100zm0 200v100h100v-100zm100-200v-200h-300v200h-200v300h200v200h300v-200h200v-300z"
;
const
char
*
ringIntersectExtraStrip
=
"m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v25h-50v50h50v25z"
const
char
*
const
ringIntersectExtraStrip
=
"m-150 50v100h100v-100zm0-200v100h100v-100zm100 200v-100h100v25h-50v50h50v25z"
"m100-200v100h100v-100zm0 200v100h100v-100zm0-75v50h150v-50z"
"m100-125v-200h-300v200h-200v300h200v200h300v-200h200v-300z"
;
const
char
*
complexIntersections
=
"m0 0zm0 0zm0 0zm0 0v-100 100h-100 100v100-100h100zm0 0v-100 100h-100 100v100-100h100z"
const
char
*
co
nst
co
mplexIntersections
=
"m0 0zm0 0zm0 0zm0 0v-100 100h-100 100v100-100h100zm0 0v-100 100h-100 100v100-100h100z"
"m100 0v-100h-100-100v100 100h100 100v-100zm0 0v-100h-100-100v100 100h100 100v-100z"
"m0 0v-100h-100v-100 100h-100v100h-100 100v100h100v100-100h100v-100h100z"
"m0-100v-100h-100-100v100h-100v100 100h100v100h100 100v-100h100v-100-100z"
"m100 0v-100h-200-100-100v100 200 100h100 100 200v-100-200zm600 900v200h200v-200z"
;
const
char
*
randomIntersections
=
"m20-4515v393h43v-393zm34-8690v127h18v-127zm24 674v427h56v-427zm126-451v16-16z"
const
char
*
const
randomIntersections
=
"m20-4515v393h43v-393zm34-8690v127h18v-127zm24 674v427h56v-427zm126-451v16-16z"
"m22 3470v260h50v-260zm55 599v167h26v-167zm-49-1831v455h136v-455z"
"m10 8845v19h158v-19zm54-38v25h228v-25zm156-13245v108h100v-108z"
"m101 14826v200h75v-200zm-205-3000v365h315v-365zm-309-1877v19h628v-19z"
...
...
basegfx/test/clipstate.cxx
Dosyayı görüntüle @
d86f83b6
...
...
@@ -114,11 +114,11 @@ public:
void
verifySimpleRange
()
{
const
char
*
unionSvg
=
"m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"
;
const
char
*
intersectSvg
=
"m-100 10v-20h10v20zm90 90v-10h20v10zm0-190v-10h20v10zm100 100v-20h10v20z"
;
const
char
*
xorSvg
=
"m-100 10h10v-20h-10zm90 90h20v-10h-20zm0-190h20v-10h-20zm100 100h10v-20h-10z"
const
char
*
const
unionSvg
=
"m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"
;
const
char
*
const
intersectSvg
=
"m-100 10v-20h10v20zm90 90v-10h20v10zm0-190v-10h20v10zm100 100v-20h10v20z"
;
const
char
*
const
xorSvg
=
"m-100 10h10v-20h-10zm90 90h20v-10h-20zm0-190h20v-10h-20zm100 100h10v-20h-10z"
"m10 0v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"
;
const
char
*
subtractSvg
=
"m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z"
;
const
char
*
const
subtractSvg
=
"m-90 10v-20h-10v-90h90v10h20v-10h90v90h-10v20h10v90h-90v-10h-20v10h-90v-90z"
;
CPPUNIT_ASSERT_MESSAGE
(
"cleared clip stays empty under union operation"
,
aUnion1
.
isCleared
());
...
...
@@ -132,18 +132,17 @@ public:
{
tools
::
B2DClipState
aMixedClip
;
const
char
*
unionSvg
=
"m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"
;
const
char
unionSvg
[]
=
"m100 10v90h-90v10h-20v-10h-90v-90h-10v-20h10v-90h90v-10h20v10h90v90h10v20z"
;
B2DPolyPolygon
aTmp1
;
tools
::
importFromSvgD
(
aTmp1
,
OUString
::
createFromAscii
(
unionSvg
),
false
,
nullptr
);
tools
::
importFromSvgD
(
aTmp1
,
unionSvg
,
false
,
nullptr
);
aMixedClip
.
intersectPolyPolygon
(
aTmp1
);
aMixedClip
.
subtractRange
(
B2DRange
(
-
20
,
-
150
,
20
,
0
));
aMixedClip
.
subtractRange
(
B2DRange
(
-
150
,
-
20
,
0
,
20
));
aMixedClip
.
xorRange
(
B2DRange
(
-
150
,
-
150
,
150
,
150
));
const
char
*
mixedClipSvg
=
"m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-20-20v-80h-80v80zm-130 170v-300h300v300z"
;
const
char
*
const
mixedClipSvg
=
"m0 0v20h-100v80h90v10h20v-10h90v-90h10v-20h-10v-90h-80v100zm-20-20v-80h-80v80zm-130 170v-300h300v300z"
;
verifyPoly
(
"mixed clip"
,
mixedClipSvg
,
aMixedClip
);
}
...
...
basegfx/test/genericclipper.cxx
Dosyayı görüntüle @
d86f83b6
...
...
@@ -103,25 +103,25 @@ public:
void
validateOr
()
{
const
char
*
pValid
=
"m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 100v-50h-50v50z"
;
const
char
*
const
pValid
=
"m0 0h100v150h-75v-50h-5v50h-20v-50-10zm75 100v-50h-50v50z"
;
validate
(
"validateOr"
,
pValid
,
&
tools
::
solvePolygonOperationOr
);
}
void
validateXor
()
{
const
char
*
pValid
=
"m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 100h20v-10h-20zm75 0v-50h-50v50z"
;
const
char
*
const
pValid
=
"m0 0h100v150h-75v-50h-5v50h-20v-50-10zm0 100h20v-10h-20zm75 0v-50h-50v50z"
;
validate
(
"validateXor"
,
pValid
,
&
tools
::
solvePolygonOperationXor
);
}
void
validateAnd
()
{
const
char
*
pValid
=
"m0 100v-10h20v10z"
;
const
char
*
const
pValid
=
"m0 100v-10h20v10z"
;
validate
(
"validateAnd"
,
pValid
,
&
tools
::
solvePolygonOperationAnd
);
}
void
validateDiff
()
{
const
char
*
pValid
=
"m0 90v-90h100v150h-75v-50h-5v-10zm75 10v-50h-50v50z"
;
const
char
*
const
pValid
=
"m0 90v-90h100v150h-75v-50h-5v-10zm75 10v-50h-50v50z"
;
validate
(
"validateDiff"
,
pValid
,
&
tools
::
solvePolygonOperationDiff
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment