Beispiel #1
0
    def test_set_alpha(self):
        # prepare
        assert RSDL.SetAlpha(self.src_surf, RSDL.SRCALPHA, 128) == 0

        # draw
        RSDL_helper.blit_complete_surface(self.src_surf, self.dst_surf, 10, 10)
        RSDL_helper.blit_complete_surface(self.src_surf, self.dst_surf, 20, 20)

        # check
        for position, color in (
            ((0, 0), (0, 0, 0)),  # no rect
            ((10, 10), (127, 0, 0)),  # one rect
            ((20, 20), (191, 0, 0))  # two overlapping rects
        ):
            fetched_color = RSDL_helper.get_pixel(self.dst_surf, position[0],
                                                  position[1])
            assert RSDL_helper.get_rgb(fetched_color,
                                       self.dst_surf.c_format) == color
    def test_set_alpha(self):
        # prepare
        assert RSDL.SetAlpha(self.src_surf, RSDL.SRCALPHA, 128) == 0

        # draw
        RSDL_helper.blit_complete_surface(
            self.src_surf,
            self.dst_surf,
            10, 10)
        RSDL_helper.blit_complete_surface(
            self.src_surf,
            self.dst_surf,
            20, 20)

        # check
        for position, color in (
                (( 0, 0), (  0,0,0)), # no rect
                ((10,10), (127,0,0)), # one rect
                ((20,20), (191,0,0))  # two overlapping rects
            ):
            fetched_color = RSDL_helper.get_pixel(self.dst_surf, position[0], position[1])
            assert RSDL_helper.get_rgb(fetched_color, self.dst_surf.c_format) == color