Skip to content

Commit 620f8c6

Browse files
authored
Test/texture contain resize (#720)
2 parents cd9ee5c + 739b393 commit 620f8c6

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

examples/tests/resize-mode.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,53 @@ export default async function test(settings: ExampleSettings) {
362362
return rowNode.h;
363363
},
364364
},
365+
{
366+
title:
367+
'Texture Width > Height - resizeMode cover - update height after 20ms',
368+
content: async (rowNode) => {
369+
const curX = 0;
370+
const containerProps = {
371+
w: SQUARE_SIZE * 1.4,
372+
h: SQUARE_SIZE * 1.4,
373+
parent: rowNode,
374+
color: 0x333333ff,
375+
clipping: true,
376+
} satisfies Partial<INodeProps>;
377+
378+
const textureNodeProps = {
379+
w: containerProps.w,
380+
h: containerProps.h,
381+
texture: renderer.createTexture('ImageTexture', {
382+
src: testscreenImg,
383+
}),
384+
textureOptions: {
385+
resizeMode: {
386+
type: 'cover',
387+
},
388+
},
389+
} satisfies Partial<INodeProps>;
390+
391+
const container1 = renderer.createNode({
392+
...containerProps,
393+
x: curX,
394+
});
395+
396+
const node = renderer.createNode({
397+
...textureNodeProps,
398+
parent: container1,
399+
});
400+
401+
// Add 150 to the h of the node after 20ms
402+
403+
setTimeout(() => {
404+
node.h += 200;
405+
}, 10);
406+
407+
rowNode.h = containerProps.h + 200;
408+
await new Promise((resolve) => setTimeout(resolve, 20));
409+
return rowNode.h;
410+
},
411+
},
365412
]);
366413

367414
return pageContainer;
64 KB
Loading

0 commit comments

Comments
 (0)