mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
test: render jpg and png files
This commit is contained in:
parent
ba1a38ed39
commit
c3aef76278
1 changed files with 40 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue