Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Updated test code for the lottie slot #2030

Merged
merged 1 commit into from
Mar 6, 2024

Conversation

tinyjin
Copy link
Member

@tinyjin tinyjin commented Mar 6, 2024

This patch adds the test case for the recently introduced lottie slot API

Issue: #2029

@tinyjin tinyjin added test Unit tests lottie Lottie animation labels Mar 6, 2024
@tinyjin tinyjin self-assigned this Mar 6, 2024
test/capi/capiLottie.cpp Outdated Show resolved Hide resolved

auto picture = animation->picture();
REQUIRE(picture->identifier == Picture::identifier);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, you might wanna add a negative test at this point,
override() before load()

Tvg_Identifier id = TVG_IDENTIFIER_UNDEF;
REQUIRE(tvg_paint_get_identifier(picture, &id) == TVG_RESULT_SUCCESS);
REQUIRE(id == TVG_IDENTIFIER_PICTURE);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, you might wanna add a negative test at this point,
override() before load()

REQUIRE(id == TVG_IDENTIFIER_PICTURE);

REQUIRE(tvg_picture_load(picture, TEST_DIR"/lottieslot.json") == TVG_RESULT_SUCCESS);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, maybe a call override() here with an invalid slot data.

@tinyjin tinyjin force-pushed the jinny/slot-test-code branch 2 times, most recently from c33e9ab to 49cd9af Compare March 6, 2024 06:42
@tinyjin tinyjin requested a review from hermet March 6, 2024 06:52
REQUIRE(animation->override(slotJson) == Result::Success);

//Slot override with invalid JSON
REQUIRE(animation->override("") == Result::InsufficientCondition);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be InvalidArgument?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-03-06 at 3 57 43 PM

For now, returns InsufficientCondition in invalid JSON, should we change the result?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we can change it if you think it makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, #2033

This patch adds the test case for the recently introduced lottie slot API.

@Issues: thorvg#2029
@hermet hermet merged commit 5695f84 into thorvg:main Mar 6, 2024
14 checks passed
@tinyjin tinyjin deleted the jinny/slot-test-code branch March 10, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lottie Lottie animation test Unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants