[DEV] add polyline test

This commit is contained in:
Edouard DUPIN 2015-11-24 21:53:28 +01:00
parent 54d7054358
commit 2b2a567526
2 changed files with 52 additions and 1 deletions

View File

@ -36,7 +36,9 @@ def create(target, module_name):
'test/testPath.cpp',
'test/testPolygon.cpp',
'test/testPolyline.cpp',
'test/testRectangle.cpp'
'test/testRectangle.cpp',
'test/testJoin.cpp',
'test/testCap.cpp'
])
my_module.add_module_depend(['esvg', 'gtest', 'test-debug'])
return my_module

View File

@ -0,0 +1,49 @@
/**
* @author Edouard DUPIN
*
* @copyright 2014, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <gtest/gtest.h>
#include <esvg/esvg.h>
#include "main.h"
#undef __class__
#define __class__ "TestLine"
TEST(TestPolyLine, fill) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>"
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' fill='orange' />"
"</svg>");
esvg::Document doc;
doc.parse(data);
etk::FSNodeWriteAllData("TestPolyLine_fill.svg", data);
doc.generateAnImage(ivec2(100, 100), "TestPolyLine_fill.bmp", g_visualDebug);
}
TEST(TestPolyLine, stroke) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>"
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='none' />"
"</svg>");
esvg::Document doc;
doc.parse(data);
etk::FSNodeWriteAllData("TestPolyLine_stroke.svg", data);
doc.generateAnImage(ivec2(100, 100), "TestPolyLine_stroke.bmp", g_visualDebug);
}
TEST(TestPolyLine, fill_and_stroke) {
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
"<svg height='100' width='100'>"
" <polyline points='20,20 40,25 60,40 80,90 90,50 5,90' stroke='green' stroke-width='3' fill='orange' />"
"</svg>");
esvg::Document doc;
doc.parse(data);
etk::FSNodeWriteAllData("TestPolyLine_fill_and_stroke.svg", data);
doc.generateAnImage(ivec2(100, 100), "TestPolyLine_fill_and_stroke.bmp", g_visualDebug);
}