summaryrefslogtreecommitdiff
path: root/tests/test_text.py
blob: c4f51fda7c3794f80d49b02d28a9a76ac1d55eeb (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
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)