2012-04-20 04:32:24 +09:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>pdf.js unit test</title>
|
|
|
|
|
|
|
|
<link rel="shortcut icon" type="image/png" href="../../external/jasmine/jasmine_favicon.png">
|
|
|
|
<link rel="stylesheet" type="text/css" href="../../external/jasmine/jasmine.css">
|
|
|
|
|
2015-12-17 06:03:06 +09:00
|
|
|
<script src="../../node_modules/requirejs/require.js"></script>
|
2014-05-13 09:41:01 +09:00
|
|
|
<script src="../../external/jasmine/jasmine.js"></script>
|
|
|
|
<script src="../../external/jasmine/jasmine-html.js"></script>
|
|
|
|
<script src="testreporter.js"></script>
|
2012-04-20 04:32:24 +09:00
|
|
|
|
2014-12-27 01:43:13 +09:00
|
|
|
<script src="../../web/ui_utils.js"></script>
|
2015-12-17 06:03:06 +09:00
|
|
|
|
|
|
|
<script>
|
|
|
|
// Hacking describe() to wait for PDFJS to be loaded, since Jasmine executes
|
|
|
|
// it without waiting for libs to be loaded and fails to use PDFJS members.
|
|
|
|
var oldDescribe = window.describe, describeQueue = [];
|
|
|
|
window.describe = function () {
|
|
|
|
describeQueue.push(Array.prototype.slice.call(arguments, 0));
|
|
|
|
};
|
|
|
|
</script>
|
2013-08-13 02:48:06 +09:00
|
|
|
|
2012-04-20 04:32:24 +09:00
|
|
|
<!-- include spec files here... -->
|
2015-11-22 01:32:47 +09:00
|
|
|
<script src="primitives_spec.js"></script>
|
2014-05-13 09:41:01 +09:00
|
|
|
<script src="font_spec.js"></script>
|
|
|
|
<script src="function_spec.js"></script>
|
|
|
|
<script src="crypto_spec.js"></script>
|
|
|
|
<script src="evaluator_spec.js"></script>
|
|
|
|
<script src="stream_spec.js"></script>
|
|
|
|
<script src="parser_spec.js"></script>
|
|
|
|
<script src="api_spec.js"></script>
|
|
|
|
<script src="metadata_spec.js"></script>
|
2014-12-27 01:43:13 +09:00
|
|
|
<script src="ui_utils_spec.js"></script>
|
2014-05-13 09:41:01 +09:00
|
|
|
<script src="util_spec.js"></script>
|
|
|
|
<script src="cmap_spec.js"></script>
|
2014-12-26 05:04:01 +09:00
|
|
|
<script src="annotation_layer_spec.js"></script>
|
2015-12-17 06:03:06 +09:00
|
|
|
|
2014-05-13 09:41:01 +09:00
|
|
|
<script>
|
2012-04-20 04:32:24 +09:00
|
|
|
'use strict';
|
|
|
|
|
2015-12-17 06:03:06 +09:00
|
|
|
var pdfjsLibs;
|
|
|
|
|
|
|
|
function initializePDFJS(callback) {
|
|
|
|
require.config({paths: {'pdfjs': '../../src'}});
|
|
|
|
require(['pdfjs/shared/util', 'pdfjs/shared/global', 'pdfjs/core/primitives',
|
|
|
|
'pdfjs/core/annotation', 'pdfjs/core/crypto', 'pdfjs/core/stream',
|
|
|
|
'pdfjs/core/fonts', 'pdfjs/core/ps_parser', 'pdfjs/core/function',
|
|
|
|
'pdfjs/core/parser', 'pdfjs/core/evaluator', 'pdfjs/core/cmap',
|
|
|
|
'pdfjs/core/worker', 'pdfjs/display/api', 'pdfjs/display/metadata'],
|
|
|
|
function (sharedUtil, sharedGlobal, corePrimitives, coreAnnotation,
|
|
|
|
coreCrypto, coreStream, coreFonts, corePsParser, coreFunction,
|
|
|
|
coreParser, coreEvaluator, coreCMap, coreWorker, displayAPI,
|
|
|
|
displayMetadata) {
|
|
|
|
|
|
|
|
pdfjsLibs = {
|
|
|
|
sharedUtil: sharedUtil,
|
|
|
|
sharedGlobal: sharedGlobal,
|
|
|
|
corePrimitives: corePrimitives,
|
|
|
|
coreAnnotation: coreAnnotation,
|
|
|
|
coreCrypto: coreCrypto,
|
|
|
|
coreStream: coreStream,
|
|
|
|
coreFonts: coreFonts,
|
|
|
|
corePsParser: corePsParser,
|
|
|
|
coreFunction: coreFunction,
|
|
|
|
coreParser: coreParser,
|
|
|
|
coreEvaluator: coreEvaluator,
|
|
|
|
coreCMap: coreCMap,
|
|
|
|
coreWorker: coreWorker,
|
|
|
|
displayAPI: displayAPI,
|
|
|
|
displayMetadata: displayMetadata
|
|
|
|
};
|
|
|
|
|
|
|
|
// Expose all loaded internal exported members to global scope.
|
|
|
|
Object.keys(pdfjsLibs).forEach(function (libName) {
|
|
|
|
var lib = pdfjsLibs[libName];
|
|
|
|
Object.keys(lib).forEach(function (name) {
|
|
|
|
if (Object.getOwnPropertyDescriptor(window, name)) {
|
|
|
|
return; // ignoring if already set
|
|
|
|
}
|
|
|
|
window[name] = lib[name];
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
// Configure the worker.
|
|
|
|
PDFJS.workerSrc = '../../src/worker_loader.js';
|
|
|
|
|
|
|
|
// Release describe() calls.
|
|
|
|
window.describe = oldDescribe;
|
|
|
|
describeQueue.forEach(function (args) {
|
|
|
|
oldDescribe.apply(window, args);
|
|
|
|
});
|
|
|
|
|
|
|
|
callback();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2012-04-20 04:32:24 +09:00
|
|
|
(function pdfJsUnitTest() {
|
|
|
|
function queryParams() {
|
|
|
|
var qs = window.location.search.substring(1);
|
|
|
|
var kvs = qs.split('&');
|
|
|
|
var params = { };
|
|
|
|
for (var i = 0; i < kvs.length; ++i) {
|
|
|
|
var kv = kvs[i].split('=');
|
|
|
|
params[unescape(kv[0])] = unescape(kv[1]);
|
|
|
|
}
|
|
|
|
return params;
|
|
|
|
}
|
|
|
|
|
|
|
|
var jasmineEnv = jasmine.getEnv();
|
|
|
|
jasmineEnv.updateInterval = 1000;
|
|
|
|
|
|
|
|
var trivialReporter = new jasmine.TrivialReporter();
|
|
|
|
|
|
|
|
jasmineEnv.addReporter(trivialReporter);
|
|
|
|
|
|
|
|
var params = queryParams();
|
|
|
|
if (params['browser']) {
|
|
|
|
var testReporter = new TestReporter(params['browser'], params['path']);
|
|
|
|
jasmineEnv.addReporter(testReporter);
|
|
|
|
}
|
|
|
|
|
|
|
|
jasmineEnv.specFilter = function pdfJsUnitTestSpecFilter(spec) {
|
|
|
|
return trivialReporter.specFilter(spec);
|
|
|
|
};
|
|
|
|
|
|
|
|
var currentWindowOnload = window.onload;
|
|
|
|
|
|
|
|
window.onload = function pdfJsUnitTestOnload() {
|
|
|
|
if (currentWindowOnload) {
|
|
|
|
currentWindowOnload();
|
|
|
|
}
|
2015-12-17 06:03:06 +09:00
|
|
|
initializePDFJS(execJasmine);
|
2012-04-20 04:32:24 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
function execJasmine() {
|
|
|
|
jasmineEnv.execute();
|
|
|
|
}
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
</body>
|
|
|
|
</html>
|