mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00

In test directory, set up unit_test based on gtest First, add a test for SwCanvas generate.
28 lines
691 B
C++
28 lines
691 B
C++
#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);
|
|
}
|
|
|