diff --git a/test/capi/capiSavers.cpp b/test/capi/capiSavers.cpp index b4049d13..ad1ae6ef 100644 --- a/test/capi/capiSavers.cpp +++ b/test/capi/capiSavers.cpp @@ -101,4 +101,14 @@ TEST_CASE("Synchronize a Saver", "[capiSaver]") REQUIRE(tvg_saver_del(saver) == TVG_RESULT_SUCCESS); } +#endif + + +#ifdef THORVG_GIF_SAVER_SUPPORT + +TEST_CASE("Save a lottie into gif", "[capiSavers]") +{ + //TODO: GIF Save Test +} + #endif \ No newline at end of file diff --git a/test/images/tag.tvg b/test/images/tag.tvg index 6f916e82..5123f73c 100644 Binary files a/test/images/tag.tvg and b/test/images/tag.tvg differ diff --git a/test/images/test.tvg b/test/images/test.tvg index 7f46de36..62afd4b2 100644 Binary files a/test/images/test.tvg and b/test/images/test.tvg differ diff --git a/test/testSavers.cpp b/test/testSavers.cpp index 53a0ce30..d0698547 100644 --- a/test/testSavers.cpp +++ b/test/testSavers.cpp @@ -97,4 +97,46 @@ TEST_CASE("Save scene into tvg", "[tvgSavers]") free(data); } +#endif + + +#ifdef THORVG_GIF_SAVER_SUPPORT + +TEST_CASE("Save a lottie into gif", "[tvgSavers]") +{ + REQUIRE(Initializer::init(CanvasEngine::Sw, 0) == Result::Success); + + auto animation = Animation::gen(); + REQUIRE(animation); + + auto picture = animation->picture(); + REQUIRE(picture); + REQUIRE(picture->load(TEST_DIR"/test.json") == Result::Success); + REQUIRE(picture->size(100, 100) == Result::Success); + + auto saver = Saver::gen(); + REQUIRE(saver); + REQUIRE(saver->save(std::move(animation), TEST_DIR"/test.gif") == Result::Success); + REQUIRE(saver->sync() == Result::Success); + + //with a background + auto animation2 = Animation::gen(); + REQUIRE(animation2); + + auto picture2 = animation2->picture(); + REQUIRE(picture2); + REQUIRE(picture2->load(TEST_DIR"/test.json") == Result::Success); + REQUIRE(picture2->size(100, 100) == Result::Success); + + auto bg = Shape::gen(); + REQUIRE(bg->fill(255, 255, 255) == Result::Success); + REQUIRE(bg->appendRect(0, 0, 100, 100) == Result::Success); + + REQUIRE(saver->background(std::move(bg)) == Result::Success); + REQUIRE(saver->save(std::move(animation2), TEST_DIR"/test.gif") == Result::Success); + REQUIRE(saver->sync() == Result::Success); + + REQUIRE(Initializer::term(CanvasEngine::Sw) == Result::Success); +} + #endif \ No newline at end of file