From e7894ca07d107e03e473a76c7b8506b3a0f4620c Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Sun, 16 Sep 2012 07:46:29 -0700 Subject: [PATCH] Fix the driver.js file to handle new TextLayer infrastructure --- test/driver.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/driver.js b/test/driver.js index 998527807..1b690811b 100644 --- a/test/driver.js +++ b/test/driver.js @@ -159,6 +159,7 @@ NullTextLayerBuilder.prototype = { function SimpleTextLayerBuilder(ctx, viewport) { this.ctx = ctx; this.viewport = viewport; + this.textCounter = 0; } SimpleTextLayerBuilder.prototype = { beginLayout: function SimpleTextLayerBuilder_BeginLayout() { @@ -180,14 +181,18 @@ SimpleTextLayerBuilder.prototype = { ctx.stroke(); ctx.fill(); - var textContent = bidi(text, -1); + var textContent = this.textContent.text[this.textCounter]; ctx.font = fontHeight + 'px ' + fontName; ctx.fillStyle = 'black'; ctx.fillText(textContent, text.geom.x, text.geom.y); + + this.textCounter ++; + }, + setTextContent: function SimpleTextLayerBuilder_SetTextContent(textContent) { + this.textContent = textContent; } }; - function nextPage(task, loadError) { var failure = loadError || ''; @@ -245,6 +250,10 @@ function nextPage(task, loadError) { drawContext = dummyCanvas.getContext('2d'); // ... text builder will draw its content on the test canvas textLayerBuilder = new SimpleTextLayerBuilder(ctx, viewport); + + page.getTextContent().then(function(textContent) { + textLayerBuilder.setTextContent(textContent); + }); } else { drawContext = ctx; textLayerBuilder = new NullTextLayerBuilder();