mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Merge branch 'master' into next
This commit is contained in:
@@ -532,6 +532,7 @@ test('EventAnimCurve', function () {
|
||||
animation.play('test');
|
||||
state.wrapMode = cc.WrapMode.Loop;
|
||||
state.repeatCount = Infinity;
|
||||
manager.update(0);
|
||||
manager.update(1.7);
|
||||
calls = [];
|
||||
manager.update(0.3);
|
||||
@@ -551,6 +552,7 @@ test('EventAnimCurve', function () {
|
||||
animation.play('test');
|
||||
state.wrapMode = cc.WrapMode.Loop;
|
||||
state.repeatCount = Infinity;
|
||||
manager.update(0);
|
||||
manager.update(1.7);
|
||||
calls = [];
|
||||
manager.update(0.5);
|
||||
@@ -570,6 +572,7 @@ test('EventAnimCurve', function () {
|
||||
animation.play('test');
|
||||
state.wrapMode = cc.WrapMode.Reverse;
|
||||
state.repeatCount = 1;
|
||||
manager.update(0);
|
||||
calls = [];
|
||||
manager.update(0.1);
|
||||
deepEqual(calls, [], 'should triggered no events if wrapMode is Reverse');
|
||||
@@ -626,6 +629,7 @@ test('EventAnimCurve', function () {
|
||||
animation.play('test');
|
||||
state.wrapMode = cc.WrapMode.PingPong;
|
||||
state.repeatCount = Infinity;
|
||||
manager.update(0);
|
||||
manager.update(1.7);
|
||||
calls = [];
|
||||
manager.update(0.5);
|
||||
@@ -653,6 +657,7 @@ test('EventAnimCurve', function () {
|
||||
animation.play('test');
|
||||
state.wrapMode = cc.WrapMode.PingPongReverse;
|
||||
state.repeatCount = Infinity;
|
||||
manager.update(0);
|
||||
manager.update(1.7);
|
||||
calls = [];
|
||||
manager.update(0.5);
|
||||
@@ -668,6 +673,7 @@ test('EventAnimCurve', function () {
|
||||
state.speed = -1;
|
||||
state.wrapMode = cc.WrapMode.Normal;
|
||||
state.repeatCount = Infinity;
|
||||
manager.update(0);
|
||||
calls = [];
|
||||
manager.update(0.5);
|
||||
deepEqual(calls, [
|
||||
@@ -684,6 +690,7 @@ test('EventAnimCurve', function () {
|
||||
state.speed = -1;
|
||||
state.wrapMode = cc.WrapMode.PingPongReverse;
|
||||
state.repeatCount = Infinity;
|
||||
manager.update(0);
|
||||
manager.update(1.7);
|
||||
calls = [];
|
||||
manager.update(0.5);
|
||||
@@ -773,6 +780,7 @@ test('EventAnimCurve', function () {
|
||||
animation.play('test');
|
||||
state.wrapMode = cc.WrapMode.PingPong;
|
||||
state.setTime(0);
|
||||
manager.update(0);
|
||||
calls = [];
|
||||
manager.update(1);
|
||||
manager.update(2);
|
||||
@@ -794,6 +802,7 @@ test('EventAnimCurve', function () {
|
||||
state.wrapMode = cc.WrapMode.LoopReverse;
|
||||
state.setTime(0);
|
||||
calls = [];
|
||||
manager.update(0);
|
||||
manager.update(2);
|
||||
deepEqual(calls, [
|
||||
{
|
||||
|
||||
@@ -165,6 +165,117 @@ test('disable component during onEnable', function () {
|
||||
childComp.onEnable.once('could re-enable component');
|
||||
});
|
||||
|
||||
test('change hierarchy during own deactivation', function () {
|
||||
var vendorError = cc.errorID;
|
||||
cc.errorID = new Callback();
|
||||
|
||||
var nodes1 = createNodes({
|
||||
preNode: {},
|
||||
testNode: {
|
||||
comps: cc.Component,
|
||||
},
|
||||
testNode2: {
|
||||
comps: cc.Component,
|
||||
},
|
||||
});
|
||||
nodes1.attachToScene();
|
||||
|
||||
cc.errorID.disable('Should allow change hierarchy during own deactivation');
|
||||
|
||||
nodes1.testNodeComps[0].onDisable = function() {
|
||||
this.node.parent = nodes1.preNode;
|
||||
};
|
||||
nodes1.testNode.active = false;
|
||||
|
||||
nodes1.testNode2Comps[0].onDisable = function() {
|
||||
this.node.parent = null;
|
||||
};
|
||||
nodes1.testNode2.active = false;
|
||||
|
||||
expect(0);
|
||||
|
||||
cc.errorID = vendorError;
|
||||
});
|
||||
|
||||
test('change hierarchy during parent\'s deactivation', function () {
|
||||
var vendorError = cc.errorID;
|
||||
cc.errorID = new Callback().enable();
|
||||
|
||||
var nodes = createNodes({
|
||||
parent1: {
|
||||
preNode: {},
|
||||
testNode1: {
|
||||
comps: cc.Component,
|
||||
},
|
||||
},
|
||||
parent2: {
|
||||
testNode2: {
|
||||
comps: cc.Component,
|
||||
},
|
||||
},
|
||||
parent3: {
|
||||
testNode3: {
|
||||
comps: cc.Component,
|
||||
},
|
||||
},
|
||||
});
|
||||
nodes.attachToScene();
|
||||
|
||||
nodes.testNode1Comps[0].onDisable = function() {
|
||||
this.node.parent = nodes.preNode;
|
||||
};
|
||||
nodes.parent1.active = false;
|
||||
cc.errorID.once('Should report error if change child');
|
||||
|
||||
nodes.testNode2Comps[0].onDisable = function() {
|
||||
this.node.parent = null;
|
||||
};
|
||||
nodes.parent2.active = false;
|
||||
cc.errorID.once('Should report error if detach child');
|
||||
|
||||
nodes.testNode3Comps[0].onDisable = function() {
|
||||
this.node.parent.addChild(new cc.Node());
|
||||
};
|
||||
nodes.parent3.active = false;
|
||||
cc.errorID.once('Should report error if add child');
|
||||
|
||||
cc.errorID = vendorError;
|
||||
});
|
||||
|
||||
test('set sibling index during onDisable', function () {
|
||||
var vendorError = cc.errorID;
|
||||
cc.errorID = new Callback().enable();
|
||||
|
||||
var nodes = createNodes({
|
||||
parent: {
|
||||
node1: {
|
||||
comps: cc.Component,
|
||||
},
|
||||
node: {}
|
||||
},
|
||||
node2: {
|
||||
comps: cc.Component,
|
||||
}
|
||||
});
|
||||
var node1Comp = nodes.node1Comps[0];
|
||||
var node2Comp = nodes.node2Comps[0];
|
||||
node1Comp.onDisable = function() {
|
||||
this.node.setSiblingIndex(1);
|
||||
};
|
||||
node2Comp.onDisable = function() {
|
||||
this.node.setSiblingIndex(0);
|
||||
};
|
||||
nodes.attachToScene();
|
||||
|
||||
nodes.parent.active = false;
|
||||
cc.errorID.once('Should report error when setting node\'s sibling index during its parent\'s deactivation');
|
||||
|
||||
cc.errorID.disable('Should allow setting node\'s sibling index during its deactivation');
|
||||
nodes.node2.active = false;
|
||||
|
||||
cc.errorID = vendorError;
|
||||
});
|
||||
|
||||
(function () {
|
||||
|
||||
// Test deactivate during activating or conversely
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
module('cc.path', SetupEngine);
|
||||
|
||||
test('dirname', function () {
|
||||
|
||||
ok(cc.path.dirname('aa/bb/cc') === 'aa/bb', 'get success');
|
||||
ok(cc.path.dirname('aa/bb/cc.png') === 'aa/bb', 'get success');
|
||||
ok(cc.path.dirname('aa/bb/cc/') === 'aa/bb/cc', 'get success');
|
||||
ok(cc.path.dirname('aa/bb/cc.png/ee.png') === 'aa/bb/cc.png', 'get success');
|
||||
ok(cc.path.dirname('D:\\aa\\bb') === 'D:\\aa', 'get success');
|
||||
ok(cc.path.dirname('aa/bb/.github/.gitignore') === 'aa/bb/.github', 'get success');
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user