mirror of
https://github.com/danbulant/pngjs
synced 2026-07-11 14:11:11 +00:00
Code format test code
This commit is contained in:
parent
288a696584
commit
5310b0ed5f
4 changed files with 159 additions and 159 deletions
|
|
@ -17,10 +17,10 @@ for (var y = 0; y < png.height; y++) {
|
|||
|
||||
var col = x < (png.width >> 1) ^ y < (png.height >> 1) ? 0xe5 : 0xff;
|
||||
|
||||
png.data[idx ] = col;
|
||||
png.data[idx+1] = col;
|
||||
png.data[idx+2] = col;
|
||||
png.data[idx+3] = 0xff;
|
||||
png.data[idx] = col;
|
||||
png.data[idx + 1] = col;
|
||||
png.data[idx + 2] = col;
|
||||
png.data[idx + 3] = 0xff;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
var fs = require('fs');
|
||||
var PNG = require('../lib/png').PNG;
|
||||
var test = require('tape');
|
||||
|
|
@ -6,7 +5,7 @@ var test = require('tape');
|
|||
fs.readdir(__dirname + '/in/', function (err, files) {
|
||||
if (err) throw err;
|
||||
|
||||
files = files.filter(function(file) {
|
||||
files = files.filter(function (file) {
|
||||
return ((process.argv[3] || "").indexOf("nolarge") < 0 || !file.match(/large/i)) && Boolean(file.match(/\.png$/i));
|
||||
});
|
||||
|
||||
|
|
@ -19,7 +18,7 @@ fs.readdir(__dirname + '/in/', function (err, files) {
|
|||
expectedError = true;
|
||||
}
|
||||
|
||||
test('convert sync - ' + file, function(t) {
|
||||
test('convert sync - ' + file, function (t) {
|
||||
|
||||
if (file.match(/large/)) {
|
||||
t.timeoutAfter(1000 * 60);
|
||||
|
|
@ -57,7 +56,7 @@ fs.readdir(__dirname + '/in/', function (err, files) {
|
|||
}));
|
||||
});
|
||||
|
||||
test('convert async - ' + file, function(t) {
|
||||
test('convert async - ' + file, function (t) {
|
||||
fs.createReadStream(__dirname + '/in/' + file)
|
||||
.pipe(new PNG())
|
||||
.on('error', function (err) {
|
||||
|
|
@ -78,7 +77,7 @@ fs.readdir(__dirname + '/in/', function (err, files) {
|
|||
this.pack()
|
||||
.pipe(
|
||||
fs.createWriteStream(__dirname + '/out/' + file)
|
||||
.on("finish", function() {
|
||||
.on("finish", function () {
|
||||
t.pass("completed");
|
||||
t.end();
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ var page = require('webpage').create();
|
|||
var last = new Date();
|
||||
var timeout = 10000;
|
||||
|
||||
setInterval(function() {
|
||||
var results = page.evaluate(function(){
|
||||
setInterval(function () {
|
||||
var results = page.evaluate(function () {
|
||||
if (window.isFinished && window.isFinished()) {
|
||||
return window.results;
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ setInterval(function() {
|
|||
var success = true;
|
||||
var successes = [],
|
||||
failures = [];
|
||||
for(var i = 0; i < results.length; i++) {
|
||||
for (var i = 0; i < results.length; i++) {
|
||||
var result = results[i];
|
||||
if (result.success) {
|
||||
successes.push(result.name);
|
||||
|
|
@ -41,16 +41,16 @@ setInterval(function() {
|
|||
}
|
||||
}, 100);
|
||||
|
||||
page.onConsoleMessage = function(msg, lineNum, sourceId) {
|
||||
page.onConsoleMessage = function (msg, lineNum, sourceId) {
|
||||
//console.log('CONSOLE: ' + msg);
|
||||
};
|
||||
|
||||
page.onError = function(msg, trace) {
|
||||
page.onError = function (msg, trace) {
|
||||
console.log('error.onError', msg, trace);
|
||||
phantom.exit();
|
||||
};
|
||||
|
||||
phantom.onError = function(msg, trace) {
|
||||
phantom.onError = function (msg, trace) {
|
||||
console.log('error.onError', msg, trace);
|
||||
phantom.exit();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,11 +13,12 @@ try {
|
|||
console.log("Comparing in PhantomJS");
|
||||
|
||||
childProcess.execFile(binPath, childArgs, function (err, stdout, stderr) {
|
||||
|
||||
// handle results
|
||||
console.log("Comparison Test Results:");
|
||||
console.log(stdout);
|
||||
process.exit(err ? 1 : 0);
|
||||
});
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.log("Error starting phantomjs");
|
||||
}
|
||||
Loading…
Reference in a new issue