Update rive-cpp to 2.0 version
[platform/core/uifw/rive-tizen.git] / submodule / rive-cpp / test / transform_constraint_test.cpp
1 #include <rive/file.hpp>
2 #include <rive/node.hpp>
3 #include <rive/bones/bone.hpp>
4 #include <rive/shapes/shape.hpp>
5 #include "no_op_renderer.hpp"
6 #include "rive_file_reader.hpp"
7 #include "rive_testing.hpp"
8 #include <cstdio>
9
10 TEST_CASE("transform constraint updates world transform", "[file]") {
11     auto file = ReadRiveFile("../../test/assets/transform_constraint.riv");
12
13     auto artboard = file->artboard();
14
15     REQUIRE(artboard->find<rive::TransformComponent>("Target") != nullptr);
16     auto target = artboard->find<rive::TransformComponent>("Target");
17
18     REQUIRE(artboard->find<rive::TransformComponent>("Rectangle") != nullptr);
19     auto rectangle = artboard->find<rive::TransformComponent>("Rectangle");
20
21     artboard->advance(0.0f);
22
23     // Expect the transform constraint to have placed the shape in the same
24     // exact world transform as the target.
25     REQUIRE(aboutEqual(target->worldTransform(), rectangle->worldTransform()));
26 }