فهرست منبع

Add test for objects with collide-able layers, but no actual intersects.

Sam Jaffe 6 سال پیش
والد
کامیت
4113269e83
1فایلهای تغییر یافته به همراه9 افزوده شده و 0 حذف شده
  1. 9 0
      engine/test/scene_test.cxx

+ 9 - 0
engine/test/scene_test.cxx

@@ -72,6 +72,15 @@ TEST_F(SceneTest, WillCollideOverlappingObjects) {
   scene().update(0.f);
 }
 
+TEST_F(SceneTest, NonOverlappingDontCollide) {
+  mock_collidable one{{{{0.f, 0.f}}, {{1.f, 1.f}}}};
+  mock_collidable two{{{{2.f, 2.f}}, {{1.f, 1.f}}}};
+  scene().add_with(1, one);
+  scene().add_as(1, two);
+  EXPECT_CALL(one, collide(Ref(two))).Times(0);
+  scene().update(0.f);
+}
+
 TEST_F(SceneTest, CollisionIsOneWay) {
   math::dim2::rectangle bnds{{{0.f, 0.f}}, {{1.f, 1.f}}};
   mock_collidable one{bnds}, two{bnds};