42 |
in the same way. |
in the same way. |
43 |
""" |
""" |
44 |
|
|
45 |
|
def testUnicode(): |
46 |
|
"""Test that some unicode chars are drawn correctly.""" |
47 |
|
text_scale = 1.5 |
48 |
|
vs = getvs() |
49 |
|
size = vs.getSize() |
50 |
|
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
51 |
|
textvob = gzz.vob.vobs.TextVob(sty1, "ÅÄÖÅÄÖ") |
52 |
|
|
53 |
|
text_width = int(textvob.getWidth(text_scale)) |
54 |
|
text_height = int(textvob.getHeight(text_scale)) |
55 |
|
text_depth = int(textvob.getDepth(text_scale)) |
56 |
|
|
57 |
|
cs = vs.orthoBoxCS(0, "window", 0, 100, 100, 1, 1, size.width, size.height) |
58 |
|
cs_text = vs.orthoCS(cs, "text", 0, 0, 0, text_height + text_depth, text_height + text_depth) |
59 |
|
vs.map.put(textvob, cs_text) |
60 |
|
render(vs) |
61 |
|
|
62 |
|
"""The top edge.""" |
63 |
|
checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1) |
64 |
|
|
65 |
def testWH(): |
def testWH(): |
66 |
"""Tests that TextVob is drawn with the width and height |
"""Tests that TextVob is drawn with the width and height |
67 |
that it claims with getWidth() and getHeight(). |
that it claims with getWidth() and getHeight(). |
68 |
""" |
""" |
|
|
|
69 |
text_scale = 0 |
text_scale = 0 |
70 |
for scale in range(1, 3): |
for scale in range(1, 3): |
71 |
text_scale += scale |
text_scale += scale |
72 |
vs = getvs() |
vs = getvs() |
73 |
size = vs.getSize() |
size = vs.getSize() |
74 |
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
75 |
textvob = gzz.vob.vobs.TextVob(sty1, "XÄjÖgqÅypX") |
textvob = gzz.vob.vobs.TextVob(sty1, "XjXjXjX") |
76 |
|
|
77 |
text_width = int(textvob.getWidth(text_scale)) |
text_width = int(textvob.getWidth(text_scale)) |
78 |
text_height = int(textvob.getHeight(text_scale)) |
text_height = int(textvob.getHeight(text_scale)) |
83 |
vs.map.put(textvob, cs_text) |
vs.map.put(textvob, cs_text) |
84 |
render(vs) |
render(vs) |
85 |
|
|
86 |
"""The top edge.""" |
# We can't test the top edge, because we don't know the height of 'X' letter. |
87 |
checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1) |
# """The top edge.""" |
88 |
|
# checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1) |
89 |
|
|
90 |
"""The left edge.""" |
"""The left edge.""" |
91 |
checkNotAvgColor(100, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
checkNotAvgColor(100, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |