Skip to content

Commit

Permalink
Tests: allow range for text image dimensions
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Nov 4, 2023
1 parent 0bd1715 commit d206fd5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/unit/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const assert = require('assert');

const sharp = require('../../');
const fixtures = require('../fixtures');
const { inRange } = require('../../lib/is');

describe('Text to image', function () {
this.retries(3);
Expand Down Expand Up @@ -59,8 +60,8 @@ describe('Text to image', function () {
if (err) throw err;
assert.strictEqual('png', info.format);
assert.strictEqual(3, info.channels);
assert.ok(info.width <= maxWidth, `Actual width ${info.width}`);
assert.ok(info.height <= maxHeight, `Actual height ${info.height}`);
assert.ok(inRange(info.width, 1, maxWidth + 5), `Actual width ${info.width}`);
assert.ok(inRange(info.height, 1, maxHeight + 5), `Actual height ${info.height}`);
assert.ok(info.textAutofitDpi > 0);
done();
});
Expand Down

0 comments on commit d206fd5

Please sign in to comment.