Files
cocos4/tests/particle/renderer.test.ts
T
minggo 95a76235b6 Adjust some files (#12910)
`cocos/core` should not depend other modules, so move some files out of `cocos/core`:
- move some files from `cocos/core` to `cocos/game`
  - director.ts
  - splash-screen.ts
  - game.ts
 - move `cocos/core/root.ts` to `cocos/root.ts` as there is not better module to contain `root.ts`.
 - move `cocos/core/platform/view.ts` to `cocos/ui/view.ts` as screen related logic is moved to `cocos/core/platform/screen.ts`
2022-09-28 09:34:35 +08:00

26 lines
915 B
TypeScript

import { director, game } from "../../cocos/game";
import { containerManager } from "../../cocos/core/memop/container-manager";
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 = containerManager._pools.length;
const comp = node.addComponent(ParticleSystem);
game.step();
// @ts-expect-error access private property
const currentLength = containerManager._pools.length;
expect(currentLength).toBeGreaterThan(beforeLength);
comp.destroy();
game.step();
// @ts-expect-error
expect(containerManager._pools.length).toBeLessThan(currentLength);
});