Beispiel #1
0
 def test_checkCollisions_emptyCollisionsListWhenOtherEntityXPosEqualsSpriteSize(self):
     entityToTest, otherEntity = Entity(), Entity()
     otherEntity.x += SPRITE_SIZE
     entities.append(otherEntity)
     entityToTest.check_collisions()
     self.assertFalse(collisions)
Beispiel #2
0
 def test_checkCollisions_entityDoesNotCollideWithSelf(self):
     entityToTest = Entity()
     entities.append(entityToTest)
     entityToTest.check_collisions()
     self.assertFalse(collisions)
Beispiel #3
0
 def test_checkCollisions_oneCollisionDetectedWhenOtherEntityXPosLessThanSpriteSize(self):
     entityToTest, otherEntity = Entity(), Entity()
     otherEntity.x += SPRITE_SIZE-1
     entities.append(otherEntity)
     entityToTest.check_collisions()
     self.assertListEqual(collisions, [(entityToTest, otherEntity)])
Beispiel #4
0
 def test_checkCollisions_collisionsListContainsCollidedEntities(self):
     entityToTest = Entity()
     entityCollidedWith = Entity()
     entities.append(entityCollidedWith)
     entityToTest.check_collisions()
     self.assertListEqual(collisions, [(entityToTest, entityCollidedWith)])