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"
10 TEST_CASE("transform constraint updates world transform", "[file]") {
11 auto file = ReadRiveFile("../../test/assets/transform_constraint.riv");
13 auto artboard = file->artboard();
15 REQUIRE(artboard->find<rive::TransformComponent>("Target") != nullptr);
16 auto target = artboard->find<rive::TransformComponent>("Target");
18 REQUIRE(artboard->find<rive::TransformComponent>("Rectangle") != nullptr);
19 auto rectangle = artboard->find<rive::TransformComponent>("Rectangle");
21 artboard->advance(0.0f);
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()));