mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
tests: bounds test ++
The 'transformed' arg of the 'bounds' api wasn't tested. Added.
This commit is contained in:
parent
0aba8322c7
commit
c5a02b90df
1 changed files with 13 additions and 0 deletions
|
@ -126,21 +126,34 @@ TEST_CASE("Bounding Box", "[tvgPaint]")
|
|||
|
||||
//Case 1
|
||||
REQUIRE(shape->appendRect(0.0f, 10.0f, 20.0f, 100.0f, 50.0f, 50.0f) == Result::Success);
|
||||
REQUIRE(shape->translate(100.0f, 111.0f) == Result::Success);
|
||||
REQUIRE(shape->bounds(&x, &y, &w, &h, false) == Result::Success);
|
||||
REQUIRE(x == 0.0f);
|
||||
REQUIRE(y == 10.0f);
|
||||
REQUIRE(w == 20.0f);
|
||||
REQUIRE(h == 100.0f);
|
||||
REQUIRE(shape->bounds(&x, &y, &w, &h, true) == Result::Success);
|
||||
REQUIRE(x == 100.0f);
|
||||
REQUIRE(y == 121.0f);
|
||||
REQUIRE(w == 20.0f);
|
||||
REQUIRE(h == 100.0f);
|
||||
|
||||
//Case 2
|
||||
REQUIRE(shape->reset() == Result::Success);
|
||||
REQUIRE(shape->moveTo(0.0f, 10.0f) == Result::Success);
|
||||
REQUIRE(shape->lineTo(20.0f, 210.0f) == Result::Success);
|
||||
auto identity = Matrix{1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f};
|
||||
REQUIRE(shape->transform(identity) == Result::Success);
|
||||
REQUIRE(shape->bounds(&x, &y, &w, &h, false) == Result::Success);
|
||||
REQUIRE(x == 0.0f);
|
||||
REQUIRE(y == 10.0f);
|
||||
REQUIRE(w == 20.0f);
|
||||
REQUIRE(h == 200.0f);
|
||||
REQUIRE(shape->bounds(&x, &y, &w, &h, true) == Result::Success);
|
||||
REQUIRE(x == 0.0f);
|
||||
REQUIRE(y == 10.0f);
|
||||
REQUIRE(w == 20.0f);
|
||||
REQUIRE(h == 200.0f);
|
||||
}
|
||||
|
||||
TEST_CASE("Duplication", "[tvgPaint]")
|
||||
|
|
Loading…
Add table
Reference in a new issue