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
4daaa16384
commit
f000d9f766
3 changed files with 63 additions and 2 deletions
|
@ -69,6 +69,39 @@ TEST_CASE("Lottie Slot", "[capiLottie]")
|
|||
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]")
|
||||
{
|
||||
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,9 +70,36 @@ TEST_CASE("Lottie Slot", "[tvgLottie]")
|
|||
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
|
||||
}
|
||||
|
||||
TEST_CASE("Lottie Slot 2", "[tvgLottie]")
|
||||
{
|
||||
REQUIRE(Initializer::init(CanvasEngine::Sw, 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(CanvasEngine::Sw) == Result::Success);
|
||||
}
|
||||
|
||||
TEST_CASE("Lottie Marker", "[tvgLottie]")
|
||||
{
|
||||
REQUIRE(Initializer::init(tvg::CanvasEngine::Sw, 0) == Result::Success);
|
||||
REQUIRE(Initializer::init(CanvasEngine::Sw, 0) == Result::Success);
|
||||
|
||||
auto animation = LottieAnimation::gen();
|
||||
REQUIRE(animation);
|
||||
|
@ -101,7 +128,7 @@ TEST_CASE("Lottie Marker", "[tvgLottie]")
|
|||
//Get marker name by invalid index
|
||||
REQUIRE(animation->marker(-1) == nullptr);
|
||||
|
||||
REQUIRE(Initializer::term(tvg::CanvasEngine::Sw) == Result::Success);
|
||||
REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success);
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Reference in a new issue