test: render jpg and png files

This commit is contained in:
Michal Maciola 2021-07-15 11:13:20 +02:00 committed by Hermet Park
parent ba1a38ed39
commit c3aef76278

View file

@ -151,3 +151,43 @@ TEST_CASE("Load SVG file and render", "[tvgPicture]")
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
}
TEST_CASE("Load PNG 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.png") == Result::Success);
REQUIRE(canvas->push(move(picture)) == Result::Success);
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
}
TEST_CASE("Load JPG 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.jpg") == Result::Success);
REQUIRE(canvas->push(move(picture)) == Result::Success);
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
}