import os import unittest from pathlib import Path from sliceitoff.text import fonts, TextPage class TestText(unittest.TestCase): def setUp(self): fonts.init( Path(__file__).parent.parent.resolve() .joinpath('src').joinpath('sliceitoff').joinpath('assets')) 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)