From a8e13ed2b7787214b6dc7a98821fe5d30d83d432 Mon Sep 17 00:00:00 2001 From: Michal Maciola Date: Wed, 14 Jul 2021 11:27:19 +0200 Subject: [PATCH] test: svg rendering Added SVG file loading and rendering for increasing TC Line coverage Line coverage for src/loaders/svg: 85.5% --- test/testPicture.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/test/testPicture.cpp b/test/testPicture.cpp index 2b5eff87..ce872585 100644 --- a/test/testPicture.cpp +++ b/test/testPicture.cpp @@ -130,4 +130,24 @@ TEST_CASE("Picture Size", "[tvgPicture]") REQUIRE(picture->load(EXAMPLE_DIR"/tiger.svg") == Result::Success); REQUIRE(picture->size(&w, &h) == Result::Success); REQUIRE(picture->size(w, h) == Result::Success); -} \ No newline at end of file +} + +TEST_CASE("Load SVG file and render", "[tvgPicture]") +{ + REQUIRE(Initializer::init(CanvasEngine::Sw, 0) == Result::Success); + + auto canvas = SwCanvas::gen(); + REQUIRE(canvas); + + uint32_t buffer[100*100]; + REQUIRE(canvas->target(buffer, 100, 100, 100, SwCanvas::Colorspace::ABGR8888) == Result::Success); + + auto picture = Picture::gen(); + REQUIRE(picture); + + REQUIRE(picture->load(EXAMPLE_DIR"/logo_test.svg") == Result::Success); + + REQUIRE(canvas->push(move(picture)) == Result::Success); + + REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success); +}