Skip to content

Commit ee8a9f3

Browse files
committed
test: fix failed unit
1 parent c6e4ebb commit ee8a9f3

File tree

2 files changed

+19
-46
lines changed

2 files changed

+19
-46
lines changed

packages/av-canvas/src/__tests__/__snapshots__/utils.test.ts.snap

Lines changed: 9 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,14 @@
22

33
exports[`ctrls 1`] = `
44
{
5-
"b": Le {
6-
"fixedAspectRatio": false,
7-
"fixedScaleCenter": false,
8-
"on": [Function],
9-
},
10-
"l": Le {
11-
"fixedAspectRatio": false,
12-
"fixedScaleCenter": false,
13-
"on": [Function],
14-
},
15-
"lb": Le {
16-
"fixedAspectRatio": false,
17-
"fixedScaleCenter": false,
18-
"on": [Function],
19-
},
20-
"lt": Le {
21-
"fixedAspectRatio": false,
22-
"fixedScaleCenter": false,
23-
"on": [Function],
24-
},
25-
"r": Le {
26-
"fixedAspectRatio": false,
27-
"fixedScaleCenter": false,
28-
"on": [Function],
29-
},
30-
"rb": Le {
31-
"fixedAspectRatio": false,
32-
"fixedScaleCenter": false,
33-
"on": [Function],
34-
},
35-
"rotate": Le {
36-
"fixedAspectRatio": false,
37-
"fixedScaleCenter": false,
38-
"on": [Function],
39-
},
40-
"rt": Le {
41-
"fixedAspectRatio": false,
42-
"fixedScaleCenter": false,
43-
"on": [Function],
44-
},
45-
"t": Le {
46-
"fixedAspectRatio": false,
47-
"fixedScaleCenter": false,
48-
"on": [Function],
49-
},
5+
"b": "{x: -8, y: 42, w: 16, h: 16}",
6+
"l": "{x: -58, y: -8, w: 16, h: 16}",
7+
"lb": "{x: -58, y: 42, w: 16, h: 16}",
8+
"lt": "{x: -58, y: -58, w: 16, h: 16}",
9+
"r": "{x: 42, y: -8, w: 16, h: 16}",
10+
"rb": "{x: 42, y: 42, w: 16, h: 16}",
11+
"rotate": "{x: -12, y: -94, w: 24, h: 24}",
12+
"rt": "{x: 42, y: -58, w: 16, h: 16}",
13+
"t": "{x: -8, y: -58, w: 16, h: 16}",
5014
}
5115
`;

packages/av-canvas/src/__tests__/utils.test.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ afterAll(() => {
1616
test('ctrls', () => {
1717
const rect = new Rect(0, 0, 100, 100);
1818

19-
expect(rectCtrlsGetter(rect)).toMatchSnapshot();
19+
const ctrls = rectCtrlsGetter(rect);
20+
expect(
21+
Object.fromEntries(
22+
Object.entries(ctrls).map(([key, ctrl]) => [key, stringifyRect(ctrl)]),
23+
),
24+
).toMatchSnapshot();
2025
});
2126

2227
// 固定比例后,ctrls 将移除 t,b,l,r 控制点
@@ -42,3 +47,7 @@ test('fixedAspectRatio', () => {
4247
'rotate',
4348
]);
4449
});
50+
51+
function stringifyRect(rect: Rect) {
52+
return `{x: ${rect.x}, y: ${rect.y}, w: ${rect.w}, h: ${rect.h}}`;
53+
}

0 commit comments

Comments
 (0)