added text enhancement regression tests
This commit is contained in:
parent
6faa84abdb
commit
1ceeb4d17b
@ -64,7 +64,8 @@ var rasterizeTextLayer = (function rasterizeTextLayerClosure() {
|
|||||||
return textLayerStylePromise;
|
return textLayerStylePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function rasterizeTextLayer(ctx, viewport, textContent) {
|
function rasterizeTextLayer(ctx, viewport, textContent,
|
||||||
|
enhanceTextSelection) {
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
// Building SVG with size of the viewport.
|
// Building SVG with size of the viewport.
|
||||||
var svg = document.createElementNS(SVG_NS, 'svg:svg');
|
var svg = document.createElementNS(SVG_NS, 'svg:svg');
|
||||||
@ -470,12 +471,13 @@ var Driver = (function DriverClosure() {
|
|||||||
var textLayerContext = textLayerCanvas.getContext('2d');
|
var textLayerContext = textLayerCanvas.getContext('2d');
|
||||||
textLayerContext.clearRect(0, 0,
|
textLayerContext.clearRect(0, 0,
|
||||||
textLayerCanvas.width, textLayerCanvas.height);
|
textLayerCanvas.width, textLayerCanvas.height);
|
||||||
|
var enhanceText = !!task.enhance;
|
||||||
// The text builder will draw its content on the test canvas
|
// The text builder will draw its content on the test canvas
|
||||||
initPromise = page.getTextContent({
|
initPromise = page.getTextContent({
|
||||||
normalizeWhitespace: true,
|
normalizeWhitespace: true,
|
||||||
}).then(function(textContent) {
|
}).then(function(textContent) {
|
||||||
return rasterizeTextLayer(textLayerContext, viewport,
|
return rasterizeTextLayer(textLayerContext, viewport,
|
||||||
textContent);
|
textContent, enhanceText);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
textLayerCanvas = null;
|
textLayerCanvas = null;
|
||||||
|
@ -23,6 +23,13 @@
|
|||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
|
{ "id": "tracemonkey-text-enhance",
|
||||||
|
"file": "pdfs/tracemonkey.pdf",
|
||||||
|
"md5": "9a192d8b1a7dc652a19835f6f08098bd",
|
||||||
|
"rounds": 1,
|
||||||
|
"enhance": true,
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
{ "id": "issue3925",
|
{ "id": "issue3925",
|
||||||
"file": "pdfs/issue3925.pdf",
|
"file": "pdfs/issue3925.pdf",
|
||||||
"md5": "c5c895deecf7a7565393587e0d61be2b",
|
"md5": "c5c895deecf7a7565393587e0d61be2b",
|
||||||
@ -331,12 +338,28 @@
|
|||||||
"lastPage": 4,
|
"lastPage": 4,
|
||||||
"type": "text"
|
"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",
|
{ "id": "rotated-text",
|
||||||
"file": "pdfs/rotated.pdf",
|
"file": "pdfs/rotated.pdf",
|
||||||
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
|
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
|
{ "id": "rotated-text-enhance",
|
||||||
|
"file": "pdfs/rotated.pdf",
|
||||||
|
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
|
||||||
|
"rounds": 1,
|
||||||
|
"enhance": true,
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "issue3115",
|
"id": "issue3115",
|
||||||
"file": "pdfs/issue3115r.pdf",
|
"file": "pdfs/issue3115r.pdf",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user