Skip to content

Commit

Permalink
added text enhancement regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Press committed Aug 31, 2016
1 parent 6faa84a commit 1ceeb4d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
Expand Down
23 changes: 23 additions & 0 deletions test/test_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 1ceeb4d

Please sign in to comment.