14 |
id = "01ACE8A2E202A26072012715A94A270CD012F9B0F2" |
id = "01ACE8A2E202A26072012715A94A270CD012F9B0F2" |
15 |
|
|
16 |
sc = gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(id)) |
sc = gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(id)) |
17 |
|
size = sc.getCurrent().getSize() |
18 |
|
|
19 |
enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker() |
enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker() |
20 |
|
|
21 |
|
|
22 |
|
def excinfo(): |
23 |
|
global exc |
24 |
|
typ, val, tra = sys.exc_info() |
25 |
|
print (repr((typ, val))) |
26 |
|
print str(val) |
27 |
|
exc = "\n".join(traceback.format_list(traceback.extract_tb(tra))) |
28 |
|
|
29 |
|
def checkColors(x, y): |
30 |
|
try: |
31 |
|
# Check that the green rectangle is there |
32 |
|
checkAvgColor(x+30,y+40,20,20, (0, 255, 0), delta=60) |
33 |
|
# Check that the red rectangle is there |
34 |
|
checkAvgColor(x+65,y+40,20,20, (255, 0, 0), delta=60) |
35 |
|
# Check that the black rectangle is there |
36 |
|
checkAvgColor(x+30, y+80, 60, 2, (0, 0, 0)) |
37 |
|
|
38 |
|
# Check that the blue rectangle is there on the second page |
39 |
|
checkAvgColor(x+150, y+40, 40, 40, (0, 0, 255), delta=60) |
40 |
|
|
41 |
|
# Check that the border is yellow |
42 |
|
checkAvgColor(x-2, y-2, 1, 160, (255, 255, 0)) |
43 |
|
checkAvgColor(x-2, y-2, 250, 1, (255, 255, 0)) |
44 |
|
checkAvgColor(x+260, y-2, 1, 160, (255, 255, 0)) |
45 |
|
checkAvgColor(x-2, y+170, 250, 1, (255, 255, 0)) |
46 |
|
except: |
47 |
|
excinfo() |
48 |
|
return 0 |
49 |
|
return 1 |
50 |
|
|
51 |
|
|
52 |
def testTestSpan(): |
def testTestSpan(): |
53 |
"""Test that we really have the pagespan images. |
"""Test that we really have the pagespan images. |
54 |
|
|
55 |
If not, all other tests in this file will fail too. |
If not, all other tests in this file will fail too. |
56 |
""" |
""" |
57 |
failUnlessEqual(sc.getCurrent().length(), 2) |
failUnlessEqual(sc.getCurrent().length(), 2) |
58 |
|
s = sc.getCurrent().getSize() |
59 |
|
failUnlessEqual(s.width, 612) |
60 |
|
failUnlessEqual(s.height, 792) |
61 |
|
|
62 |
def testSimply(): |
def testSimply(): |
63 |
"""Test that the view renders something |
"""Test that the view renders something |
64 |
|
|
|
fail: * |
|
65 |
""" |
""" |
|
vs = getvs() |
|
|
vs.map.put(SolidBgVob(Color.yellow)) |
|
|
render(vs) |
|
|
checkAvgColor(160,150,50,50, (255, 255, 0), delta=5) |
|
|
|
|
|
v = PageSpanCellView() |
|
|
v.useBg = 0 |
|
|
|
|
66 |
|
|
67 |
v.placeCentered(enfMaker.makeEnfilade(sc.getCurrent()), vs, 0, None, None, 1, 100000) |
for i in range(0, 30): |
68 |
|
gzz.client.AbstractUpdateManager.tickIdle() |
69 |
|
|
70 |
render(vs) |
vs = getvs() |
71 |
checkAvgColor(160,150,50,50, (255, 255, 0), delta=5) |
vs.map.put(SolidBgVob(Color.yellow)) |
72 |
|
render(vs) |
73 |
|
checkAvgColor(160,150,50,50, (255, 255, 0), delta=5) |
74 |
|
|
75 |
|
v = PageSpanCellView() |
76 |
|
v.useBg = 0 |
77 |
|
|
78 |
|
|
79 |
|
scaled = vs.orthoCS(0, "X", 0, 100, 100, .2, .2) |
80 |
|
v.placeCentered(enfMaker.makeEnfilade(sc.getCurrent()), vs, scaled, |
81 |
|
None, None, 1, 100000) |
82 |
|
|
83 |
|
render(vs) |
84 |
|
|
85 |
|
if checkColors(100, 100): return |
86 |
|
|
87 |
|
Thread.sleep(100) |
88 |
|
|
89 |
|
failUnlessEqual("didn't get the image " + exc, 0, 1) |
90 |
|
|
91 |
|
|
92 |
|
|