diff --git a/packages/av-canvas/src/__tests__/__snapshots__/utils.test.ts.snap b/packages/av-canvas/src/__tests__/__snapshots__/utils.test.ts.snap index 07fd4fb5..ee165cc7 100644 --- a/packages/av-canvas/src/__tests__/__snapshots__/utils.test.ts.snap +++ b/packages/av-canvas/src/__tests__/__snapshots__/utils.test.ts.snap @@ -2,50 +2,14 @@ exports[`ctrls 1`] = ` { - "b": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "l": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "lb": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "lt": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "r": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "rb": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "rotate": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "rt": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, - "t": Le { - "fixedAspectRatio": false, - "fixedScaleCenter": false, - "on": [Function], - }, + "b": "{x: -8, y: 42, w: 16, h: 16}", + "l": "{x: -58, y: -8, w: 16, h: 16}", + "lb": "{x: -58, y: 42, w: 16, h: 16}", + "lt": "{x: -58, y: -58, w: 16, h: 16}", + "r": "{x: 42, y: -8, w: 16, h: 16}", + "rb": "{x: 42, y: 42, w: 16, h: 16}", + "rotate": "{x: -12, y: -94, w: 24, h: 24}", + "rt": "{x: 42, y: -58, w: 16, h: 16}", + "t": "{x: -8, y: -58, w: 16, h: 16}", } `; diff --git a/packages/av-canvas/src/__tests__/utils.test.ts b/packages/av-canvas/src/__tests__/utils.test.ts index 52b10589..d892b2d9 100644 --- a/packages/av-canvas/src/__tests__/utils.test.ts +++ b/packages/av-canvas/src/__tests__/utils.test.ts @@ -16,7 +16,12 @@ afterAll(() => { test('ctrls', () => { const rect = new Rect(0, 0, 100, 100); - expect(rectCtrlsGetter(rect)).toMatchSnapshot(); + const ctrls = rectCtrlsGetter(rect); + expect( + Object.fromEntries( + Object.entries(ctrls).map(([key, ctrl]) => [key, stringifyRect(ctrl)]), + ), + ).toMatchSnapshot(); }); // 固定比例后,ctrls 将移除 t,b,l,r 控制点 @@ -42,3 +47,7 @@ test('fixedAspectRatio', () => { 'rotate', ]); }); + +function stringifyRect(rect: Rect) { + return `{x: ${rect.x}, y: ${rect.y}, w: ${rect.w}, h: ${rect.h}}`; +}