mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
32c08e73f9
* merge `container-manager.ts` and `scalable-container.ts` * rename `ContainerManager` to `ScalableContainerManager` * rename `containerManager` to `scalableContainerManager`
24 lines
942 B
TypeScript
24 lines
942 B
TypeScript
import { director, game } from "../../cocos/game";
|
|
import { scalableContainerManager } from "../../cocos/core/memop/scalable-container";
|
|
import { Node, Scene } from "../../cocos/scene-graph";
|
|
import { ParticleSystem } from "../../exports/particle";
|
|
|
|
test('recycle pool release', () => {
|
|
const scene = new Scene('test-scene');
|
|
director.runSceneImmediate(scene);
|
|
const node = new Node();
|
|
scene.addChild(node);
|
|
game.step();
|
|
// @ts-expect-error access private property
|
|
const beforeLength = scalableContainerManager._pools.length;
|
|
const comp = node.addComponent(ParticleSystem);
|
|
game.step();
|
|
// @ts-expect-error access private property
|
|
const currentLength = scalableContainerManager._pools.length;
|
|
expect(currentLength).toBeGreaterThan(beforeLength);
|
|
comp.destroy();
|
|
game.step();
|
|
|
|
// @ts-expect-error
|
|
expect(scalableContainerManager._pools.length).toBeLessThan(currentLength);
|
|
}); |