[DEV] add miter and cap test
This commit is contained in:
parent
aeb8d8e9d9
commit
54d7054358
48
test/testCap.cpp
Normal file
48
test/testCap.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* @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(TestCap, butt) {
|
||||||
|
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
|
"<svg height='100' width='100'>"
|
||||||
|
" <polyline points='20,50 80,50' stroke='green' stroke-width='20' fill='none' stroke-linecap='butt'/>"
|
||||||
|
"</svg>");
|
||||||
|
esvg::Document doc;
|
||||||
|
doc.parse(data);
|
||||||
|
etk::FSNodeWriteAllData("TestCap_butt.svg", data);
|
||||||
|
doc.generateAnImage(ivec2(100, 100), "TestCap_butt.bmp", g_visualDebug);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TestCap, round) {
|
||||||
|
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
|
"<svg height='100' width='100'>"
|
||||||
|
" <polyline points='20,50 80,50' stroke='green' stroke-width='20' fill='none' stroke-linecap='round'/>"
|
||||||
|
"</svg>");
|
||||||
|
esvg::Document doc;
|
||||||
|
doc.parse(data);
|
||||||
|
etk::FSNodeWriteAllData("TestCap_round.svg", data);
|
||||||
|
doc.generateAnImage(ivec2(100, 100), "TestCap_round.bmp", g_visualDebug);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TestCap, square) {
|
||||||
|
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
|
"<svg height='100' width='100'>"
|
||||||
|
" <polyline points='20,50 80,50' stroke='green' stroke-width='20' fill='none' stroke-linecap='square'/>"
|
||||||
|
"</svg>");
|
||||||
|
esvg::Document doc;
|
||||||
|
doc.parse(data);
|
||||||
|
etk::FSNodeWriteAllData("TestCap_square.svg", data);
|
||||||
|
doc.generateAnImage(ivec2(100, 100), "TestCap_square.bmp", g_visualDebug);
|
||||||
|
}
|
||||||
|
|
48
test/testJoin.cpp
Normal file
48
test/testJoin.cpp
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/**
|
||||||
|
* @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(TestJoin, miter) {
|
||||||
|
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
|
"<svg height='100' width='100'>"
|
||||||
|
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='miter'/>"
|
||||||
|
"</svg>");
|
||||||
|
esvg::Document doc;
|
||||||
|
doc.parse(data);
|
||||||
|
etk::FSNodeWriteAllData("TestJoin_miter.svg", data);
|
||||||
|
doc.generateAnImage(ivec2(100, 100), "TestJoin_miter.bmp", g_visualDebug);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TestJoin, round) {
|
||||||
|
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
|
"<svg height='100' width='100'>"
|
||||||
|
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='round'/>"
|
||||||
|
"</svg>");
|
||||||
|
esvg::Document doc;
|
||||||
|
doc.parse(data);
|
||||||
|
etk::FSNodeWriteAllData("TestJoin_round.svg", data);
|
||||||
|
doc.generateAnImage(ivec2(100, 100), "TestJoin_round.bmp", g_visualDebug);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(TestJoin, bevel) {
|
||||||
|
std::string data("<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
|
||||||
|
"<svg height='100' width='100'>"
|
||||||
|
" <polyline points='20,20 50,50 20,80' stroke='green' stroke-width='20' fill='none' stroke-linejoin='bevel'/>"
|
||||||
|
"</svg>");
|
||||||
|
esvg::Document doc;
|
||||||
|
doc.parse(data);
|
||||||
|
etk::FSNodeWriteAllData("TestJoin_bevel.svg", data);
|
||||||
|
doc.generateAnImage(ivec2(100, 100), "TestJoin_bevel.bmp", g_visualDebug);
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user