[DEV] write test svg file to compare
This commit is contained in:
parent
f5d5391884
commit
85af6d85d0
@ -16,7 +16,7 @@
|
||||
#define __class__ "PaintState"
|
||||
|
||||
esvg::PaintState::PaintState() :
|
||||
fill(etk::color::none),
|
||||
fill(etk::color::black),
|
||||
stroke(etk::color::none),
|
||||
strokeWidth(1.0f),
|
||||
flagEvenOdd(false),
|
||||
|
@ -14,28 +14,34 @@
|
||||
#define __class__ "TestCircle"
|
||||
|
||||
TEST(TestCircle, fill) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <circle cx='50' cy='50' r='40' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <circle cx='50' cy='50' r='40' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestCircle_fill.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestCircle_fill.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestCircle, stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestCircle_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestCircle_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestCircle, fill_and_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <circle cx='50' cy='50' r='40' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestCircle_fill_and_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestCircle_fill_and_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
@ -14,28 +14,35 @@
|
||||
#define __class__ "TestEllipse"
|
||||
|
||||
TEST(TestEllipse, fill) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <ellipse cx='50' cy='50' rx='80' ry='30' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <ellipse cx='50' cy='50' rx='80' ry='30' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestEllipse_fill.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestEllipse_fill.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestEllipse, stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestEllipse_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestEllipse_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestEllipse, fill_and_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <ellipse cx='50' cy='50' rx='80' ry='30' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestEllipse_fill_and_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestEllipse_fill_and_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,10 +14,14 @@
|
||||
#define __class__ "TestLine"
|
||||
|
||||
TEST(TestLine, stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <line x1='10' y1='10' x2='90' y2='90' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <line x1='10' y1='10' x2='90' y2='90' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestLine_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestLine_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,31 +14,37 @@
|
||||
#define __class__ "TestPath"
|
||||
|
||||
TEST(TestPath, fill) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||
" fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||
" fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestPath_fill.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestPath_fill.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestPath, stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||
" stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||
" stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestPath_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestPath_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestPath, fill_and_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||
" stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <path d='m 50,50 c -12.426,0 -22.5,10.072 -22.5,22.5 0,12.426 10.074,22.5 22.5,22.5 12.428,0 22.5,-10.074 22.5,-22.5 0,-12.427 -10.072,-22.5 -22.5,-22.5 z'"
|
||||
" stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestPath_fill_and_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestPath_fill_and_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
@ -14,28 +14,34 @@
|
||||
#define __class__ "TestPolygon"
|
||||
|
||||
TEST(TestPolygon, fill) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <polygon points='50,10 90,50 10,80' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <polygon points='50,10 90,50 10,80' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestPolygon_fill.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestPolygon_fill.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestPolygon, stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestPolygon_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestPolygon_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestPolygon, fill_and_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <polygon points='50,10 90,50 10,80' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestPolygon_fill_and_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestPolygon_fill_and_stroke.ppm", g_visualDebug);
|
||||
}
|
@ -14,73 +14,89 @@
|
||||
#define __class__ "TestRectangle"
|
||||
|
||||
TEST(TestRectangle, fill) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_fill.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_fill.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, fill_and_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_fill_and_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_fill_and_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, fill_and_stroke_blend) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F08' stroke-width='3' fill='#F008' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F08' stroke-width='3' fill='#F008' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_fill_and_stroke_blend.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_fill_and_stroke_blend.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, fill_and_stroke_opacity) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0F' stroke-width='3' fill='#F00F' opacity='0.5' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' stroke='#0F0F' stroke-width='3' fill='#F00F' opacity='0.5' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_fill_and_stroke_blend.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_fill_and_stroke_blend.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, corned_fill) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_corned_fill.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_corned_fill.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, corned_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_corned_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_corned_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
||||
TEST(TestRectangle, corned_fill_and_stroke) {
|
||||
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
esvg::Document doc;
|
||||
doc.parse( "<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||
"<svg height='100' width='100'>"
|
||||
" <rect x='12.5' y='12.5' width='75' height='50' rx='20' ry='20' stroke='green' stroke-width='3' fill='red' />"
|
||||
"</svg>");
|
||||
doc.parse(data);
|
||||
etk::FSNodeWriteAllData("TestRectangle_corned_fill_and_stroke.svg", data);
|
||||
doc.generateAnImage(ivec2(100, 100), "TestRectangle_corned_fill_and_stroke.ppm", g_visualDebug);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user