Exemple #1
0
 def test_set_sprite_to_monitor_no_current_health(self, _init_pygame, default_ui_manager):
     healthy_sprite = HealthySpriteNoCurrentHealth()
     health_bar = UIScreenSpaceHealthBar(relative_rect=pygame.Rect(100, 100, 150, 30),
                                         sprite_to_monitor=None,
                                         manager=default_ui_manager)
     with pytest.raises(AttributeError, match="Sprite does not have current_health attribute"):
         health_bar.set_sprite_to_monitor(healthy_sprite)
Exemple #2
0
    def test_set_sprite_to_monitor(self, _init_pygame, default_ui_manager):
        healthy_sprite = HealthySprite()
        health_bar = UIScreenSpaceHealthBar(relative_rect=pygame.Rect(100, 100, 150, 30),
                                            sprite_to_monitor=None,
                                            manager=default_ui_manager)

        health_bar.set_sprite_to_monitor(healthy_sprite)