1 |
from __future__ import nested_scopes |
from __future__ import nested_scopes |
2 |
|
import sys |
3 |
|
import traceback |
4 |
needGL() |
needGL() |
5 |
|
|
6 |
import gzz |
import gzz |
7 |
from gzz.gfx.gl import GLVobCoorder, GL |
from gzz.gfx.gl import GLVobCoorder, GL |
8 |
from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill, GLSpanner, PageSpanPaper |
from gzz.gfx.gl import GL, GLRen, GLCache, PaperMill, GLSpanner, PageSpanPaper |
9 |
|
from java.lang import Thread |
10 |
|
|
11 |
|
from test.tools.gfx import * |
12 |
|
|
13 |
id = "01ACE8A2E202A26072012715A94A270CD012F9B0F2" |
id = "01ACE8A2E202A26072012715A94A270CD012F9B0F2" |
14 |
|
|
21 |
""" |
""" |
22 |
failUnlessEqual(sc.getCurrent().length(), 2) |
failUnlessEqual(sc.getCurrent().length(), 2) |
23 |
|
|
24 |
|
def checkColors(): |
25 |
|
try: |
26 |
|
# Check that the green rectangle is there |
27 |
|
checkAvgColor(160,150,50,50, (0, 255, 0)) |
28 |
|
# Check that the red rectangle is there |
29 |
|
checkAvgColor(260,150,50,50, (255, 0, 0)) |
30 |
|
# Check that the black rectangle is there |
31 |
|
checkAvgColor(150,225,20,50, (0, 0, 0)) |
32 |
|
checkAvgColor(330,225,20,50, (0, 0, 0)) |
33 |
|
|
34 |
|
# Check that the border is yellow |
35 |
|
checkAvgColor(45, 0, 2, 500, (255, 255, 0)) |
36 |
|
checkAvgColor(453, 0, 2, 500, (255, 255, 0)) |
37 |
|
except: |
38 |
|
return 0 |
39 |
|
# Let these run to print out the errors |
40 |
|
typ, val, tra = sys.exc_info() |
41 |
|
print (repr((typ, val))) |
42 |
|
print str(val) |
43 |
|
l = traceback.format_list(traceback.extract_tb(tra)) |
44 |
|
print "\n".join(l) |
45 |
|
return 0 |
46 |
|
return 1 |
47 |
|
|
48 |
def testNobg(): |
def testNobg(): |
49 |
"""Test that the image gets loaded correctly from GLSpanner. |
"""Test that the image gets loaded correctly from GLSpanner. |
50 |
|
|
|
fail: * |
|
51 |
""" |
""" |
52 |
|
|
53 |
pagespan = GLSpanner.getSpanRect(sc.getCurrent()).page |
pagespan = GLSpanner.getSpanRect(sc.getCurrent()).page |
58 |
vs = getvs() |
vs = getvs() |
59 |
vs.map.put(SolidBgVob(Color.yellow)) |
vs.map.put(SolidBgVob(Color.yellow)) |
60 |
|
|
61 |
pcs = vs.orthoCS(0, "A", 0, 50, 50, 400, 400) |
pcs = vs.orthoCS(0, "A", 0, 50, 50, 400.0 / p.w, 400.0 / p.h) |
62 |
vs.map.put( |
vs.map.put( |
63 |
GLRen.createPaperQuad(pap, 0, 0, p.w, p.h, 1, 1, 0), |
GLRen.createPaperQuad(pap, 0, 0, p.w, p.h, 1, 1, 0), |
64 |
pcs, 0) |
pcs, 0) |
65 |
|
|
66 |
for i in range(0, 10): |
for i in range(0, 30): |
67 |
pagespan.request(1, 5000) |
pagespan.getTexture(1, 5000) |
68 |
|
gzz.client.AbstractUpdateManager.tickIdle() |
69 |
render(vs) |
render(vs) |
70 |
|
|
71 |
|
# check the rendered image's color |
72 |
|
if checkColors(): return |
73 |
|
|
74 |
Thread.sleep(100) |
Thread.sleep(100) |
75 |
|
|
76 |
|
|
77 |
|
failUnlessEqual("didn't get the image", 0, 1) |
78 |
|
|
79 |
failUnlessEqual(0, 1) |
# : vim: set syntax=python : |