mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
bd3c30fd4c
* VB cache add(only simple) * sliced add * after rebase * Extract BufferAccessor from MeshBuffer * Refactor for linear buffer accessor * Support simple sprite * Fix initialization issues * Fix simple sprite rendering * Rough adaptation * tweaks * Fix LinearBufferAccessor's appendBuffers * Cleanup mesh buffer codes * Reorganize ia allocation * Middleware adaptation & Particle 2d adaptation (#31) * Middleware adaptation * particle-2d adaptation * Initial implementation of static vb accessor * Complete static vb accessor * Improve static vb accessor * Ensure MeshBuffer.byteOffset * Fix record batch process in static vb accessor * Fix vb reset * simple & simple label add (#32) * Meshbuffer static length (#33) * set ib only first time * Meshbuffer static length * Some name refactor * remove RenderData.vData * Improve buffer update logics * Use appendIndices in fillBuffers * The quickest version(simple & label can render) (#34) * Revert "Use appendIndices in fillBuffers" This reverts commit 0600e26f7eee277c820c3097b1f48f79fcf60890. * the quickest version * pass renderScene * batch * change batcher update Co-authored-by: pandamicro <lphuabin@gmail.com> * Move ia record logic from accessor to batcher * Make vertexFormat sourced from render data * sliced & bar-filled (#35) * radial-filled & tiled & label (#36) * radial-filled & tiled * bmfont & char label * function change * name change * Remove uvDirty fixes Fix uv update for sprite * Reduce mesh buffer setDirty * uv fix * Format label * Refactor color and cascade opacity mechanism * Fix empty render data or chunk absent issue * fix some uv (#37) * Fix non stop allocation issue in static vb accessor * fix bmfont richText & remove uiComponent (#38) * fix bmfont uv * fix richText & remove ui Component * Fix mesh render data batching * Small fix * Update for spine * Formatting jsb spine and editor * middle ware & particle 2d (#39) * motion-streak * dragon Bones add * tiled map unsafe change * particle-2d add * function name change * some function change (#40) * Fix RenderData pool usage * Fix merge issue * fix misc bug (#41) * Native adaptation for spine and dragonbones with MeshRenderData * misc fix (#42) * Improvements * Fix ci and improvements Co-authored-by: ChiaNing <sun.cloud.mo@gmail.com>
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
import { Node, Scene } from "../../cocos/core/scene-graph"
|
|
import { Vec3 } from "../../cocos/core/math"
|
|
import { director } from "../../cocos/core";
|
|
import { NodeEventType } from "../../cocos/core/scene-graph/node-event";
|
|
import { NodeUIProperties } from "../../cocos/core/scene-graph/node-ui-properties";
|
|
|
|
describe(`Node`, () => {
|
|
|
|
test('@inverseTransformPoint', () => {
|
|
let scene = new Scene('temp');
|
|
let parentNode = new Node();
|
|
let subNode = new Node();
|
|
parentNode.setPosition(20, -30, 100);
|
|
subNode.setPosition(55, 35, 22);
|
|
parentNode.parent = scene;
|
|
subNode.parent = parentNode;
|
|
let p = new Vec3(100, 200, 0);
|
|
subNode.inverseTransformPoint(p, p);
|
|
expect(p).toStrictEqual(new Vec3(25, 195, -122));
|
|
});
|
|
|
|
test('active-in-hierarchy-changed', () => {
|
|
const scene = new Scene('');
|
|
director.runSceneImmediate(scene);
|
|
const node = new Node();
|
|
const cb = jest.fn((node: Node) => {
|
|
expect(node.activeInHierarchy).toBeTruthy();
|
|
});
|
|
node.once(NodeEventType.ACTIVE_IN_HIERARCHY_CHANGED, cb);
|
|
scene.addChild(node);
|
|
|
|
const cb1 = jest.fn((node: Node) => {
|
|
expect(node.activeInHierarchy).toBeFalsy();
|
|
});
|
|
node.once(NodeEventType.ACTIVE_IN_HIERARCHY_CHANGED, cb1);
|
|
node.active = false;
|
|
node.once(NodeEventType.ACTIVE_IN_HIERARCHY_CHANGED, cb);
|
|
node.active = true;
|
|
|
|
const node2 = new Node();
|
|
scene.addChild(node2);
|
|
node2.active = false;
|
|
node.once(NodeEventType.ACTIVE_IN_HIERARCHY_CHANGED, cb1);
|
|
node2.addChild(node);
|
|
|
|
node.once(NodeEventType.ACTIVE_IN_HIERARCHY_CHANGED, cb);
|
|
node.setParent(scene);
|
|
expect(cb).toBeCalledTimes(3);
|
|
expect(cb1).toBeCalledTimes(2);
|
|
});
|
|
});
|