mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 11:00:14 +02:00
Tests: expect ranges for flaky text test
This commit is contained in:
parent
bdcf02695f
commit
7c1551bdc9
@ -44,13 +44,11 @@ describe('Text to image', function () {
|
|||||||
|
|
||||||
it('text with width and height', function (done) {
|
it('text with width and height', function (done) {
|
||||||
const output = fixtures.path('output.text-width-height.png');
|
const output = fixtures.path('output.text-width-height.png');
|
||||||
const maxWidth = 500;
|
|
||||||
const maxHeight = 500;
|
|
||||||
const text = sharp({
|
const text = sharp({
|
||||||
text: {
|
text: {
|
||||||
text: 'Hello, world!',
|
text: 'Hello, world!',
|
||||||
width: maxWidth,
|
width: 500,
|
||||||
height: maxHeight
|
height: 400
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!sharp.versions.pango) {
|
if (!sharp.versions.pango) {
|
||||||
@ -60,9 +58,9 @@ describe('Text to image', function () {
|
|||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(3, info.channels);
|
assert.strictEqual(3, info.channels);
|
||||||
assert.ok(inRange(info.width, 1, maxWidth + 5), `Actual width ${info.width}`);
|
assert.ok(inRange(info.width, 450, 550), `Actual width ${info.width}`);
|
||||||
assert.ok(inRange(info.height, 1, maxHeight + 5), `Actual height ${info.height}`);
|
assert.ok(inRange(info.height, 300, 450), `Actual height ${info.height}`);
|
||||||
assert.ok(info.textAutofitDpi > 0);
|
assert.ok(inRange(info.textAutofitDpi, 900, 1200), `Actual textAutofitDpi ${info.textAutofitDpi}`);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user