mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
test capi: ++coverage
added jpg, tvg tests
This commit is contained in:
parent
f0ae3e9cee
commit
d359d65640
1 changed files with 52 additions and 0 deletions
|
@ -155,4 +155,56 @@ TEST_CASE("Load Png file in Picture", "[capiPicture]")
|
||||||
REQUIRE(tvg_paint_del(picture) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_paint_del(picture) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef THORVG_JPG_LOADER_SUPPORT
|
||||||
|
|
||||||
|
TEST_CASE("Load Jpg file in Picture", "[capiPicture]")
|
||||||
|
{
|
||||||
|
Tvg_Paint* picture = tvg_picture_new();
|
||||||
|
REQUIRE(picture);
|
||||||
|
|
||||||
|
//Invalid file
|
||||||
|
REQUIRE(tvg_picture_load(picture, "invalid.jpg") == TVG_RESULT_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
//Load Png file
|
||||||
|
REQUIRE(tvg_picture_load(picture, TEST_DIR"/test.jpg") == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
//Verify Size
|
||||||
|
float wNew = 500.0f, hNew = 500.0f;
|
||||||
|
float w = 0.0f, h = 0.0f;
|
||||||
|
REQUIRE(tvg_picture_set_size(picture, wNew, hNew) == TVG_RESULT_SUCCESS);
|
||||||
|
REQUIRE(tvg_picture_get_size(picture, &w, &h) == TVG_RESULT_SUCCESS);
|
||||||
|
REQUIRE(w == Approx(wNew).epsilon(0.0000001));
|
||||||
|
REQUIRE(h == Approx(hNew).epsilon(0.0000001));
|
||||||
|
|
||||||
|
REQUIRE(tvg_paint_del(picture) == TVG_RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef THORVG_TVG_LOADER_SUPPORT
|
||||||
|
|
||||||
|
TEST_CASE("Load Tvg file in Picture", "[capiPicture]")
|
||||||
|
{
|
||||||
|
Tvg_Paint* picture = tvg_picture_new();
|
||||||
|
REQUIRE(picture);
|
||||||
|
|
||||||
|
//Invalid file
|
||||||
|
REQUIRE(tvg_picture_load(picture, "invalid.tvg") == TVG_RESULT_INVALID_ARGUMENT);
|
||||||
|
|
||||||
|
//Load Png file
|
||||||
|
REQUIRE(tvg_picture_load(picture, TEST_DIR"/test.tvg") == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
//Verify Size
|
||||||
|
float wNew = 500.0f, hNew = 500.0f;
|
||||||
|
float w = 0.0f, h = 0.0f;
|
||||||
|
REQUIRE(tvg_picture_set_size(picture, wNew, hNew) == TVG_RESULT_SUCCESS);
|
||||||
|
REQUIRE(tvg_picture_get_size(picture, &w, &h) == TVG_RESULT_SUCCESS);
|
||||||
|
REQUIRE(w == Approx(wNew).epsilon(0.0000001));
|
||||||
|
REQUIRE(h == Approx(hNew).epsilon(0.0000001));
|
||||||
|
|
||||||
|
REQUIRE(tvg_paint_del(picture) == TVG_RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
Loading…
Add table
Reference in a new issue