From 9e60c8dd2a3c8d27d02d1e7a019c55f23c6831c6 Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Fri, 29 Mar 2024 00:55:14 +0200 Subject: textpage tests --- tests/test_text.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/test_text.py (limited to 'tests/test_text.py') diff --git a/tests/test_text.py b/tests/test_text.py new file mode 100644 index 0000000..c4f51fd --- /dev/null +++ b/tests/test_text.py @@ -0,0 +1,29 @@ +import os +import unittest + +from pathlib import Path + +from text import Fonts, TextPage + +class TestText(unittest.TestCase): + def setUp(self): + Fonts.load_fonts(os.path.join( + Path(__file__).parent.parent.resolve(), + "src", + "sliceitoff")) + + def test_can_create(self): + textpage = TextPage("") + self.assertNotEqual(None, textpage) + + def test_right_amount_of_letters(self): + textpage = TextPage("MOII") + textpage.update() + self.assertEqual(4, len(textpage.sprites())) + + def test_exploding_not_chashing(self): + textpage = TextPage("MOII\n\thei\xeeOK", grid = (1_000, 1_000)) + for _ in range(1000): + textpage.update(dt = 333, explode = True) + + \ No newline at end of file -- cgit v1.2.3