Add locking mechanism to prevent updating transform/parent

This commit is contained in:
Godzil
2020-03-10 13:55:27 +00:00
parent 5da0c10182
commit 441d758845
9 changed files with 95 additions and 7 deletions

View File

@@ -198,6 +198,28 @@ TEST(ShapeTest, Test_the_bouding_box_of_the_translated_shape)
BoundingBox res = t.getBounds();
ASSERT_EQ(res.min, b.min);
ASSERT_EQ(res.max, b.max);
}
TEST(ShapeTest, A_lock_shape_can_t_have_transformation_changed)
{
TestShape t = TestShape();
t.setTransform(translation(10, 0, 0));
BoundingBox b = BoundingBox(Point(9, -1, -1), Point(11, 1, 1));
BoundingBox res = t.getBounds();
ASSERT_EQ(res.min, b.min);
ASSERT_EQ(res.max, b.max);
t.lock();
t.setTransform(translation(-10, -10,-10));
res = t.getBounds();
ASSERT_EQ(res.min, b.min);
ASSERT_EQ(res.max, b.max);
}