mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
test/lottie: added the slot resetting in animated property case
This commit is contained in:
parent
3b22f008f7
commit
baaae5e416
3 changed files with 61 additions and 0 deletions
|
@ -69,6 +69,39 @@ TEST_CASE("Lottie Slot", "[capiLottie]")
|
||||||
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Lottie Slot 2", "[capiLottie]")
|
||||||
|
{
|
||||||
|
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
Tvg_Animation* animation = tvg_lottie_animation_new();
|
||||||
|
REQUIRE(animation);
|
||||||
|
|
||||||
|
Tvg_Paint* picture = tvg_animation_get_picture(animation);
|
||||||
|
REQUIRE(picture);
|
||||||
|
|
||||||
|
Tvg_Identifier id = TVG_IDENTIFIER_UNDEF;
|
||||||
|
REQUIRE(tvg_paint_get_identifier(picture, &id) == TVG_RESULT_SUCCESS);
|
||||||
|
REQUIRE(id == TVG_IDENTIFIER_PICTURE);
|
||||||
|
|
||||||
|
const char* slotJson = R"({"lottie-icon-outline":{"p":{"a":0,"k":[1,1,0]}},"lottie-icon-solid":{"p":{"a":0,"k":[0,0,1]}}})";
|
||||||
|
|
||||||
|
//Animation load
|
||||||
|
REQUIRE(tvg_picture_load(picture, TEST_DIR"/lottieslotkeyframe.json") == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
//Slot override
|
||||||
|
REQUIRE(tvg_lottie_animation_override(animation, slotJson) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
//Slot revert
|
||||||
|
REQUIRE(tvg_lottie_animation_override(animation, nullptr) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
//Slot override after reverting
|
||||||
|
REQUIRE(tvg_lottie_animation_override(animation, slotJson) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
REQUIRE(tvg_animation_del(animation) == TVG_RESULT_SUCCESS);
|
||||||
|
|
||||||
|
REQUIRE(tvg_engine_term(TVG_ENGINE_SW) == TVG_RESULT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("Lottie Marker", "[capiLottie]")
|
TEST_CASE("Lottie Marker", "[capiLottie]")
|
||||||
{
|
{
|
||||||
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
REQUIRE(tvg_engine_init(TVG_ENGINE_SW, 0) == TVG_RESULT_SUCCESS);
|
||||||
|
|
1
test/resources/lottieslotkeyframe.json
Normal file
1
test/resources/lottieslotkeyframe.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -70,6 +70,33 @@ TEST_CASE("Lottie Slot", "[tvgLottie]")
|
||||||
REQUIRE(Initializer::term() == Result::Success);
|
REQUIRE(Initializer::term() == Result::Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Lottie Slot 2", "[tvgLottie]")
|
||||||
|
{
|
||||||
|
REQUIRE(Initializer::init(0) == Result::Success);
|
||||||
|
|
||||||
|
auto animation = LottieAnimation::gen();
|
||||||
|
REQUIRE(animation);
|
||||||
|
|
||||||
|
auto picture = animation->picture();
|
||||||
|
REQUIRE(picture->identifier() == Picture::identifier());
|
||||||
|
|
||||||
|
const char* slotJson = R"({"lottie-icon-outline":{"p":{"a":0,"k":[1,1,0]}},"lottie-icon-solid":{"p":{"a":0,"k":[0,0,1]}}})";
|
||||||
|
|
||||||
|
//Animation load
|
||||||
|
REQUIRE(picture->load(TEST_DIR"/lottieslotkeyframe.json") == Result::Success);
|
||||||
|
|
||||||
|
//Slot override
|
||||||
|
REQUIRE(animation->override(slotJson) == Result::Success);
|
||||||
|
|
||||||
|
//Slot revert
|
||||||
|
REQUIRE(animation->override(nullptr) == Result::Success);
|
||||||
|
|
||||||
|
//Slot override after reverting
|
||||||
|
REQUIRE(animation->override(slotJson) == Result::Success);
|
||||||
|
|
||||||
|
REQUIRE(Initializer::term() == Result::Success);
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("Lottie Marker", "[tvgLottie]")
|
TEST_CASE("Lottie Marker", "[tvgLottie]")
|
||||||
{
|
{
|
||||||
REQUIRE(Initializer::init(0) == Result::Success);
|
REQUIRE(Initializer::init(0) == Result::Success);
|
||||||
|
|
Loading…
Add table
Reference in a new issue