test_particle.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:sappho 作者: lily-mayfield 项目源码 文件源码
def test_artist_draw_origin(self):
        block = pygame.surface.Surface((2, 2))
        block.fill((255, 0, 0), pygame.Rect(0, 0, 2, 2))

        ps = particle.ParticleSystem(
            particle.Particle(0, 1, 1, 0, 3, 'pixel'),
            particle.EmitterBurst.single(1),
            artist=particle.ArtistSimple(block, (0, 0)),
        )
        world = pygame.surface.Surface((4, 4))
        world.fill((0, 255, 0), pygame.Rect(0, 0, 4, 4))

        desired_world = pygame.surface.Surface((4, 4))
        desired_world.fill((0, 255, 0), pygame.Rect(0, 0, 4, 4))
        for x in (1, 2):
            for y in (1, 2):
                desired_world.set_at((x, y), (255, 0, 0))

        ps.update_state(1)
        ps.draw_on(world)
        assert(compare_surfaces(desired_world, world))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号