38 |
"""Tests that TextVob is drawn with the width and height |
"""Tests that TextVob is drawn with the width and height |
39 |
that it claims with getWidth() and getHeight(). |
that it claims with getWidth() and getHeight(). |
40 |
|
|
41 |
fail: AWT |
fail: GL |
42 |
""" |
""" |
43 |
vs = getvs() |
vs = getvs() |
44 |
size = vs.getSize() |
size = vs.getSize() |
45 |
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
46 |
|
|
47 |
textvob = gzz.vob.vobs.TextVob(sty1, "XÅÅÅÅÅX") |
text_size = 50; |
48 |
text_size = 50 |
textvob = gzz.vob.vobs.TextVob(sty1, "XÄjÖgqÅypX") |
49 |
text_scale = sty1.getScaleByHeight(text_size) |
text_scale = sty1.getScaleByHeight(text_size) |
50 |
text_width = int(textvob.getWidth(text_scale)) |
text_width = int(textvob.getWidth(text_scale)) |
51 |
text_height = int(textvob.getHeight(text_scale)) |
text_height = int(textvob.getHeight(text_scale)) |
52 |
|
text_depth = int(textvob.getDepth(text_scale)) |
53 |
|
|
54 |
cs = vs.orthoBoxCS(0, "window", 0, 100, 100, 1, 1, size.width, size.height) |
cs = vs.orthoBoxCS(0, "window", 0, 100, 100, 1, 1, size.width, size.height) |
55 |
cs_text = vs.orthoCS(cs, "text", 0, 0, 0, text_size, text_size) |
cs_text = vs.orthoCS(cs, "text", 0, 0, 0, text_height + text_depth, text_height + text_depth) |
56 |
vs.map.put(textvob, cs_text) |
vs.map.put(textvob, cs_text) |
57 |
render(vs) |
render(vs) |
58 |
|
|
59 |
"""The top edge.""" |
"""The top edge.""" |
60 |
checkNotAvgColor(100, 100, text_width, 5, (255, 0, 0), delta=1) |
checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1) |
61 |
|
|
62 |
"""The left edge.""" |
"""The left edge.""" |
63 |
checkNotAvgColor(100, 100, 5, text_height, (255, 0, 0), delta=1) |
checkNotAvgColor(100, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
64 |
|
|
65 |
"""The right edge.""" |
"""The right edge.""" |
66 |
checkNotAvgColor(100+text_width-5, 100, 5, text_height, (255, 0, 0), delta=1) |
checkNotAvgColor(100+text_width-10, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
67 |
|
|
68 |
"""The bottom edge.""" |
"""The bottom edge.""" |
69 |
checkNotAvgColor(100, 100+text_height-5, text_width, 5, (255, 0, 0), delta=1) |
checkNotAvgColor(100, 100+text_height-1, text_width, text_depth+1, (255, 0, 0), delta=1) |
70 |
|
|
71 |
"""The top side.""" |
"""The top side.""" |
72 |
checkAvgColor(100, 100-6, text_width, 5, (255, 0, 0), delta=1) |
checkAvgColor(100, 100-10, text_width, 10, (255, 0, 0), delta=1) |
73 |
|
|
74 |
"""The left side.""" |
"""The left side.""" |
75 |
checkAvgColor(100-6, 100, 5, text_height, (255, 0, 0), delta=1) |
checkAvgColor(100-10, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
76 |
|
|
77 |
"""The right side.""" |
"""The right side.""" |
78 |
checkAvgColor(100+text_width+1, 100, 5, text_height, (255, 0, 0), delta=1) |
checkAvgColor(100+text_width+1, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
79 |
|
|
80 |
"""The bottom side.""" |
"""The bottom side.""" |
81 |
checkAvgColor(100, 100+text_height+1, text_width, 5, (255, 0, 0), delta=1) |
checkAvgColor(100, 100+text_height+text_depth+1, text_width, 10, (255, 0, 0), delta=1) |
82 |
|
|
83 |
# : vim: set syntax=python : |
# : vim: set syntax=python : |