diff --git a/__test__/draw.spec.ts b/__test__/draw.spec.ts
index d15733b1..e1ae4092 100644
--- a/__test__/draw.spec.ts
+++ b/__test__/draw.spec.ts
@@ -949,7 +949,7 @@ test('JPEG toDataURL with quality', async (t) => {
const output = canvas.toDataURL('image/jpeg', 20)
const prefix = 'data:image/jpeg;base64,'
t.true(output.startsWith(prefix))
- const imageBase64 = output.substr(prefix.length)
+ const imageBase64 = output.substring(prefix.length)
const pngBuffer = Buffer.from(imageBase64, 'base64')
t.deepEqual(pngBuffer, await canvas.encode('jpeg', 20))
})
@@ -961,7 +961,7 @@ test('WebP toDataURL with quality', async (t) => {
const output = canvas.toDataURL('image/webp', 100)
const prefix = 'data:image/webp;base64,'
t.true(output.startsWith(prefix))
- const imageBase64 = output.substr(prefix.length)
+ const imageBase64 = output.substring(prefix.length)
const pngBuffer = Buffer.from(imageBase64, 'base64')
t.deepEqual(pngBuffer, await canvas.encode('webp', 100))
})
@@ -972,7 +972,7 @@ test('toDataURLAsync', async (t) => {
const output = await canvas.toDataURLAsync()
const prefix = 'data:image/png;base64,'
t.true(output.startsWith(prefix))
- const imageBase64 = output.substr(prefix.length)
+ const imageBase64 = output.substring(prefix.length)
const pngBuffer = Buffer.from(imageBase64, 'base64')
t.deepEqual(pngBuffer, await canvas.encode('png'))
})
diff --git a/__test__/filter.spec.ts b/__test__/filter.spec.ts
index 81391aaf..c409432c 100644
--- a/__test__/filter.spec.ts
+++ b/__test__/filter.spec.ts
@@ -97,10 +97,10 @@ test('filter-saturate', async (t) => {
})
test('filter-sepia', async (t) => {
- const { ctx } = t.context
+ const { ctx, canvas } = t.context
ctx.filter = 'sepia(100%)'
ctx.drawImage(await createImage('filter-sepia.jpeg'), 0, 0)
- await snapshotImage(t)
+ await snapshotImage(t, { ctx, canvas }, 'png', 0.05)
})
test('filter-combine-contrast-brightness', async (t) => {
diff --git a/__test__/pathkit.spec.ts b/__test__/pathkit.spec.ts
index 5c3defd9..4d1d8641 100644
--- a/__test__/pathkit.spec.ts
+++ b/__test__/pathkit.spec.ts
@@ -2,6 +2,13 @@ import test from 'ava'
import { FillType, Path2D, PathOp, StrokeCap, StrokeJoin } from '../index'
+const AARCH64_NOT_MUSL = (function () {
+ // @ts-expect-error
+ const { header } = process.report?.getReport?.() ?? {}
+ const isGnuLinux = Boolean(header?.glibcVersionRuntime)
+ return process.arch === 'arm64' && ((process.platform === 'linux' && isGnuLinux) || process.platform === 'darwin')
+})()
+
test('should be able to call toSVGString', (t) => {
const path = new Path2D()
path.rect(0, 0, 100, 100)
@@ -170,7 +177,11 @@ test('Convert stroke to path', (t) => {
)
path.stroke({ width: 10, miterLimit: 1 }).simplify().asWinding()
- t.snapshot(path.toSVGString())
+ const expected = AARCH64_NOT_MUSL
+ ? `M57.6458 39.75L37.2942 4.5Q34.6962 -2.38419e-06 29.5 -2.38419e-06Q24.3038 -2.89876e-06 21.7058 4.5L1.35417 39.75Q-1.2439 44.25 1.35418 48.75Q3.95226 53.25 9.14841 53.25L49.8516 53.25Q55.0478 53.25 57.6458 48.75Q60.2439 44.25 57.6458 39.75ZM29.5 11L48.1195 43.25L10.8805 43.25L29.5 11Z`
+ : `M57.6458 39.75L37.2942 4.5Q34.6962 -2.38419e-06 29.5 -2.38419e-06Q24.3038 -2.90573e-06 21.7058 4.5L1.35417 39.75Q-1.2439 44.25 1.35418 48.75Q3.95226 53.25 9.14841 53.25L49.8516 53.25Q55.0478 53.25 57.6458 48.75Q60.2439 44.25 57.6458 39.75ZM29.5 11L48.1195 43.25L10.8805 43.25L29.5 11Z`
+
+ t.is(path.toSVGString(), expected)
})
test('Convert stroke to path 2', (t) => {
@@ -178,8 +189,10 @@ test('Convert stroke to path 2', (t) => {
path.stroke({ width: 10, join: StrokeJoin.Round, miterLimit: 1 }).simplify()
const svg = ``
-
- t.snapshot(svg)
+ const expected = AARCH64_NOT_MUSL
+ ? ``
+ : ``
+ t.is(svg, expected)
})
// 直角