Esempio n. 1
0
    def test_zero_mask_overlap_mask(self):
        sizes = ((100, 0), (0, 100), (0, 0))

        for size in sizes:
            mask = pygame.mask.Mask(size)
            mask2 = pygame.mask.Mask((100, 100))

            overlap_mask = mask.overlap_mask(mask2, (0, 0))
            overlap_mask2 = mask2.overlap_mask(mask, (0, 0))

            self.assertEqual(mask.get_size(), overlap_mask.get_size())
            self.assertEqual(mask2.get_size(), overlap_mask2.get_size())
Esempio n. 2
0
    def test_overlap_mask(self):
        # This test currently fails. See issue #410 for more details.
        mask = pygame.mask.Mask((50, 50))
        mask.fill()
        mask2 = pygame.mask.Mask((300, 10))
        mask2.fill()
        mask3 = mask.overlap_mask(mask2, (-1, 0))

        for i in range(50):
            for j in range(10):
                self.assertEqual(mask3.get_at((i, j)), 1)

        for i in range(50):
            for j in range(11, 50):
                self.assertEqual(mask3.get_at((i, j)), 0)
Esempio n. 3
0
    def test_overlap_mask(self):
        """Ensure overlap_mask's mask has correct bits set."""
        mask = pygame.mask.Mask((50, 50), fill=True)
        mask2 = pygame.mask.Mask((300, 10), fill=True)
        mask3 = mask.overlap_mask(mask2, (-1, 0))

        for i in range(50):
            for j in range(10):
                self.assertEqual(mask3.get_at((i, j)), 1,
                                 '({}, {})'.format(i, j))

        for i in range(50):
            for j in range(11, 50):
                self.assertEqual(mask3.get_at((i, j)), 0,
                                 '({}, {})'.format(i, j))
Esempio n. 4
0
    def test_overlap_mask(self):
        """ |tags: ignore| """

        mask = pygame.mask.Mask((50, 50))
        mask.fill()
        mask2 = pygame.mask.Mask((300, 10))
        mask2.fill()
        mask3 = mask.overlap_mask(mask2, (-1, 0))

        for i in range(50):
            for j in range(10):
                self.assertEqual(mask3.get_at((i, j)), 1)

        for i in range(50):
            for j in range(11, 50):
                self.assertEqual(mask3.get_at((i, j)), 0)