test: update Lottie slot test code

This commit is contained in:
Jinny You 2025-03-17 18:17:52 +09:00
parent c48a73c6f2
commit 3aa434ce03

View file

@ -46,26 +46,33 @@ TEST_CASE("Lottie Slot", "[tvgLottie]")
const char* slotJson = R"({"gradient_fill":{"p":{"p":2,"k":{"a":0,"k":[0,0.1,0.1,0.2,1,1,0.1,0.2,0.1,1]}}}})";
//Slot override before loaded
REQUIRE(animation->override(slotJson) == Result::InsufficientCondition);
//Slot generation before loaded
REQUIRE(animation->gen(slotJson) == 0);
//Animation load
REQUIRE(picture->load(TEST_DIR"/lottieslot.json") == Result::Success);
//Slot generation
auto id = animation->gen(slotJson);
REQUIRE(id > 0);
//Slot revert before overriding
REQUIRE(animation->override(nullptr) == Result::Success);
REQUIRE(animation->apply(0) == Result::Success);
//Slot override
REQUIRE(animation->override(slotJson) == Result::Success);
REQUIRE(animation->apply(id) == Result::Success);
//Slot revert
REQUIRE(animation->override(nullptr) == Result::Success);
REQUIRE(animation->apply(0) == Result::Success);
//Slot override after reverting
REQUIRE(animation->override(slotJson) == Result::Success);
REQUIRE(animation->apply(id) == Result::Success);
//Slot override with invalid JSON
REQUIRE(animation->override("") == Result::InvalidArguments);
//Slot generation with invalid JSON
REQUIRE(animation->gen("") == 0);
//Slot deletion
REQUIRE(animation->del(id) == Result::Success);
REQUIRE(Initializer::term() == Result::Success);
}
@ -84,14 +91,21 @@ TEST_CASE("Lottie Slot 2", "[tvgLottie]")
//Animation load
REQUIRE(picture->load(TEST_DIR"/lottieslotkeyframe.json") == Result::Success);
//Slot generation
auto id = animation->gen(slotJson);
REQUIRE(id > 0);
//Slot override
REQUIRE(animation->override(slotJson) == Result::Success);
REQUIRE(animation->apply(id) == Result::Success);
//Slot revert
REQUIRE(animation->override(nullptr) == Result::Success);
REQUIRE(animation->apply(0) == Result::Success);
//Slot override after reverting
REQUIRE(animation->override(slotJson) == Result::Success);
REQUIRE(animation->apply(id) == Result::Success);
//Slot deletion
REQUIRE(animation->del(id) == Result::Success);
REQUIRE(Initializer::term() == Result::Success);
}