mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
test: coverage enhancement
+ Accessor::id() + Picture::paint()
This commit is contained in:
parent
92303e91b4
commit
19b21852e3
3 changed files with 10041 additions and 3 deletions
File diff suppressed because one or more lines are too long
|
@ -58,19 +58,27 @@ TEST_CASE("Set", "[tvgAccessor]")
|
|||
REQUIRE(accessor->set(picture.get(), nullptr, nullptr) == Result::InvalidArguments);
|
||||
|
||||
//Case 2
|
||||
Shape* ret = nullptr;
|
||||
|
||||
auto f = [](const tvg::Paint* paint, void* data) -> bool
|
||||
{
|
||||
if (paint->type() == Type::Shape) {
|
||||
auto shape = (tvg::Shape*) paint;
|
||||
uint8_t r, g, b;
|
||||
shape->fillColor(&r, &g, &b);
|
||||
if (r == 37 && g == 47 && b == 53)
|
||||
if (r == 37 && g == 47 && b == 53) {
|
||||
shape->fill(0, 0, 255);
|
||||
shape->id = Accessor::id("TestAccessor");
|
||||
*static_cast<Shape**>(data) = shape;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
REQUIRE(accessor->set(picture.get(), f, nullptr) == Result::Success);
|
||||
REQUIRE(accessor->set(picture.get(), f, &ret) == Result::Success);
|
||||
|
||||
REQUIRE((ret && ret->id == Accessor::id("TestAccessor")));
|
||||
|
||||
REQUIRE(Initializer::term() == Result::Success);
|
||||
}
|
||||
|
|
|
@ -115,6 +115,13 @@ TEST_CASE("Animation Lottie2", "[tvgAnimation]")
|
|||
|
||||
REQUIRE(picture->load(TEST_DIR"/test2.json") == Result::Success);
|
||||
|
||||
//Find specific paint nodes
|
||||
REQUIRE(!picture->paint(Accessor::id("test1")));
|
||||
REQUIRE(!picture->paint(Accessor::id("abcd")));
|
||||
REQUIRE(!picture->paint(Accessor::id("abcd")));
|
||||
REQUIRE(picture->paint(Accessor::id("bar")));
|
||||
REQUIRE(picture->paint(Accessor::id("pad1")));
|
||||
|
||||
REQUIRE(animation->frame(20.0f) == Result::Success);
|
||||
|
||||
REQUIRE(Initializer::term() == Result::Success);
|
||||
|
|
Loading…
Add table
Reference in a new issue