mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
test: update Lottie slot test code
This commit is contained in:
parent
473ec4bb1a
commit
192e0c5627
1 changed files with 25 additions and 11 deletions
|
@ -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]}}}})";
|
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
|
//Slot generation before loaded
|
||||||
REQUIRE(animation->override(slotJson) == Result::InsufficientCondition);
|
REQUIRE(animation->genSlot(slotJson) == 0);
|
||||||
|
|
||||||
//Animation load
|
//Animation load
|
||||||
REQUIRE(picture->load(TEST_DIR"/lottieslot.json") == Result::Success);
|
REQUIRE(picture->load(TEST_DIR"/lottieslot.json") == Result::Success);
|
||||||
|
|
||||||
|
//Slot generation
|
||||||
|
auto slotId = animation->genSlot(slotJson);
|
||||||
|
REQUIRE(slotId > 0);
|
||||||
|
|
||||||
//Slot revert before overriding
|
//Slot revert before overriding
|
||||||
REQUIRE(animation->override(nullptr) == Result::Success);
|
REQUIRE(animation->applySlot(0) == Result::Success);
|
||||||
|
|
||||||
//Slot override
|
//Slot override
|
||||||
REQUIRE(animation->override(slotJson) == Result::Success);
|
REQUIRE(animation->applySlot(slotId) == Result::Success);
|
||||||
|
|
||||||
//Slot revert
|
//Slot revert
|
||||||
REQUIRE(animation->override(nullptr) == Result::Success);
|
REQUIRE(animation->applySlot(0) == Result::Success);
|
||||||
|
|
||||||
//Slot override after reverting
|
//Slot override after reverting
|
||||||
REQUIRE(animation->override(slotJson) == Result::Success);
|
REQUIRE(animation->applySlot(slotId) == Result::Success);
|
||||||
|
|
||||||
//Slot override with invalid JSON
|
//Slot generation with invalid JSON
|
||||||
REQUIRE(animation->override("") == Result::InvalidArguments);
|
REQUIRE(animation->genSlot("") == 0);
|
||||||
|
|
||||||
|
//Slot deletion
|
||||||
|
REQUIRE(animation->delSlot(slotId) == Result::Success);
|
||||||
|
|
||||||
REQUIRE(Initializer::term() == Result::Success);
|
REQUIRE(Initializer::term() == Result::Success);
|
||||||
}
|
}
|
||||||
|
@ -84,14 +91,21 @@ TEST_CASE("Lottie Slot 2", "[tvgLottie]")
|
||||||
//Animation load
|
//Animation load
|
||||||
REQUIRE(picture->load(TEST_DIR"/lottieslotkeyframe.json") == Result::Success);
|
REQUIRE(picture->load(TEST_DIR"/lottieslotkeyframe.json") == Result::Success);
|
||||||
|
|
||||||
|
//Slot generation
|
||||||
|
auto slotId = animation->genSlot(slotJson);
|
||||||
|
REQUIRE(slotId > 0);
|
||||||
|
|
||||||
//Slot override
|
//Slot override
|
||||||
REQUIRE(animation->override(slotJson) == Result::Success);
|
REQUIRE(animation->applySlot(slotId) == Result::Success);
|
||||||
|
|
||||||
//Slot revert
|
//Slot revert
|
||||||
REQUIRE(animation->override(nullptr) == Result::Success);
|
REQUIRE(animation->applySlot(0) == Result::Success);
|
||||||
|
|
||||||
//Slot override after reverting
|
//Slot override after reverting
|
||||||
REQUIRE(animation->override(slotJson) == Result::Success);
|
REQUIRE(animation->applySlot(slotId) == Result::Success);
|
||||||
|
|
||||||
|
//Slot deletion
|
||||||
|
REQUIRE(animation->delSlot(slotId) == Result::Success);
|
||||||
|
|
||||||
REQUIRE(Initializer::term() == Result::Success);
|
REQUIRE(Initializer::term() == Result::Success);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue