blob: c77faea2ad1dccdacac696c5631342408ae40615 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
import os
import unittest
import pygame
from pathlib import Path
from sliceitoff.enemies.enemies import EnemyBall, Enemies
from sliceitoff.display import Scaling
from sliceitoff.text import Fonts
class TestEnemyBall(unittest.TestCase):
def setUp(self):
Fonts.load_fonts( Path(__file__).parent.parent.resolve()
.joinpath('src').joinpath('sliceitoff').joinpath('assets'))
def test_can_create(self):
enemy = EnemyBall()
self.assertNotEqual(None, enemy)
class TestEnemies(unittest.TestCase):
def setUp(self):
Scaling.update_scaling((640,400))
Fonts.load_fonts( Path(__file__).parent.parent.resolve()
.joinpath('src').joinpath('sliceitoff').joinpath('assets'))
def test_can_create(self):
enemies = Enemies()
self.assertNotEqual(None, enemies)
def test_right_amount_of_enemies(self):
for _ in range(10):
enemies = Enemies(count = 6)
self.assertTrue( len(enemies.sprites()) in range(3,7) )
def test_update_notcrashing(self):
enemies = Enemies(count = 6)
for _ in range(10000):
enemies.update(
dt=100,
field_rects=[
Scaling.active,
pygame.Rect(800,0,200,200)
])
|