Skip to content

Commit

Permalink
Speed up slow pixel limit tests (#404)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
felixbuenemann authored and lovell committed Apr 8, 2016
1 parent b224874 commit 1b7c581
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Binary file added test/fixtures/giant-image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed test/fixtures/giant-image.png
Binary file not shown.
2 changes: 1 addition & 1 deletion test/fixtures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module.exports = {
inputJpgWithCmykNoProfile: getPath('Channel_digital_image_CMYK_color_no_profile.jpg'),
inputJpgWithCorruptHeader: getPath('corrupt-header.jpg'),
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
inputPngWithTransparency: getPath('blackbug.png'), // public domain
Expand All @@ -79,7 +80,6 @@ module.exports = {
inputPngOverlayLayer2LowAlpha: getPath('alpha-layer-2-ink-low-alpha.png'),
inputPngAlphaPremultiplicationSmall: getPath('alpha-premultiply-1024x768-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
inputWebPWithTransparency: getPath('5_webp_a.webp'), // http://www.gstatic.com/webp/gallery3/5_webp_a.webp
Expand Down
6 changes: 3 additions & 3 deletions test/unit/io.js
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ describe('Input/output', function() {
});

it('Disabling limit works', function(done) {
sharp(fixtures.inputPngLarge)
sharp(fixtures.inputJpgLarge)
.limitInputPixels(false)
.resize(2)
.toBuffer(function(err) {
Expand All @@ -886,8 +886,8 @@ describe('Input/output', function() {
});
});

it('Enabling default limit fails works and fails with a large image', function(done) {
sharp(fixtures.inputPngLarge)
it('Enabling default limit works and fails with a large image', function(done) {
sharp(fixtures.inputJpgLarge)
.limitInputPixels(true)
.toBuffer(function(err) {
assert.strictEqual(true, !!err);
Expand Down

0 comments on commit 1b7c581

Please sign in to comment.