mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Speed up slow pixel limit tests (#404)
This replaces the single color 20000x14000 PNG with a 20000x14000 Grayscale JPG. On a Broadwell Core i7 @ 3.1 GHz this speeds up the "Disabling limit works" test from ~6.2s to ~0.15s because it can use jpeg resize-on-load optimizations. This should fix occasional timeouts on Travis CI.
This commit is contained in:
parent
b224874332
commit
1b7c5816fc
BIN
test/fixtures/giant-image.jpg
vendored
Normal file
BIN
test/fixtures/giant-image.jpg
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
BIN
test/fixtures/giant-image.png
vendored
BIN
test/fixtures/giant-image.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 51 KiB |
2
test/fixtures/index.js
vendored
2
test/fixtures/index.js
vendored
@ -66,6 +66,7 @@ module.exports = {
|
|||||||
inputJpgWithCmykNoProfile: getPath('Channel_digital_image_CMYK_color_no_profile.jpg'),
|
inputJpgWithCmykNoProfile: getPath('Channel_digital_image_CMYK_color_no_profile.jpg'),
|
||||||
inputJpgWithCorruptHeader: getPath('corrupt-header.jpg'),
|
inputJpgWithCorruptHeader: getPath('corrupt-header.jpg'),
|
||||||
inputJpgWithLowContrast: getPath('low-contrast.jpg'), // http://www.flickr.com/photos/grizdave/2569067123/
|
inputJpgWithLowContrast: getPath('low-contrast.jpg'), // http://www.flickr.com/photos/grizdave/2569067123/
|
||||||
|
inputJpgLarge: getPath('giant-image.jpg'),
|
||||||
|
|
||||||
inputPng: getPath('50020484-00001.png'), // http://c.searspartsdirect.com/lis_png/PLDM/50020484-00001.png
|
inputPng: getPath('50020484-00001.png'), // http://c.searspartsdirect.com/lis_png/PLDM/50020484-00001.png
|
||||||
inputPngWithTransparency: getPath('blackbug.png'), // public domain
|
inputPngWithTransparency: getPath('blackbug.png'), // public domain
|
||||||
@ -79,7 +80,6 @@ module.exports = {
|
|||||||
inputPngOverlayLayer2LowAlpha: getPath('alpha-layer-2-ink-low-alpha.png'),
|
inputPngOverlayLayer2LowAlpha: getPath('alpha-layer-2-ink-low-alpha.png'),
|
||||||
inputPngAlphaPremultiplicationSmall: getPath('alpha-premultiply-1024x768-paper.png'),
|
inputPngAlphaPremultiplicationSmall: getPath('alpha-premultiply-1024x768-paper.png'),
|
||||||
inputPngAlphaPremultiplicationLarge: getPath('alpha-premultiply-2048x1536-paper.png'),
|
inputPngAlphaPremultiplicationLarge: getPath('alpha-premultiply-2048x1536-paper.png'),
|
||||||
inputPngLarge: getPath('giant-image.png'),
|
|
||||||
|
|
||||||
inputWebP: getPath('4.webp'), // http://www.gstatic.com/webp/gallery/4.webp
|
inputWebP: getPath('4.webp'), // http://www.gstatic.com/webp/gallery/4.webp
|
||||||
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
|
||||||
|
@ -877,7 +877,7 @@ describe('Input/output', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Disabling limit works', function(done) {
|
it('Disabling limit works', function(done) {
|
||||||
sharp(fixtures.inputPngLarge)
|
sharp(fixtures.inputJpgLarge)
|
||||||
.limitInputPixels(false)
|
.limitInputPixels(false)
|
||||||
.resize(2)
|
.resize(2)
|
||||||
.toBuffer(function(err) {
|
.toBuffer(function(err) {
|
||||||
@ -886,8 +886,8 @@ describe('Input/output', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Enabling default limit fails works and fails with a large image', function(done) {
|
it('Enabling default limit works and fails with a large image', function(done) {
|
||||||
sharp(fixtures.inputPngLarge)
|
sharp(fixtures.inputJpgLarge)
|
||||||
.limitInputPixels(true)
|
.limitInputPixels(true)
|
||||||
.toBuffer(function(err) {
|
.toBuffer(function(err) {
|
||||||
assert.strictEqual(true, !!err);
|
assert.strictEqual(true, !!err);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user