From 607c00bc57fb68572754404cb5da0e7f7a5618e5 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Sat, 30 Mar 2024 12:07:49 +0200 Subject: refactor enemies to add bounchers --- tests/test_enemies.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/test_enemies.py b/tests/test_enemies.py index 315de88..ed114ae 100644 --- a/tests/test_enemies.py +++ b/tests/test_enemies.py @@ -1,19 +1,28 @@ import os import unittest +import pygame from pathlib import Path -from enemies.enemies import EnemySprite, Enemies +from enemies.enemies import EnemyBall, Enemies +from display import Scaling from text import Fonts -class TestEnemySprite(unittest.TestCase): +class TestEnemyBall(unittest.TestCase): + def setUp(self): + Fonts.load_fonts(os.path.join( + Path(__file__).parent.parent.resolve(), + "src", + "sliceitoff")) + def test_can_create(self): - enemy = EnemySprite() + enemy = EnemyBall() self.assertNotEqual(None, enemy) class TestEnemies(unittest.TestCase): def setUp(self): + Scaling.update_scaling((640,400)) Fonts.load_fonts(os.path.join( Path(__file__).parent.parent.resolve(), "src", @@ -30,4 +39,9 @@ class TestEnemies(unittest.TestCase): def test_update_notcrashing(self): enemies = Enemies(count = 6) for _ in range(10000): - enemies.update(dt=100) + enemies.update( + dt=100, + field_rects=[ + Scaling.active, + pygame.Rect(800,0,200,200) + ]) -- cgit v1.2.3