Merge pull request #4467 from Snuffleupagus/test-braces
Fix coding style in /test
This commit is contained in:
commit
c7fe33a081
@ -87,15 +87,17 @@ function cleanup() {
|
||||
// Clear out all the stylesheets since a new one is created for each font.
|
||||
while (document.styleSheets.length > 0) {
|
||||
var styleSheet = document.styleSheets[0];
|
||||
while (styleSheet.cssRules.length > 0)
|
||||
while (styleSheet.cssRules.length > 0) {
|
||||
styleSheet.deleteRule(0);
|
||||
}
|
||||
var ownerNode = styleSheet.ownerNode;
|
||||
ownerNode.parentNode.removeChild(ownerNode);
|
||||
}
|
||||
var guard = document.getElementById('content-end');
|
||||
var body = document.body;
|
||||
while (body.lastChild !== guard)
|
||||
while (body.lastChild !== guard) {
|
||||
body.removeChild(body.lastChild);
|
||||
}
|
||||
|
||||
// Wipe out the link to the pdfdoc so it can be GC'ed.
|
||||
for (var i = 0; i < manifest.length; i++) {
|
||||
@ -107,10 +109,12 @@ function cleanup() {
|
||||
}
|
||||
|
||||
function exceptionToString(e) {
|
||||
if (typeof e !== 'object')
|
||||
if (typeof e !== 'object') {
|
||||
return String(e);
|
||||
if (!('message' in e))
|
||||
}
|
||||
if (!('message' in e)) {
|
||||
return JSON.stringify(e);
|
||||
}
|
||||
return e.message + ('stack' in e ? ' at ' + e.stack.split('\n')[0] : '');
|
||||
}
|
||||
|
||||
@ -198,8 +202,8 @@ SimpleTextLayerBuilder.prototype = {
|
||||
var ctx = this.ctx, viewport = this.viewport;
|
||||
// vScale and hScale already contain the scaling to pixel units
|
||||
var fontHeight = geom.fontSize * Math.abs(geom.vScale);
|
||||
var fontAscent = geom.ascent ? geom.ascent * fontHeight :
|
||||
geom.descent ? (1 + geom.descent) * fontHeight : fontHeight;
|
||||
var fontAscent = (geom.ascent ? geom.ascent * fontHeight :
|
||||
(geom.descent ? (1 + geom.descent) * fontHeight : fontHeight));
|
||||
ctx.save();
|
||||
ctx.beginPath();
|
||||
ctx.strokeStyle = 'red';
|
||||
@ -429,13 +433,15 @@ function checkScrolling() {
|
||||
}
|
||||
|
||||
function log(str) {
|
||||
if (stdout.insertAdjacentHTML)
|
||||
if (stdout.insertAdjacentHTML) {
|
||||
stdout.insertAdjacentHTML('BeforeEnd', str);
|
||||
else
|
||||
} else {
|
||||
stdout.innerHTML += str;
|
||||
}
|
||||
|
||||
if (str.lastIndexOf('\n') >= 0)
|
||||
if (str.lastIndexOf('\n') >= 0) {
|
||||
checkScrolling();
|
||||
}
|
||||
}
|
||||
|
||||
})(); // DriverClosure
|
||||
|
@ -9,8 +9,9 @@ describe('crypto', function() {
|
||||
function string2binary(s) {
|
||||
var n = s.length, i;
|
||||
var result = new Uint8Array(n);
|
||||
for (i = 0; i < n; ++i)
|
||||
for (i = 0; i < n; ++i) {
|
||||
result[i] = s.charCodeAt(i) % 0xFF;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -226,19 +227,19 @@ describe('CipherTransformFactory', function() {
|
||||
describe('#ctor', function() {
|
||||
it('should accept user password', function() {
|
||||
var factory = new CipherTransformFactory(new DictMock(map1), fileID1,
|
||||
'123456');
|
||||
'123456');
|
||||
});
|
||||
|
||||
it('should accept owner password', function() {
|
||||
var factory = new CipherTransformFactory(new DictMock(map1), fileID1,
|
||||
'654321');
|
||||
'654321');
|
||||
});
|
||||
|
||||
it('should not accept wrong password', function() {
|
||||
var thrown = false;
|
||||
try {
|
||||
var factory = new CipherTransformFactory(new DictMock(map1), fileID1,
|
||||
'wrong');
|
||||
'wrong');
|
||||
} catch (e) {
|
||||
thrown = true;
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ describe('font', function() {
|
||||
var line = '';
|
||||
for (var i = 0, ii = bytes.length; i < ii; ++i) {
|
||||
var b = bytes[i].toString(16);
|
||||
if (b.length < 2)
|
||||
if (b.length < 2) {
|
||||
b = '0' + b;
|
||||
}
|
||||
line += b.toString(16);
|
||||
}
|
||||
return line;
|
||||
@ -34,12 +35,17 @@ describe('font', function() {
|
||||
fontData.push(parseInt(hex, 16));
|
||||
}
|
||||
var bytes = new Uint8Array(fontData);
|
||||
fontData = {getBytes: function() { return bytes; }};
|
||||
fontData = {
|
||||
getBytes: function() {
|
||||
return bytes;
|
||||
}
|
||||
};
|
||||
|
||||
function bytesToString(bytesArray) {
|
||||
var str = '';
|
||||
for (var i = 0, ii = bytesArray.length; i < ii; i++)
|
||||
for (var i = 0, ii = bytesArray.length; i < ii; i++) {
|
||||
str += String.fromCharCode(bytesArray[i]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
@ -70,8 +76,9 @@ describe('font', function() {
|
||||
|
||||
index = new CFFIndex();
|
||||
var longName = [];
|
||||
for (var i = 0; i < 129; i++)
|
||||
for (var i = 0; i < 129; i++) {
|
||||
longName.push(0);
|
||||
}
|
||||
index.add(longName);
|
||||
names = parser.parseNameIndex(index);
|
||||
expect(names[0].length).toEqual(127);
|
||||
|
@ -10,21 +10,25 @@ describe('function', function() {
|
||||
this.addMatchers({
|
||||
toMatchArray: function(expected) {
|
||||
var actual = this.actual;
|
||||
if (actual.length != expected.length)
|
||||
if (actual.length != expected.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0; i < expected.length; i++) {
|
||||
var a = actual[i], b = expected[i];
|
||||
if (isArray(b)) {
|
||||
if (a.length != b.length)
|
||||
if (a.length != b.length) {
|
||||
return false;
|
||||
}
|
||||
for (var j = 0; j < a.length; j++) {
|
||||
var suba = a[j], subb = b[j];
|
||||
if (suba !== subb)
|
||||
if (suba !== subb) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (a !== b)
|
||||
if (a !== b) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -17,7 +17,7 @@ describe('parser', function() {
|
||||
it('should parse PostScript numbers', function() {
|
||||
var numbers = ['-.002', '34.5', '-3.62', '123.6e10', '1E-5', '-1.', '0.0',
|
||||
'123', '-98', '43445', '0', '+17'];
|
||||
for (var i=0, ii=numbers.length; i<ii; i++) {
|
||||
for (var i = 0, ii = numbers.length; i < ii; i++) {
|
||||
var num = numbers[i];
|
||||
var input = new StringStream(num);
|
||||
var lexer = new Lexer(input);
|
||||
@ -43,7 +43,7 @@ describe('parser', function() {
|
||||
input.getByte = function(super_getByte) {
|
||||
// simulating end of file using null (see issue 2766)
|
||||
var ch = super_getByte.call(input);
|
||||
return ch === 0x24 /* '$' */ ? -1 : ch;
|
||||
return (ch === 0x24 /* '$' */ ? -1 : ch);
|
||||
}.bind(input, input.getByte);
|
||||
var lexer = new Lexer(input);
|
||||
var result = lexer.getString();
|
||||
|
@ -9,12 +9,14 @@ describe('stream', function() {
|
||||
this.addMatchers({
|
||||
toMatchTypedArray: function(expected) {
|
||||
var actual = this.actual;
|
||||
if (actual.length != expected.length)
|
||||
if (actual.length != expected.length) {
|
||||
return false;
|
||||
}
|
||||
for (var i = 0, ii = expected.length; i < ii; i++) {
|
||||
var a = actual[i], b = expected[i];
|
||||
if (a !== b)
|
||||
if (a !== b) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -29,7 +31,7 @@ describe('stream', function() {
|
||||
dict.set('Columns', 2);
|
||||
|
||||
var input = new Stream(new Uint8Array([2, 100, 3, 2, 1, 255, 2, 1, 255]),
|
||||
0, 9, dict);
|
||||
0, 9, dict);
|
||||
var predictor = new PredictorStream(input, /* length = */ 9, dict);
|
||||
var result = predictor.getBytes(6);
|
||||
|
||||
|
@ -13,8 +13,9 @@ var TestReporter = function(browser, appPath) {
|
||||
r.onreadystatechange = function sendTaskResultOnreadystatechange(e) {
|
||||
if (r.readyState == 4) {
|
||||
// Retry until successful
|
||||
if (r.status !== 200)
|
||||
if (r.status !== 200) {
|
||||
send(action, json);
|
||||
}
|
||||
}
|
||||
};
|
||||
json['browser'] = browser;
|
||||
@ -30,8 +31,9 @@ var TestReporter = function(browser, appPath) {
|
||||
status: status,
|
||||
description: description
|
||||
};
|
||||
if (typeof error !== 'undefined')
|
||||
if (typeof error !== 'undefined') {
|
||||
message['error'] = error;
|
||||
}
|
||||
send('/submit_task_results', message);
|
||||
}
|
||||
|
||||
@ -59,9 +61,11 @@ var TestReporter = function(browser, appPath) {
|
||||
} else {
|
||||
var failedMessages = '';
|
||||
var items = results.getItems();
|
||||
for (var i = 0, ii = items.length; i < ii; i++)
|
||||
if (!items[i].passed())
|
||||
for (var i = 0, ii = items.length; i < ii; i++) {
|
||||
if (!items[i].passed()) {
|
||||
failedMessages += items[i].message + ' ';
|
||||
}
|
||||
}
|
||||
sendResult('TEST-UNEXPECTED-FAIL', results.description, failedMessages);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user