diff --git a/packages/g6-ssr/__tests__/assets/file.pdf b/packages/g6-ssr/__tests__/assets/file.pdf index 4a3970521a4..86cd0f6d8a2 100644 Binary files a/packages/g6-ssr/__tests__/assets/file.pdf and b/packages/g6-ssr/__tests__/assets/file.pdf differ diff --git a/packages/g6-ssr/__tests__/assets/file.svg b/packages/g6-ssr/__tests__/assets/file.svg index 54191ac1ea6..1b36cb14526 100644 --- a/packages/g6-ssr/__tests__/assets/file.svg +++ b/packages/g6-ssr/__tests__/assets/file.svg @@ -1,132 +1,132 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/g6-ssr/__tests__/assets/image.jpeg b/packages/g6-ssr/__tests__/assets/image.jpeg index 36f3e1643ee..8055d9cb0e5 100644 Binary files a/packages/g6-ssr/__tests__/assets/image.jpeg and b/packages/g6-ssr/__tests__/assets/image.jpeg differ diff --git a/packages/g6-ssr/__tests__/assets/image.png b/packages/g6-ssr/__tests__/assets/image.png index cb29896f0d2..55bbbf03289 100644 Binary files a/packages/g6-ssr/__tests__/assets/image.png and b/packages/g6-ssr/__tests__/assets/image.png differ diff --git a/packages/g6-ssr/__tests__/assets/image_x1.jpeg b/packages/g6-ssr/__tests__/assets/image_x1.jpeg new file mode 100644 index 00000000000..36f3e1643ee Binary files /dev/null and b/packages/g6-ssr/__tests__/assets/image_x1.jpeg differ diff --git a/packages/g6-ssr/__tests__/assets/image_x2.jpeg b/packages/g6-ssr/__tests__/assets/image_x2.jpeg deleted file mode 100644 index 8055d9cb0e5..00000000000 Binary files a/packages/g6-ssr/__tests__/assets/image_x2.jpeg and /dev/null differ diff --git a/packages/g6-ssr/__tests__/graph.spec.ts b/packages/g6-ssr/__tests__/graph.spec.ts index b3b1162b806..b632b003447 100644 --- a/packages/g6-ssr/__tests__/graph.spec.ts +++ b/packages/g6-ssr/__tests__/graph.spec.ts @@ -216,11 +216,11 @@ describe('createGraph', () => { }); it('devicePixelRatio', async () => { - const graph = await fn('image', 'jpeg', { devicePixelRatio: 2 }); + const graph = await fn('image', 'jpeg', { devicePixelRatio: 1 }); - expect(graph).toMatchFile('./assets/image_x2.jpeg'); + expect(graph).toMatchFile('./assets/image_x1.jpeg'); - graph.exportToFile(join(__dirname, './assets/image_x2')); + graph.exportToFile(join(__dirname, './assets/image_x1')); graph.destroy(); }); diff --git a/packages/g6-ssr/src/canvas.ts b/packages/g6-ssr/src/canvas.ts index b42498d9508..9f3f3fe6e14 100644 --- a/packages/g6-ssr/src/canvas.ts +++ b/packages/g6-ssr/src/canvas.ts @@ -12,7 +12,7 @@ import type { Options } from './types'; * @returns [G6 画布, NodeCanvas 画布] | [G6Canvas, NodeCanvas] */ export function createCanvas(options: Options): [G6Canvas, NodeCanvas] { - const { width, height, background, outputType, devicePixelRatio = 1 } = options; + const { width, height, background, outputType, devicePixelRatio = 2 } = options; const nodeCanvas = createNodeCanvas(width, height, outputType as any); const offscreenNodeCanvas = createNodeCanvas(1, 1);