Skip to content

Commit

Permalink
improve raw pixels buffer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalAr committed Oct 2, 2015
1 parent 0cc228d commit bbbafb7
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions tests/02.operations/001.open.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,15 @@ describe('lwip.open', function() {
done();
});

it('should succeed', function(done) {
it('should construct an all-black pixels image', function(done) {
lwip.open(buffer, { width: 100, height: 100 }, function(err, img) {
should(err).not.be.Error();
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});
}
}
done();
});
});
Expand All @@ -307,10 +312,15 @@ describe('lwip.open', function() {
done();
});

it('should succeed', function(done) {
it('should construct an all-black transparent pixels image', function(done) {
lwip.open(buffer, { width: 100, height: 100 }, function(err, img) {
should(err).not.be.Error();
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});
}
}
done();
});
});
Expand All @@ -323,10 +333,15 @@ describe('lwip.open', function() {
done();
});

it('should succeed', function(done) {
it('should construct an all-black pixels image', function(done) {
lwip.open(buffer, { width: 100, height: 100 }, function(err, img) {
should(err).not.be.Error();
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});
}
}
done();
});
});
Expand All @@ -339,10 +354,15 @@ describe('lwip.open', function() {
done();
});

it('should succeed', function(done) {
it('should construct an all-black transparent pixels image', function(done) {
lwip.open(buffer, { width: 100, height: 100 }, function(err, img) {
should(err).not.be.Error();
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});
}
}
done();
});
});
Expand Down

0 comments on commit bbbafb7

Please sign in to comment.