From 3268dbc9fd53d2934f42c3ffe71502243854db3b Mon Sep 17 00:00:00 2001 From: geron-cn Date: Wed, 28 Jan 2015 02:12:09 +0800 Subject: [PATCH] add cpp-test for animation list and projected --- .../ActionTimelineTestScene.cpp | 81 +++++++++++++++++- .../ActionTimelineTestScene.h | 26 +++++- .../Resources/ActionTimeline/Animation.csb | Bin 0 -> 1164 bytes .../Resources/ActionTimeline/Animation.csd | 47 ++++++++++ .../ActionTimeline/Default/Button_Disable.png | Bin 0 -> 1111 bytes .../ActionTimeline/Default/Sprite.png | Bin 0 -> 1773 bytes .../ActionTimeline/TestAnimation.csb | Bin 0 -> 896 bytes .../ActionTimeline/TestAnimation.csd | 34 ++++++++ .../ActionTimeline/TestNullProjectNode.csb | Bin 0 -> 660 bytes .../ActionTimeline/TestNullProjectNode.csd | 28 ++++++ .../Resources/hd/ActionTimeline/Animation.csb | Bin 0 -> 1164 bytes .../Resources/hd/ActionTimeline/Animation.csd | 47 ++++++++++ .../ActionTimeline/Default/Button_Disable.png | Bin 0 -> 1111 bytes .../hd/ActionTimeline/Default/Sprite.png | Bin 0 -> 1773 bytes 14 files changed, 261 insertions(+), 2 deletions(-) create mode 100755 tests/cpp-tests/Resources/ActionTimeline/Animation.csb create mode 100755 tests/cpp-tests/Resources/ActionTimeline/Animation.csd create mode 100755 tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png create mode 100755 tests/cpp-tests/Resources/ActionTimeline/Default/Sprite.png create mode 100755 tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csb create mode 100755 tests/cpp-tests/Resources/ActionTimeline/TestAnimation.csd create mode 100755 tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csb create mode 100755 tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csd create mode 100755 tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csb create mode 100755 tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd create mode 100755 tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png create mode 100755 tests/cpp-tests/Resources/hd/ActionTimeline/Default/Sprite.png diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp index 14921367a6..97d12eef94 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.cpp @@ -34,7 +34,17 @@ Layer *CreateAnimationLayer(int index) case TEST_TIMELINE_PERFORMACE: pLayer = new (std::nothrow) TestTimelinePerformance(); break; + case TEST_TIMELINEACTION_ANIMATIONLIST: + pLayer = new (std::nothrow) TestTimelineAnimationList(); + break; + case TEST_TIMELINEPROJECTNODE: + pLayer = new (std::nothrow) TestTimelineProjectNode(); + break; + case TEST_PROJECTNODEFORSIMALATOR: + pLayer = new (std::nothrow) TestProjectNodeForSimulator; + break; default: + CCLOG("NONE OF THIS TEST LAYER"); break; } @@ -185,7 +195,8 @@ void ActionTimelineTestLayer::nextCallback(Ref *pSender) void ActionTimelineTestLayer::backCallback(Ref *pSender) { Scene *s = new (std::nothrow) ActionTimelineTestScene(); - s->addChild( BackAnimationTest() ); + auto a = BackAnimationTest(); + s->addChild( a); Director::getInstance()->replaceScene(s); s->release(); } @@ -324,3 +335,71 @@ std::string TestTimelinePerformance::title() const return "Test ActionTimeline performance"; } +// TestTimelineAnimationList +void TestTimelineAnimationList::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + Node* node = CSLoader::createNode("ActionTimeline/DemoPlayer.csb"); + ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/DemoPlayer.csb"); + action->addAnimationInfo({"stand", 0, 40}); + action->addAnimationInfo({"walk", 41, 81}); + node->runAction(action); + action->play("walk", true); + + node->setScale(0.2f); + node->setPosition(150,100); + addChild(node); +} + +std::string TestTimelineAnimationList::title() const +{ + return "Test ActionTimeline AnimationList"; +} + + +//TestTimelineProjectNode +//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame +void TestTimelineProjectNode::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + Node* node = CSLoader::createNode("ActionTimeline/TestAnimation.csb"); + ActionTimeline* action = CSLoader::createTimeline("ActionTimeline/TestAnimation.csb"); + + node->runAction(action); + action->gotoFrameAndPlay(0, true); + + node->setPosition(-300, -300); + addChild(node); +} + +std::string TestTimelineProjectNode::title() const +{ + return "Test ActionTimeline ProjectNode"; +} + +//TestProjectNodeForSimulator +//InnerActionFrame make InnerAction Play until action's duration or next InnerActionFrame +void TestProjectNodeForSimulator::onEnter() +{ + ActionTimelineTestLayer::onEnter(); + Node* node = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd"); + ActionTimeline* action = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestAnimation.csd"); + + node->runAction(action); + action->gotoFrameAndPlay(0, true); + + node->setPosition(-300, -300); + addChild(node); + + // test for when ProjectNode file lost + Node* lackProjectNodefileNode = CSLoader::getInstance()->createNodeWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd"); + ActionTimeline* lackProjectNodefileAction = cocostudio::timeline::ActionTimelineCache::getInstance()->createActionWithFlatBuffersForSimulator("ActionTimeline/TestNullProjectNode.csd"); + lackProjectNodefileNode->runAction(lackProjectNodefileAction); + lackProjectNodefileAction->gotoFrameAndPlay(0); + addChild(lackProjectNodefileNode); +} + +std::string TestProjectNodeForSimulator::title() const +{ + return "Test ProjectNode for Simalator"; +} diff --git a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h index 1e681aa4c4..141e60e296 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h +++ b/tests/cpp-tests/Classes/ExtensionsTest/CocoStudioActionTimelineTest/ActionTimelineTestScene.h @@ -25,7 +25,10 @@ enum { TEST_CHANGE_PLAY_SECTION, // TEST_TIMELINE_FRAME_EVENT, TEST_TIMELINE_PERFORMACE, - + TEST_TIMELINEACTION_ANIMATIONLIST, + TEST_TIMELINEPROJECTNODE, + TEST_PROJECTNODEFORSIMALATOR, + TEST_ANIMATION_LAYER_COUNT }; @@ -85,4 +88,25 @@ public: virtual std::string title() const override; }; +class TestTimelineAnimationList : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; +}; + +class TestTimelineProjectNode : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; +}; + +class TestProjectNodeForSimulator : public ActionTimelineTestLayer +{ +public: + virtual void onEnter(); + virtual std::string title() const override; +}; + #endif // __ANIMATION_SCENE_H__ diff --git a/tests/cpp-tests/Resources/ActionTimeline/Animation.csb b/tests/cpp-tests/Resources/ActionTimeline/Animation.csb new file mode 100755 index 0000000000000000000000000000000000000000..f64ece32db3cc0c7dc1dc57fea5d499f1c04739e GIT binary patch literal 1164 zcmZWoO-oxr6g`bG1{)=Ww~*o@ixgax*C-+`gapkZn@TZ1KthcY8hxTMf*bP_`~j|X z>q-!Jx@b23hyIArbu~R_?wjUGE}WVBX71Oyb6)@;k42=BMUGm41+L%<6k{xLAEfMT zhWbjl9G1f}HIonA`n>PFjz-@1iie7kCbpx!mMmqLlM>5y!oI|_fXEPyzjgVDH3%;wOK8@%Ty<% z28Rh&(Xuj#%v^-J0O4A|{>ExntF@wvUEeT%EA^{+IxvNzYQe{;={ z@_mbXZh~@T=Vx2~x>wzbCw+=Yb1*eW$@rg0M&EjCagn|gb(`IGbkz9SI_D=+M3GRw zJKAe6aJL-%pbX;kKW~}^lU^dWW_Oxs{AhMmuwvE;R$?X1M#Fw57s?x=sBuX3nA-=ovE_{vpvRS9MI&D=h&{C)rBcXxQO`SD@xS@pcH P#`^93tk+hL|9}1g)sBBT literal 0 HcmV?d00001 diff --git a/tests/cpp-tests/Resources/ActionTimeline/Animation.csd b/tests/cpp-tests/Resources/ActionTimeline/Animation.csd new file mode 100755 index 0000000000..f849e56513 --- /dev/null +++ b/tests/cpp-tests/Resources/ActionTimeline/Animation.csd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png b/tests/cpp-tests/Resources/ActionTimeline/Default/Button_Disable.png new file mode 100755 index 0000000000000000000000000000000000000000..62ee840c40d3f8defc9d735d97d463afb5413f2e GIT binary patch literal 1111 zcmbVL&ui0A91jfV7_J8|q7FS&wP740^=iUnbqCU0wK^TXtI&3f3T zFsJ?r9-RXb)PuLFY@nB+7ab@YC=)z*5Cp;DMe(I;H-)i-A<6r`@B4l}-yiS$y)`;~ zwyX0*Cx&5NnIS2MRuX-uJKE8Io9MWJmg7(^z%gqA))WU|3C$`3JYy)6AO{p}`sx}O zz_7NGo-e>c_PnTC2C4Wqq-WR&jbQ_Wo~@{50P!N2)Xg~Y?db}E>sp++6wT6EI|WMm zP~8Dz_2Il)FROw^44%OUJP{EX04lg=R7_X&;zWa2M6$1@2)tne%W+~Ss6uuWPgxGY zqhutk(hP(1JjrlTo@e@SmS$LrMlT;`I5EnLY(L(72;|MtCd8bSZu&yII8lPo7AdM$ ztC6(`X*rV=BM5@e!Lngw5q76dsCZ%1?P)Pcz*QaHhPq|qKBH2!sxVHVNOw{&>}+n9Z z(b1(S70FVo1~6epiWBIB)O1Zu@^p$#%4vpUX+Fj&C>Y9bkH6Zbr9wUEi@VK_HoM~kOf)kN8jc^zmvd;a<}*?v?`?kF z2nOcpBlDlkpcgwe)EDSJhQ$}~jbArjzCC1b>EBmAU!1-Bpc;Uw*anq`WxQ z3tw-JSMDu8TzLQH_H+1gwf<~ryU49x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Fzv$3^LPHTZ1`RT z9xRBjaxE(>GgQkeFMEuPjL0sivH6qy`Vzc!a9NQhtWG!t$vg^MoV}mYjpcc6#StE^ z8yUH~x<6@C(fj*ft`GGH9Gd6m=BB#1CvyHD#cpO(D)_q5&(f2kdeY~ZDZ7_ifjk{m zHU~SE1}@O=tH~VhwQP>6bSi9V?z}OF>k3@1Jk1EbAx4YtAC>EAirTU6>9Ym4WLIktaf?l)hNX{41S WkD^+(+0 zm;4g6RGxo_Llf7X(p(Gf-S{{n3nt`GKAmQ|Dl% ztT&7QEr9pT1NC<6tl4SBZ9lv`5+6R@6RheP6xXd)?q{ zI49O}yZrF}_v9uurLmk*4jDNk-Jg$sI2m&X-_}9i6->a$8YV!gss3w9*T>6 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csb b/tests/cpp-tests/Resources/ActionTimeline/TestNullProjectNode.csb new file mode 100755 index 0000000000000000000000000000000000000000..f0b88003572a5c613235078ad0b77a3a21644bd4 GIT binary patch literal 660 zcmZvZy-EW?6os#GjX_sXNMW(X7F$@zu#pHBLIQ4)N&}1-?Yn83 zSU24Zxe3?z%ja5IgnUo=vXn`2X3AN$8MpwNeGKNSyb z0?iEOY_^#Y&Qg}szqD~opU-93yz8%3?+5$%hCn-|4O#hQH>k<{wZoF + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csb b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csb new file mode 100755 index 0000000000000000000000000000000000000000..f64ece32db3cc0c7dc1dc57fea5d499f1c04739e GIT binary patch literal 1164 zcmZWoO-oxr6g`bG1{)=Ww~*o@ixgax*C-+`gapkZn@TZ1KthcY8hxTMf*bP_`~j|X z>q-!Jx@b23hyIArbu~R_?wjUGE}WVBX71Oyb6)@;k42=BMUGm41+L%<6k{xLAEfMT zhWbjl9G1f}HIonA`n>PFjz-@1iie7kCbpx!mMmqLlM>5y!oI|_fXEPyzjgVDH3%;wOK8@%Ty<% z28Rh&(Xuj#%v^-J0O4A|{>ExntF@wvUEeT%EA^{+IxvNzYQe{;={ z@_mbXZh~@T=Vx2~x>wzbCw+=Yb1*eW$@rg0M&EjCagn|gb(`IGbkz9SI_D=+M3GRw zJKAe6aJL-%pbX;kKW~}^lU^dWW_Oxs{AhMmuwvE;R$?X1M#Fw57s?x=sBuX3nA-=ovE_{vpvRS9MI&D=h&{C)rBcXxQO`SD@xS@pcH P#`^93tk+hL|9}1g)sBBT literal 0 HcmV?d00001 diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd new file mode 100755 index 0000000000..f849e56513 --- /dev/null +++ b/tests/cpp-tests/Resources/hd/ActionTimeline/Animation.csd @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png b/tests/cpp-tests/Resources/hd/ActionTimeline/Default/Button_Disable.png new file mode 100755 index 0000000000000000000000000000000000000000..62ee840c40d3f8defc9d735d97d463afb5413f2e GIT binary patch literal 1111 zcmbVL&ui0A91jfV7_J8|q7FS&wP740^=iUnbqCU0wK^TXtI&3f3T zFsJ?r9-RXb)PuLFY@nB+7ab@YC=)z*5Cp;DMe(I;H-)i-A<6r`@B4l}-yiS$y)`;~ zwyX0*Cx&5NnIS2MRuX-uJKE8Io9MWJmg7(^z%gqA))WU|3C$`3JYy)6AO{p}`sx}O zz_7NGo-e>c_PnTC2C4Wqq-WR&jbQ_Wo~@{50P!N2)Xg~Y?db}E>sp++6wT6EI|WMm zP~8Dz_2Il)FROw^44%OUJP{EX04lg=R7_X&;zWa2M6$1@2)tne%W+~Ss6uuWPgxGY zqhutk(hP(1JjrlTo@e@SmS$LrMlT;`I5EnLY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