subdir('inc')
subdir('src')
+if get_option('test') == true
+ subdir('test')
+endif
+
summary = '''
Summary:
thorvg version : @0@
Build type : @1@
Prefix : @2@
+ Test : @3@
'''.format(
meson.project_version(),
get_option('buildtype'),
get_option('prefix'),
+ get_option('test'),
)
message(summary)
type: 'boolean',
value: false,
description: 'Enable building examples')
+
+option('test',
+ type: 'boolean',
+ value: false,
+ description: 'Enable building unit tests')
--- /dev/null
+
+#TODO:Need to change warning level to 3
+override_default = ['warning_level=0', 'werror=false']
+
+gtest_dep = dependency('gtest')
+
+canvas_test_sources = [
+ 'testsuite.cpp',
+ 'test_canvas.cpp',
+ ]
+
+canvas_testsuite = executable('canvasTestSuite',
+ canvas_test_sources,
+ include_directories : headers,
+ override_options : override_default,
+ dependencies : [gtest_dep, thorvg_lib_dep],
+ )
+
+test('Canvas Testsuite', canvas_testsuite)
--- /dev/null
+#include <gtest/gtest.h>
+#include <iostream>
+#include <thread>
+#include <thorvg.h>
+
+class CanvasTest : public ::testing::Test {
+public:
+ void SetUp() {
+ auto threads = std::thread::hardware_concurrency();
+ //Initialize ThorVG Engine
+ if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
+ swCanvas = tvg::SwCanvas::gen();
+ }
+ }
+ void TearDown() {
+
+ //Terminate ThorVG Engine
+ tvg::Initializer::term(tvgEngine);
+ }
+public:
+ std::unique_ptr<tvg::SwCanvas> swCanvas;
+ tvg::CanvasEngine tvgEngine = tvg::CanvasEngine::Sw;
+};
+
+TEST_F(CanvasTest, GenerateCanvas) {
+ ASSERT_TRUE(swCanvas != nullptr);
+}
+
--- /dev/null
+#include <gtest/gtest.h>
+
+int main(int argc, char **argv) {
+ testing::InitGoogleTest(&argc, argv);
+ return RUN_ALL_TESTS();
+}
+