diff --git a/__test__/index.spec.ts b/__test__/index.spec.ts index 3d427064..bb4f73a2 100755 --- a/__test__/index.spec.ts +++ b/__test__/index.spec.ts @@ -87,25 +87,25 @@ test('svg to RGBA pixels Array', async (t) => { }) test('fit to width', async (t) => { - const filePath = '../example/text.svg' + const filePath = '../example/bbox.svg' const svg = await fs.readFile(join(__dirname, filePath)) const resvg = new Resvg(svg, { background: '#eeebe6', fitTo: { mode: 'width', - value: 1200, + value: 800, }, }) const pngData = resvg.render() const pngBuffer = pngData.asPng() const result = await jimp.read(pngBuffer) - t.is(result.getWidth(), 1200) - t.is(result.getHeight(), 623) + t.is(result.getWidth(), 800) + t.is(result.getHeight(), 1156) }) test('fit to height', async (t) => { - const filePath = '../example/text.svg' + const filePath = '../example/bbox.svg' const svg = await fs.readFile(join(__dirname, filePath)) const resvg = new Resvg(svg, { background: '#eeebe6', @@ -118,23 +118,23 @@ test('fit to height', async (t) => { const pngBuffer = pngData.asPng() const result = await jimp.read(pngBuffer) - t.is(result.getWidth(), 1003) + t.is(result.getWidth(), 360) t.is(result.getHeight(), 520) }) test('Get SVG original size', async (t) => { - const filePath = '../example/text.svg' + const filePath = '../example/bbox.svg' const svg = await fs.readFile(join(__dirname, filePath)) const resvg = new Resvg(svg, { background: '#eeebe6', fitTo: { mode: 'width', - value: 1200, // The original size is not affected by the fitTo parameter + value: 600, // The original size is not affected by the fitTo parameter }, }) - t.is(resvg.width, 1324) - t.is(resvg.height, 687) + t.is(resvg.width, 180) + t.is(resvg.height, 260) }) test('SVG size must be rounded to an integer', (t) => { diff --git a/__test__/wasm.spec.ts b/__test__/wasm.spec.ts index d67a736e..cdd6c054 100755 --- a/__test__/wasm.spec.ts +++ b/__test__/wasm.spec.ts @@ -101,14 +101,14 @@ test('buffer input', async (t) => { }) test('fit to width', async (t) => { - const filePath = '../example/text.svg' + const filePath = '../example/bbox.svg' const svg = await fs.readFile(join(__dirname, filePath)) const svgString = svg.toString('utf-8') const opts = { background: '#eeebe6', fitTo: { mode: 'width', - value: 1200, + value: 800, }, } const resvg = new Resvg(svgString, opts) @@ -116,12 +116,12 @@ test('fit to width', async (t) => { const pngBuffer = pngData.asPng() const result = await jimp.read(Buffer.from(pngBuffer)) - t.is(result.getWidth(), 1200) - t.is(result.getHeight(), 623) + t.is(result.getWidth(), 800) + t.is(result.getHeight(), 1156) }) test('fit to height', async (t) => { - const filePath = '../example/text.svg' + const filePath = '../example/bbox.svg' const svg = await fs.readFile(join(__dirname, filePath)) const svgString = svg.toString('utf-8') const opts = { @@ -136,23 +136,23 @@ test('fit to height', async (t) => { const pngBuffer = pngData.asPng() const result = await jimp.read(Buffer.from(pngBuffer)) - t.is(result.getWidth(), 1003) + t.is(result.getWidth(), 360) t.is(result.getHeight(), 520) }) test('Get SVG original size', async (t) => { - const filePath = '../example/text.svg' + const filePath = '../example/bbox.svg' const svg = await fs.readFile(join(__dirname, filePath)) const resvg = new Resvg(svg, { background: '#eeebe6', fitTo: { mode: 'width', - value: 1200, // The original size is not affected by the fitTo parameter + value: 600, // The original size is not affected by the fitTo parameter }, }) - t.is(resvg.width, 1324) - t.is(resvg.height, 687) + t.is(resvg.width, 180) + t.is(resvg.height, 260) }) test('SVG size must be rounded to an integer', (t) => {