Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Krita
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tusooa Zhu
Krita
Commits
b8aa7128
Commit
b8aa7128
authored
Nov 17, 2016
by
Dmitry Kazakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test cases for testing basic shapes
parent
4486f0cb
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
181 additions
and
0 deletions
+181
-0
libs/flake/tests/TestSvgParser.cpp
libs/flake/tests/TestSvgParser.cpp
+168
-0
libs/flake/tests/TestSvgParser.h
libs/flake/tests/TestSvgParser.h
+13
-0
libs/flake/tests/data/svg_render/load_circle.png
libs/flake/tests/data/svg_render/load_circle.png
+0
-0
libs/flake/tests/data/svg_render/load_ellipse.png
libs/flake/tests/data/svg_render/load_ellipse.png
+0
-0
libs/flake/tests/data/svg_render/load_line.png
libs/flake/tests/data/svg_render/load_line.png
+0
-0
libs/flake/tests/data/svg_render/load_polygon.png
libs/flake/tests/data/svg_render/load_polygon.png
+0
-0
libs/flake/tests/data/svg_render/load_polyline.png
libs/flake/tests/data/svg_render/load_polyline.png
+0
-0
libs/flake/tests/data/svg_render/load_rect_5_10.png
libs/flake/tests/data/svg_render/load_rect_5_10.png
+0
-0
libs/flake/tests/data/svg_render/load_rect_5_5.png
libs/flake/tests/data/svg_render/load_rect_5_5.png
+0
-0
No files found.
libs/flake/tests/TestSvgParser.cpp
View file @
b8aa7128
...
...
@@ -2505,4 +2505,172 @@ void TestSvgParser::testRenderImage_AspectMeet()
t
.
test_standard_30px_72ppi
(
"image_aspect_meet"
,
false
);
}
void
TestSvgParser
::
testRectShapeRoundUniformX
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <rect id=
\"
testRect
\"
x=
\"
5
\"
y=
\"
5
\"
width=
\"
20
\"
height=
\"
20
\"
"
" rx=
\"
5
\"
"
" fill=
\"
blue
\"
stroke=
\"
none
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"rect_5_5"
,
false
);
}
void
TestSvgParser
::
testRectShapeRoundUniformY
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <rect id=
\"
testRect
\"
x=
\"
5
\"
y=
\"
5
\"
width=
\"
20
\"
height=
\"
20
\"
"
" rx=
\"
5
\"
"
" fill=
\"
blue
\"
stroke=
\"
none
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"rect_5_5"
,
false
);
}
void
TestSvgParser
::
testRectShapeRoundXY
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <rect id=
\"
testRect
\"
x=
\"
5
\"
y=
\"
5
\"
width=
\"
20
\"
height=
\"
20
\"
"
" rx=
\"
5
\"
ry=
\"
10
\"
"
" fill=
\"
blue
\"
stroke=
\"
none
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"rect_5_10"
,
false
);
}
void
TestSvgParser
::
testRectShapeRoundXYOverflow
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <rect id=
\"
testRect
\"
x=
\"
5
\"
y=
\"
5
\"
width=
\"
20
\"
height=
\"
20
\"
"
" rx=
\"
5
\"
ry=
\"
25
\"
"
" fill=
\"
blue
\"
stroke=
\"
none
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"rect_5_10"
,
false
);
}
void
TestSvgParser
::
testCircleShape
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <circle id=
\"
testRect
\"
cx=
\"
15
\"
cy=
\"
15
\"
r=
\"
10
\"
"
" fill=
\"
blue
\"
stroke=
\"
white
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"circle"
,
false
);
}
void
TestSvgParser
::
testEllipseShape
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <ellipse id=
\"
testRect
\"
cx=
\"
15
\"
cy=
\"
15
\"
rx=
\"
10
\"
ry=
\"
5
\"
"
" fill=
\"
blue
\"
stroke=
\"
white
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"ellipse"
,
false
);
}
void
TestSvgParser
::
testLineShape
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <line id=
\"
testRect
\"
x1=
\"
5
\"
y1=
\"
5
\"
x2=
\"
25
\"
y2=
\"
15
\"
"
" fill=
\"
blue
\"
stroke=
\"
white
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"line"
,
false
);
}
void
TestSvgParser
::
testPolylineShape
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <polyline id=
\"
testRect
\"
points=
\"
5,5 10, 5 10,10 5,10
\n
"
" 5 ,15 15 , 15 15,20 20,20 20,10 25,10 25,25 5,25
\"
"
" fill=
\"
red
\"
stroke=
\"
white
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"polyline"
,
false
);
}
void
TestSvgParser
::
testPolygonShape
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <polygon id=
\"
testRect
\"
points=
\"
5,5 10, 5 10,10 5,10
\n
"
" 5 ,15 15 , 15 15,20 20,20 20,10 25,10 25,25 5,25
\"
"
" fill=
\"
red
\"
stroke=
\"
white
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"polygon"
,
false
);
}
void
TestSvgParser
::
testPathShape
()
{
const
QString
data
=
"<svg width=
\"
30px
\"
height=
\"
30px
\"
"
" xmlns=
\"
http://www.w3.org/2000/svg
\"
version=
\"
1.1
\"
>"
" <path id=
\"
testRect
\"
"
" d=
\"
M 5,5 h 5 l 0,5 L5,10 l 0,5 l10,0 v5 l 5, 0 L20, 10 l 5,0 L 25,25 L 5,25 z
\"
"
" fill=
\"
red
\"
stroke=
\"
white
\"
/>"
"</svg>"
;
SvgRenderTester
t
(
data
);
t
.
test_standard_30px_72ppi
(
"polygon"
,
false
);
}
QTEST_MAIN
(
TestSvgParser
)
libs/flake/tests/TestSvgParser.h
View file @
b8aa7128
...
...
@@ -132,6 +132,19 @@ private Q_SLOTS:
void
testRenderImage_AspectDefault
();
void
testRenderImage_AspectNone
();
void
testRenderImage_AspectMeet
();
void
testRectShapeRoundUniformX
();
void
testRectShapeRoundUniformY
();
void
testRectShapeRoundXY
();
void
testRectShapeRoundXYOverflow
();
void
testCircleShape
();
void
testEllipseShape
();
void
testLineShape
();
void
testPolylineShape
();
void
testPolygonShape
();
void
testPathShape
();
};
#endif // TESTSVGPARSER_H
libs/flake/tests/data/svg_render/load_circle.png
0 → 100644
View file @
b8aa7128
197 Bytes
libs/flake/tests/data/svg_render/load_ellipse.png
0 → 100644
View file @
b8aa7128
170 Bytes
libs/flake/tests/data/svg_render/load_line.png
0 → 100644
View file @
b8aa7128
115 Bytes
libs/flake/tests/data/svg_render/load_polygon.png
0 → 100644
View file @
b8aa7128
187 Bytes
libs/flake/tests/data/svg_render/load_polyline.png
0 → 100644
View file @
b8aa7128
190 Bytes
libs/flake/tests/data/svg_render/load_rect_5_10.png
0 → 100644
View file @
b8aa7128
166 Bytes
libs/flake/tests/data/svg_render/load_rect_5_5.png
0 → 100644
View file @
b8aa7128
154 Bytes
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