diff options
author | Viljami Ilola <+@hix.fi> | 2024-04-10 17:00:23 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-04-10 17:00:23 +0300 |
commit | 43e1a7425e525a1da0c805db16a2c54b56fc1580 (patch) | |
tree | c2b99aadc7ce06290b432ec5c634334199bfce27 | |
parent | aab1bd74450e7c074417e25919c1cd8e71c31d82 (diff) |
tests for statusline
-rw-r--r-- | src/sliceitoff/mainmenu/__init__.py | 2 | ||||
-rw-r--r-- | src/sliceitoff/status/status.py | 1 | ||||
-rw-r--r-- | tests/test_status.py | 23 |
3 files changed, 24 insertions, 2 deletions
diff --git a/src/sliceitoff/mainmenu/__init__.py b/src/sliceitoff/mainmenu/__init__.py deleted file mode 100644 index 9259d1f..0000000 --- a/src/sliceitoff/mainmenu/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -""" mainmenu - Menu where user can new game, quit etc """ -from .mainmenu import Mainmenu, MenuItems diff --git a/src/sliceitoff/status/status.py b/src/sliceitoff/status/status.py index f018778..7efc8a8 100644 --- a/src/sliceitoff/status/status.py +++ b/src/sliceitoff/status/status.py @@ -30,3 +30,4 @@ class Status(pygame.sprite.Group): pos = (2_000, 220_000), size = (12_000, 0), font = 'lcd') ) + self.old_srt = score_str diff --git a/tests/test_status.py b/tests/test_status.py new file mode 100644 index 0000000..a365ea6 --- /dev/null +++ b/tests/test_status.py @@ -0,0 +1,23 @@ +import unittest +import pygame + +from pathlib import Path + +from sliceitoff.stats import Stats +from sliceitoff.status import Status + +class TestStatus(unittest.TestCase): + def setUp(self): + self.stats = Stats() + self.status = Status( stats = self.stats) + + def test_can_create(self): + self.assertNotEqual(None, self.status) + + def test_updating_without_crash(self): + for _ in range(100): + self.status.update(dt=100) + for _ in range(100): + self.stats.add_score(100) + self.stats.percent -= 1 + self.status.update(dt=100) |