added text enhancement regression tests

This commit is contained in:
Jeremy Press 2016-08-17 10:56:43 -07:00
parent 6faa84abdb
commit 1ceeb4d17b
2 changed files with 27 additions and 2 deletions

View File

@ -64,7 +64,8 @@ var rasterizeTextLayer = (function rasterizeTextLayerClosure() {
return textLayerStylePromise;
}
function rasterizeTextLayer(ctx, viewport, textContent) {
function rasterizeTextLayer(ctx, viewport, textContent,
enhanceTextSelection) {
return new Promise(function (resolve) {
// Building SVG with size of the viewport.
var svg = document.createElementNS(SVG_NS, 'svg:svg');
@ -470,12 +471,13 @@ var Driver = (function DriverClosure() {
var textLayerContext = textLayerCanvas.getContext('2d');
textLayerContext.clearRect(0, 0,
textLayerCanvas.width, textLayerCanvas.height);
var enhanceText = !!task.enhance;
// The text builder will draw its content on the test canvas
initPromise = page.getTextContent({
normalizeWhitespace: true,
}).then(function(textContent) {
return rasterizeTextLayer(textLayerContext, viewport,
textContent);
textContent, enhanceText);
});
} else {
textLayerCanvas = null;

View File

@ -23,6 +23,13 @@
"rounds": 1,
"type": "text"
},
{ "id": "tracemonkey-text-enhance",
"file": "pdfs/tracemonkey.pdf",
"md5": "9a192d8b1a7dc652a19835f6f08098bd",
"rounds": 1,
"enhance": true,
"type": "text"
},
{ "id": "issue3925",
"file": "pdfs/issue3925.pdf",
"md5": "c5c895deecf7a7565393587e0d61be2b",
@ -331,12 +338,28 @@
"lastPage": 4,
"type": "text"
},
{ "id": "taro-text-enhance",
"file": "pdfs/TaroUTR50SortedList112.pdf",
"md5": "ce63eab622ff473a43f8a8de85ef8a46",
"link":true,
"rounds": 1,
"lastPage": 4,
"enhance": true,
"type": "text"
},
{ "id": "rotated-text",
"file": "pdfs/rotated.pdf",
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
"rounds": 1,
"type": "text"
},
{ "id": "rotated-text-enhance",
"file": "pdfs/rotated.pdf",
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
"rounds": 1,
"enhance": true,
"type": "text"
},
{
"id": "issue3115",
"file": "pdfs/issue3115r.pdf",