Debian Codegraph @

wxgeometrie/geolib/tests/test_textes.py

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 # -*- coding: utf-8 -*-
2 import os, sys
3 TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__),"../.."))
4 sys.path.insert(0, TOPDIR)
5
•6 import tools.unittests
7
8 from random import randint, random
9 from wxgeometrie.geolib import Texte
10
11 def rand():
12 return randint(0,50) - randint(0,50) + random()
13
•14 class GeolibTest(tools.unittests.TestCase):
15 def test_Texte(self):
16 t = Texte("spam & eggs", rand(), rand())
17 self.assertEqual(t.texte, "spam & eggs")
18
19 def test_style_temporaire(self):
20 # Le pseudo-style `nouveau_texte` est utilisé pour indiquer qu'un texte
21 # vient d'être créé. Ceci permet que, lorsque l'utilisateur clique
22 # quelque part pour créer un texte, puis appuie sur [ESC], le texte
23 # soit aussitôt supprimé, au lieu de créer un texte vide.
24 t = Texte("blabla", nouveau_texte=True)
25 del t._style['nouveau_texte']