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: * |
fail: AWT |
42 |
""" |
""" |
43 |
vs = getvs() |
for text_scale in range(1,5): |
44 |
size = vs.getSize() |
vs = getvs() |
45 |
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
size = vs.getSize() |
46 |
|
vs.map.put(gzz.vob.vobs.SolidBgVob(Color.red)) |
47 |
|
textvob = gzz.vob.vobs.TextVob(sty1, "XÄjÖgqÅypX") |
48 |
|
|
49 |
textvob = gzz.vob.vobs.TextVob(sty1, "XÄjÖgqÅypX") |
text_width = int(textvob.getWidth(text_scale)) |
50 |
text_scale = 1 |
text_height = int(textvob.getHeight(text_scale)) |
51 |
|
text_depth = int(textvob.getDepth(text_scale)) |
52 |
|
|
53 |
text_width = int(textvob.getWidth(text_scale)) |
cs = vs.orthoBoxCS(0, "window", 0, 100, 100, 1, 1, size.width, size.height) |
54 |
text_height = int(textvob.getHeight(text_scale)) |
cs_text = vs.orthoCS(cs, "text", 0, 0, 0, text_height + text_depth, text_height + text_depth) |
55 |
text_depth = int(textvob.getDepth(text_scale)) |
vs.map.put(textvob, cs_text) |
56 |
|
render(vs) |
57 |
|
|
58 |
cs = vs.orthoBoxCS(0, "window", 0, 100, 100, 1, 1, size.width, size.height) |
"""The top edge.""" |
59 |
cs_text = vs.orthoCS(cs, "text", 0, 0, 0, text_height + text_depth, text_height + text_depth) |
checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1) |
|
vs.map.put(textvob, cs_text) |
|
|
render(vs) |
|
60 |
|
|
61 |
"""The top edge.""" |
"""The left edge.""" |
62 |
checkNotAvgColor(100, 100, text_width, 10, (255, 0, 0), delta=1) |
checkNotAvgColor(100, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
63 |
|
|
64 |
"""The left edge.""" |
"""The right edge.""" |
65 |
checkNotAvgColor(100, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
checkNotAvgColor(100+text_width-10, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
66 |
|
|
67 |
"""The right edge.""" |
"""The bottom edge.""" |
68 |
checkNotAvgColor(100+text_width-10, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
checkNotAvgColor(100, 100+text_height-1, text_width, text_depth+1, (255, 0, 0), delta=1) |
69 |
|
|
70 |
"""The bottom edge.""" |
"""The top side.""" |
71 |
checkNotAvgColor(100, 100+text_height-1, text_width, text_depth+1, (255, 0, 0), delta=1) |
checkAvgColor(100, 100-10, text_width, 10, (255, 0, 0), delta=1) |
72 |
|
|
73 |
"""The top side.""" |
"""The left side.""" |
74 |
checkAvgColor(100, 100-10, text_width, 10, (255, 0, 0), delta=1) |
checkAvgColor(100-10, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
75 |
|
|
76 |
"""The left side.""" |
"""The right side.""" |
77 |
checkAvgColor(100-10, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
checkAvgColor(100+text_width+1, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
78 |
|
|
79 |
"""The right side.""" |
"""The bottom side.""" |
80 |
checkAvgColor(100+text_width+1, 100, 10, text_height+text_depth, (255, 0, 0), delta=1) |
checkAvgColor(100, 100+text_height+text_depth+1, text_width, 10, (255, 0, 0), delta=1) |
|
|
|
|
"""The bottom side.""" |
|
|
checkAvgColor(100, 100+text_height+text_depth+1, text_width, 10, (255, 0, 0), delta=1) |
|
81 |
|
|
82 |
# : vim: set syntax=python : |
# : vim: set syntax=python : |