Skip to content

Commit

Permalink
improve raw pixel buffers test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalAr committed Oct 2, 2015
1 parent bbbafb7 commit 2a60f34
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tests/02.operations/001.open.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ describe('lwip.open', function() {
var buffer;
before(function(done) {
buffer = new Buffer(100 * 100);
buffer.fill(0);
done();
});

Expand All @@ -297,7 +298,7 @@ describe('lwip.open', function() {
img.should.be.ok();
for (var x = 0 ; x < img.width() ; x++){
for (var y = 0 ; y < img.height() ; y++){
img.getPixel(x, y).should.equal({r: 0, g: 0, b: 0, a: 100});
img.getPixel(x, y).should.deepEqual({r: 0, g: 0, b: 0, a: 100});
}
}
done();
Expand All @@ -309,6 +310,8 @@ describe('lwip.open', function() {
var buffer;
before(function(done) {
buffer = new Buffer(100 * 100 * 2);
buffer.fill(0, 0, 10000);
buffer.fill(50, 10000);
done();
});

Expand All @@ -318,7 +321,7 @@ describe('lwip.open', function() {
img.should.be.ok();
for (var x = 0 ; x < img.width() ; x++){
for (var y = 0 ; y < img.height() ; y++){
img.getPixel(x, y).should.equal({r: 0, g: 0, b: 0, a: 0});
img.getPixel(x, y).should.deepEqual({r: 0, g: 0, b: 0, a: 50});
}
}
done();
Expand All @@ -330,6 +333,9 @@ describe('lwip.open', function() {
var buffer;
before(function(done) {
buffer = new Buffer(100 * 100 * 3);
buffer.fill(10, 0, 10000);
buffer.fill(20, 10000, 2 * 10000);
buffer.fill(30, 2 * 10000);
done();
});

Expand All @@ -339,7 +345,7 @@ describe('lwip.open', function() {
img.should.be.ok();
for (var x = 0 ; x < img.width() ; x++){
for (var y = 0 ; y < img.height() ; y++){
img.getPixel(x, y).should.equal({r: 0, g: 0, b: 0, a: 100});
img.getPixel(x, y).should.deepEqual({r: 10, g: 20, b: 30, a: 100});
}
}
done();
Expand All @@ -351,6 +357,10 @@ describe('lwip.open', function() {
var buffer;
before(function(done) {
buffer = new Buffer(100 * 100 * 4);
buffer.fill(10, 0, 10000);
buffer.fill(20, 10000, 2 * 10000);
buffer.fill(30, 2 * 10000, 3 * 10000);
buffer.fill(50, 3 * 10000);
done();
});

Expand All @@ -360,7 +370,7 @@ describe('lwip.open', function() {
img.should.be.ok();
for (var x = 0 ; x < img.width() ; x++){
for (var y = 0 ; y < img.height() ; y++){
img.getPixel(x, y).should.equal({r: 0, g: 0, b: 0, a: 0});
img.getPixel(x, y).should.deepEqual({r: 10, g: 20, b: 30, a: 50});
}
}
done();
Expand Down

0 comments on commit 2a60f34

Please sign in to comment.