fix test.py bug on windows and stomped failure messages

This commit is contained in:
Chris Jones 2011-07-04 16:14:04 -04:00
parent 637708cf1a
commit eb17d81316
2 changed files with 27 additions and 22 deletions

View File

@ -99,7 +99,7 @@ class PDFTestHandler(BaseHTTPRequestHandler):
self.send_header("Content-Type", MIMEs[ext])
self.send_header("Content-Length", os.path.getsize(path))
self.end_headers()
with open(path) as f:
with open(path, "rb") as f:
self.wfile.write(f.read())
def do_GET(self):

View File

@ -88,13 +88,14 @@ function nextPage() {
}
}
failure = '';
var ctx, fonts, gfx;
if (!failure) {
log(" loading page "+ currentTask.pageNum +"... ");
var ctx = canvas.getContext("2d");
ctx = canvas.getContext("2d");
var fonts = [];
var gfx = null;
fonts = [];
gfx = null;
try {
gfx = new CanvasGraphics(ctx);
currentPage = pdfDoc.getPage(currentTask.pageNum);
@ -102,7 +103,9 @@ function nextPage() {
} catch(e) {
failure = 'compile: '+ e.toString();
}
}
if (!failure) {
try {
var pdfToCssUnitsCoef = 96.0 / 72.0;
// using mediaBox for the canvas size
@ -114,6 +117,7 @@ function nextPage() {
} catch(e) {
failure = 'page setup: '+ e.toString();
}
}
if (!failure) {
try {
@ -145,6 +149,7 @@ function snapshotCurrentPage(gfx) {
log("done"+ (failure ? " (failed!)" : "") +"\n");
// Set up the next request
failure = '';
backoff = (inFlightRequests > 0) ? inFlightRequests * 10 : 0;
setTimeout(function() {
++currentTask.pageNum, nextPage();