Exemple #1
0
    def test___init____added_to_groups_passed(self):
        self.sprite = self.Sprite(self.groups)

        self.assert_(unordered_equality(
            self.sprite.groups(),
            self.groups
        ))
Exemple #2
0
    def test_add(self):
        self.sprite.add(self.groups)

        self.assert_(unordered_equality(
            self.sprite.groups(),
            self.groups
        ))
Exemple #3
0
    def test_add(self):
        self.sprite.add(self.groups)

        self.assert_(unordered_equality(
            self.sprite.groups(),
            self.groups
        ))
Exemple #4
0
    def test___init____added_to_groups_passed(self):
        self.sprite = self.Sprite(self.groups)

        self.assert_(unordered_equality(
            self.sprite.groups(),
            self.groups
        ))
Exemple #5
0
    def test_groups(self):
        for i, g in enumerate(self.groups):
            self.sprite.add(g)

            groups = self.sprite.groups()
            self.assert_(unordered_equality(
                groups,
                self.groups[:i + 1],
            ))
Exemple #6
0
 def test_collide_rect_ratio__collides_all_at_ratio_of_twenty(self):
     # collide_rect_ratio should collide all at a 20.0 ratio.
     self.assert_(
         unordered_equality(
             sprite.spritecollide(self.s1,
                                  self.ag2,
                                  dokill=False,
                                  collided=sprite.collide_rect_ratio(20.0)),
             [self.s2, self.s3]))
Exemple #7
0
    def test_groups(self):
        for i, g in enumerate(self.groups):
            self.sprite.add(g)

            groups = self.sprite.groups()
            self.assert_( unordered_equality (
                    groups,
                    self.groups[:i+1],
            ))
Exemple #8
0
 def test_collide_circle_ratio__no_radius_and_ratio_of_twenty(self):
     # collide_circle_ratio with no radius set, at a 20.0 ratio.
     self.assert_(
         unordered_equality(
             sprite.spritecollide(
                 self.s1,
                 self.ag2,
                 dokill=False,
                 collided=sprite.collide_circle_ratio(20.0)),
             [self.s2, self.s3]))
Exemple #9
0
 def test_collide_rect_ratio__collides_all_at_ratio_of_twenty(self):
     # collide_rect_ratio should collide all at a 20.0 ratio.
     self.assert_ (
         unordered_equality (
             sprite.spritecollide (
                 self.s1, self.ag2, dokill = False,
                 collided = sprite.collide_rect_ratio(20.0)
             ),
             [self.s2, self.s3]
         )
     )
Exemple #10
0
 def test_collide_circle_ratio__no_radius_and_ratio_of_twenty(self):
     # collide_circle_ratio with no radius set, at a 20.0 ratio.
     self.assert_ (
         unordered_equality (
             sprite.spritecollide (
                 self.s1, self.ag2, dokill = False,
                 collided = sprite.collide_circle_ratio(20.0)
             ),
             [self.s2, self.s3]
         )
     )
Exemple #11
0
    def test_collide_circle_ratio__with_radii_set(self):
        self.s1.radius = 50
        self.s2.radius = 10
        self.s3.radius = 400

        # collide_circle_ratio with a radius set.
        self.assert_(
            unordered_equality(
                sprite.spritecollide(
                    self.s1,
                    self.ag2,
                    dokill=False,
                    collided=sprite.collide_circle_ratio(0.5)),
                [self.s2, self.s3]))
Exemple #12
0
    def test_collide_circle_ratio__with_radii_set(self):
        self.s1.radius = 50
        self.s2.radius = 10
        self.s3.radius = 400

        # collide_circle_ratio with a radius set.
        self.assert_ (
            unordered_equality (
                sprite.spritecollide (
                    self.s1, self.ag2, dokill = False,
                    collided = sprite.collide_circle_ratio(0.5)
                ),
                [self.s2, self.s3]
            )
        )