mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Increase unit test coverage to ~95%
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var assert = require('assert');
|
||||
|
||||
var sharp = require('../../index');
|
||||
var fixtures = require('../fixtures');
|
||||
|
||||
@@ -10,12 +12,14 @@ describe('Gamma correction', function() {
|
||||
.resize(129, 111)
|
||||
.toFile(fixtures.path('output.gamma-0.0.jpg'), done);
|
||||
});
|
||||
|
||||
it('value of 2.2 (default)', function(done) {
|
||||
sharp(fixtures.inputJpgWithGammaHoliness)
|
||||
.resize(129, 111)
|
||||
.gamma()
|
||||
.toFile(fixtures.path('output.gamma-2.2.jpg'), done);
|
||||
});
|
||||
|
||||
it('value of 3.0', function(done) {
|
||||
sharp(fixtures.inputJpgWithGammaHoliness)
|
||||
.resize(129, 111)
|
||||
@@ -23,4 +27,15 @@ describe('Gamma correction', function() {
|
||||
.toFile(fixtures.path('output.gamma-3.0.jpg'), done);
|
||||
});
|
||||
|
||||
it('invalid value', function(done) {
|
||||
var isValid = true;
|
||||
try {
|
||||
sharp(fixtures.inputJpgWithGammaHoliness).gamma(4);
|
||||
} catch (err) {
|
||||
isValid = false;
|
||||
}
|
||||
assert.strictEqual(false, isValid);
|
||||
done();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user