[Pkg-javascript-commits] [pdf.js] 37/106: Refactor test slave
David Prévot
taffit at moszumanska.debian.org
Sat Jun 20 21:33:49 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 58769fd3b9c518485475ac6d06ce821729a3a979
Author: Tim van der Meij <timvandermeij at gmail.com>
Date: Fri May 15 14:02:56 2015 +0200
Refactor test slave
- Improved names of elements
- Easier scrolling code
---
test/driver.js | 17 +++++++----------
test/test_slave.html | 43 ++++++++++++++++++-------------------------
2 files changed, 25 insertions(+), 35 deletions(-)
diff --git a/test/driver.js b/test/driver.js
index 88be8a7..2cc69b6 100644
--- a/test/driver.js
+++ b/test/driver.js
@@ -54,7 +54,7 @@ window.load = function load() {
var delay = params.delay || 0;
canvas = document.createElement('canvas');
- stdout = document.getElementById('stdout');
+ stdout = document.getElementById('output');
info('User Agent: ' + navigator.userAgent);
log('load...\n');
@@ -93,7 +93,7 @@ function cleanup(callback) {
var ownerNode = styleSheet.ownerNode;
ownerNode.parentNode.removeChild(ownerNode);
}
- var guard = document.getElementById('content-end');
+ var guard = document.getElementById('end');
var body = document.body;
while (body.lastChild !== guard) {
body.removeChild(body.lastChild);
@@ -369,7 +369,7 @@ function quitApp() {
function done() {
if (inFlightRequests > 0) {
- document.getElementById('inFlightCount').innerHTML = inFlightRequests;
+ document.getElementById('inflight').innerHTML = inFlightRequests;
setTimeout(done, 100);
} else {
setTimeout(quitApp, 100);
@@ -417,7 +417,7 @@ function send(url, message, callback) {
}
}
};
- document.getElementById('inFlightCount').innerHTML = inFlightRequests++;
+ document.getElementById('inflight').innerHTML = inFlightRequests++;
r.send(message);
}
@@ -433,11 +433,8 @@ function clear(ctx) {
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
-/* Auto-scroll if the scrollbar is near the bottom, otherwise do nothing. */
-function checkScrolling() {
- if ((stdout.scrollHeight - stdout.scrollTop) <= stdout.offsetHeight) {
- stdout.scrollTop = stdout.scrollHeight;
- }
+function scroll() {
+ window.scrollTo(0, document.body.scrollHeight);
}
function log(str) {
@@ -448,7 +445,7 @@ function log(str) {
}
if (str.lastIndexOf('\n') >= 0) {
- checkScrolling();
+ scroll();
}
}
diff --git a/test/test_slave.html b/test/test_slave.html
index 83a7abe..0bee4d2 100644
--- a/test/test_slave.html
+++ b/test/test_slave.html
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<!--
-Copyright 2012 Mozilla Foundation
+Copyright 2015 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,34 +14,27 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
-
<html>
<head>
- <title>pdf.js test slave</title>
- <style type="text/css"></style>
- <script src="/src/shared/util.js"></script>
- <script src="/src/display/api.js"></script>
- <script src="/src/display/metadata.js"></script>
- <script src="/src/display/canvas.js"></script>
- <script src="/src/display/webgl.js"></script>
- <script src="/src/display/pattern_helper.js"></script>
- <script src="/src/display/font_loader.js"></script>
- <script src="/src/display/annotation_helper.js"></script>
+ <title>PDF.js test slave</title>
+ <meta charset="utf-8">
+ <script src="../src/shared/util.js"></script>
+ <script src="../src/display/api.js"></script>
+ <script src="../src/display/metadata.js"></script>
+ <script src="../src/display/canvas.js"></script>
+ <script src="../src/display/webgl.js"></script>
+ <script src="../src/display/pattern_helper.js"></script>
+ <script src="../src/display/font_loader.js"></script>
+ <script src="../src/display/annotation_helper.js"></script>
<script src="driver.js"></script>
-
- <script>
- PDFJS.workerSrc = '/src/worker_loader.js';
- </script>
</head>
-
<body>
- <pre style="width:800px; height:800px; overflow:scroll;" id="stdout"></pre>
- <p>Inflight requests: <span id="inFlightCount"></span></p>
- <div id="content-end"></div>
-
- <script>
- 'use strict';
- load();
- </script>
+ <pre id="output"></pre>
+ <p>Inflight requests: <span id="inflight"></span></p>
+ <div id="end"></div>
</body>
+ <script>
+ PDFJS.workerSrc = '../src/worker_loader.js';
+ load();
+ </script>
</html>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list