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-Type", MIMEs[ext])
self.send_header("Content-Length", os.path.getsize(path)) self.send_header("Content-Length", os.path.getsize(path))
self.end_headers() self.end_headers()
with open(path) as f: with open(path, "rb") as f:
self.wfile.write(f.read()) self.wfile.write(f.read())
def do_GET(self): def do_GET(self):

View File

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