2018-01-29 16:25:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2012-04-19 14:35:52 +08:00
|
|
|
#include "ActionManagerTest.h"
|
|
|
|
#include "../testResource.h"
|
|
|
|
#include "cocos2d.h"
|
|
|
|
|
2015-04-09 12:23:47 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
enum
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
kTagNode,
|
|
|
|
kTagGrossini,
|
2010-08-30 15:04:46 +08:00
|
|
|
kTagSequence,
|
2012-04-19 14:35:52 +08:00
|
|
|
};
|
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
ActionManagerTests::ActionManagerTests()
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(CrashTest);
|
|
|
|
ADD_TEST_CASE(LogicTest);
|
|
|
|
ADD_TEST_CASE(PauseTest);
|
|
|
|
ADD_TEST_CASE(StopActionTest);
|
|
|
|
ADD_TEST_CASE(StopAllActionsTest);
|
2015-05-28 15:52:49 +08:00
|
|
|
ADD_TEST_CASE(StopActionsByFlagsTest);
|
2015-04-03 14:31:03 +08:00
|
|
|
ADD_TEST_CASE(ResumeTest);
|
2016-06-29 08:08:56 +08:00
|
|
|
ADD_TEST_CASE(Issue14050Test);
|
2010-08-30 15:04:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// ActionManagerTest
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
ActionManagerTest::ActionManagerTest(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ActionManagerTest::~ActionManagerTest(void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-12-19 05:52:10 +08:00
|
|
|
std::string ActionManagerTest::title() const
|
2014-02-28 23:02:22 +08:00
|
|
|
{
|
|
|
|
return "ActionManager Test";
|
|
|
|
}
|
|
|
|
std::string ActionManagerTest::subtitle() const
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "No title";
|
2010-08-30 15:04:46 +08:00
|
|
|
}
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Test1
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
void CrashTest::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto child = Sprite::create(s_pathGrossini);
|
2012-10-23 17:48:50 +08:00
|
|
|
child->setPosition( VisibleRect::center() );
|
2015-04-03 14:31:03 +08:00
|
|
|
addChild(child, 1, kTagGrossini);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
//Sum of all action's duration is 1.5 second.
|
2013-06-20 14:17:10 +08:00
|
|
|
child->runAction(RotateBy::create(1.5f, 90));
|
|
|
|
child->runAction(Sequence::create(
|
|
|
|
DelayTime::create(1.4f),
|
|
|
|
FadeOut::create(1.1f),
|
2014-07-10 00:45:27 +08:00
|
|
|
nullptr)
|
2012-04-19 14:35:52 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
//After 1.5 second, self will be removed.
|
2015-04-03 14:31:03 +08:00
|
|
|
child->runAction(Sequence::create(
|
2013-06-20 14:17:10 +08:00
|
|
|
DelayTime::create(1.4f),
|
2013-07-16 03:43:22 +08:00
|
|
|
CallFunc::create( CC_CALLBACK_0(CrashTest::removeThis,this)),
|
2014-07-10 00:45:27 +08:00
|
|
|
nullptr)
|
2012-04-19 14:35:52 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
void CrashTest::removeThis()
|
|
|
|
{
|
2015-04-03 14:31:03 +08:00
|
|
|
auto child = getChildByTag(kTagGrossini);
|
|
|
|
child->removeChild(child, true);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
getTestSuite()->enterNextTest();
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string CrashTest::subtitle() const
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Test 1. Should not crash";
|
|
|
|
}
|
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Test2
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void LogicTest::onEnter()
|
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto grossini = Sprite::create(s_pathGrossini);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(grossini, 0, 2);
|
2012-10-23 17:48:50 +08:00
|
|
|
grossini->setPosition(VisibleRect::center());
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
grossini->runAction( Sequence::create(
|
2014-05-15 01:07:09 +08:00
|
|
|
MoveBy::create(1, Vec2(150,0)),
|
2013-07-16 03:43:22 +08:00
|
|
|
CallFuncN::create(CC_CALLBACK_1(LogicTest::bugMe,this)),
|
2014-07-10 00:45:27 +08:00
|
|
|
nullptr)
|
2012-04-19 14:35:52 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
void LogicTest::bugMe(Node* node)
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
node->stopAllActions(); //After this stop next action not working, if remove this stop everything is working
|
2013-06-20 14:17:10 +08:00
|
|
|
node->runAction(ScaleTo::create(2, 2));
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string LogicTest::subtitle() const
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
2012-04-19 14:35:52 +08:00
|
|
|
return "Logic test";
|
|
|
|
}
|
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PauseTest
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
void PauseTest::onEnter()
|
|
|
|
{
|
|
|
|
//
|
|
|
|
// This test MUST be done in 'onEnter' and not on 'init'
|
|
|
|
// otherwise the paused action will be resumed at 'onEnter' time
|
|
|
|
//
|
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto l = Label::createWithTTF("After 5 seconds grossini should move", "fonts/Thonburi.ttf", 16.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(l);
|
2014-08-28 11:41:18 +08:00
|
|
|
l->setPosition(VisibleRect::center().x, VisibleRect::top().y-75);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Also, this test MUST be done, after [super onEnter]
|
|
|
|
//
|
2013-08-16 16:05:27 +08:00
|
|
|
auto grossini = Sprite::create(s_pathGrossini);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(grossini, 0, kTagGrossini);
|
2012-10-23 17:48:50 +08:00
|
|
|
grossini->setPosition(VisibleRect::center() );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-05-15 01:07:09 +08:00
|
|
|
auto action = MoveBy::create(1, Vec2(150,0));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto director = Director::getInstance();
|
2013-07-23 08:25:44 +08:00
|
|
|
director->getActionManager()->addAction(action, grossini, true);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-10-04 00:38:36 +08:00
|
|
|
schedule( CC_SCHEDULE_SELECTOR(PauseTest::unpause), 3);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void PauseTest::unpause(float dt)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2014-10-04 00:38:36 +08:00
|
|
|
unschedule( CC_SCHEDULE_SELECTOR(PauseTest::unpause) );
|
2013-08-16 16:05:27 +08:00
|
|
|
auto node = getChildByTag( kTagGrossini );
|
|
|
|
auto director = Director::getInstance();
|
2013-07-23 08:25:44 +08:00
|
|
|
director->getActionManager()->resumeTarget(node);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string PauseTest::subtitle() const
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
return "Pause Test";
|
|
|
|
}
|
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// RemoveTest
|
|
|
|
//
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
2014-03-05 14:32:00 +08:00
|
|
|
void StopActionTest::onEnter()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto l = Label::createWithTTF("Should not crash", "fonts/Thonburi.ttf", 16.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(l);
|
2014-08-28 11:41:18 +08:00
|
|
|
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 75);
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2014-05-15 01:07:09 +08:00
|
|
|
auto pMove = MoveBy::create(2, Vec2(200, 0));
|
2014-03-05 14:32:00 +08:00
|
|
|
auto pCallback = CallFunc::create(CC_CALLBACK_0(StopActionTest::stopAction,this));
|
2014-07-10 00:45:27 +08:00
|
|
|
auto pSequence = Sequence::create(pMove, pCallback, nullptr);
|
2012-04-19 14:35:52 +08:00
|
|
|
pSequence->setTag(kTagSequence);
|
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto pChild = Sprite::create(s_pathGrossini);
|
2012-10-23 17:48:50 +08:00
|
|
|
pChild->setPosition( VisibleRect::center() );
|
2012-04-19 14:35:52 +08:00
|
|
|
|
|
|
|
addChild(pChild, 1, kTagGrossini);
|
|
|
|
pChild->runAction(pSequence);
|
|
|
|
}
|
|
|
|
|
2014-03-05 14:32:00 +08:00
|
|
|
void StopActionTest::stopAction()
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2013-08-16 16:05:27 +08:00
|
|
|
auto sprite = getChildByTag(kTagGrossini);
|
2013-07-24 06:20:22 +08:00
|
|
|
sprite->stopActionByTag(kTagSequence);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-03-05 14:32:00 +08:00
|
|
|
std::string StopActionTest::subtitle() const
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
2014-03-05 14:32:00 +08:00
|
|
|
return "Stop Action Test";
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2014-08-19 17:31:19 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// RemoveTest
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void StopAllActionsTest::onEnter()
|
|
|
|
{
|
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
|
|
|
auto l = Label::createWithTTF("Should stop scale & move after 4 seconds but keep rotate", "fonts/Thonburi.ttf", 16.0f);
|
|
|
|
addChild(l);
|
|
|
|
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 75) );
|
|
|
|
|
|
|
|
auto pMove1 = MoveBy::create(2, Vec2(200, 0));
|
|
|
|
auto pMove2 = MoveBy::create(2, Vec2(-200, 0));
|
|
|
|
auto pSequenceMove = Sequence::createWithTwoActions(pMove1, pMove2);
|
|
|
|
auto pRepeatMove = RepeatForever::create(pSequenceMove);
|
|
|
|
pRepeatMove->setTag(kTagSequence);
|
|
|
|
|
2014-10-09 17:19:43 +08:00
|
|
|
auto pScale1 = ScaleBy::create(2, 1.5f);
|
|
|
|
auto pScale2 = ScaleBy::create(2, 1.0f/1.5f);
|
2014-08-19 17:31:19 +08:00
|
|
|
auto pSequenceScale = Sequence::createWithTwoActions(pScale1, pScale2);
|
|
|
|
auto pRepeatScale = RepeatForever::create(pSequenceScale);
|
|
|
|
pRepeatScale->setTag(kTagSequence);
|
|
|
|
|
|
|
|
auto pRotate = RotateBy::create(2, 360);
|
|
|
|
auto pRepeatRotate = RepeatForever::create(pRotate);
|
|
|
|
|
|
|
|
auto pChild = Sprite::create(s_pathGrossini);
|
|
|
|
pChild->setPosition( VisibleRect::center() );
|
|
|
|
|
|
|
|
addChild(pChild, 1, kTagGrossini);
|
|
|
|
pChild->runAction(pRepeatMove);
|
|
|
|
pChild->runAction(pRepeatScale);
|
|
|
|
pChild->runAction(pRepeatRotate);
|
|
|
|
this->scheduleOnce((SEL_SCHEDULE)&StopAllActionsTest::stopAction, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StopAllActionsTest::stopAction(float time)
|
|
|
|
{
|
|
|
|
auto sprite = getChildByTag(kTagGrossini);
|
|
|
|
sprite->stopAllActionsByTag(kTagSequence);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string StopAllActionsTest::subtitle() const
|
|
|
|
{
|
|
|
|
return "Stop All Action Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-30 15:04:46 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// ResumeTest
|
|
|
|
//
|
2012-04-19 14:35:52 +08:00
|
|
|
//------------------------------------------------------------------
|
2014-02-28 23:02:22 +08:00
|
|
|
std::string ResumeTest::subtitle() const
|
2010-08-30 15:04:46 +08:00
|
|
|
{
|
|
|
|
return "Resume Test";
|
|
|
|
}
|
|
|
|
|
|
|
|
void ResumeTest::onEnter()
|
|
|
|
{
|
2010-09-02 15:15:45 +08:00
|
|
|
ActionManagerTest::onEnter();
|
2010-08-30 15:04:46 +08:00
|
|
|
|
2014-04-09 23:31:05 +08:00
|
|
|
auto l = Label::createWithTTF("Grossini only rotate/scale in 3 seconds", "fonts/Thonburi.ttf", 16.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
addChild(l);
|
2014-08-28 11:41:18 +08:00
|
|
|
l->setPosition(VisibleRect::center().x, VisibleRect::top().y - 75);
|
2010-08-30 15:04:46 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto pGrossini = Sprite::create(s_pathGrossini);
|
2010-08-30 15:04:46 +08:00
|
|
|
addChild(pGrossini, 0, kTagGrossini);
|
2012-10-23 17:48:50 +08:00
|
|
|
pGrossini->setPosition(VisibleRect::center());
|
2010-08-30 15:04:46 +08:00
|
|
|
|
2013-06-20 14:17:10 +08:00
|
|
|
pGrossini->runAction(ScaleBy::create(2, 2));
|
2010-08-30 15:04:46 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto director = Director::getInstance();
|
2013-07-23 08:25:44 +08:00
|
|
|
director->getActionManager()->pauseTarget(pGrossini);
|
2013-06-20 14:17:10 +08:00
|
|
|
pGrossini->runAction(RotateBy::create(2, 360));
|
2010-08-30 15:04:46 +08:00
|
|
|
|
2014-10-04 00:38:36 +08:00
|
|
|
this->schedule(CC_SCHEDULE_SELECTOR(ResumeTest::resumeGrossini), 3.0f);
|
2012-04-19 14:35:52 +08:00
|
|
|
}
|
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void ResumeTest::resumeGrossini(float time)
|
2012-04-19 14:35:52 +08:00
|
|
|
{
|
2014-10-04 00:38:36 +08:00
|
|
|
this->unschedule(CC_SCHEDULE_SELECTOR(ResumeTest::resumeGrossini));
|
2012-04-19 14:35:52 +08:00
|
|
|
|
2013-08-16 16:05:27 +08:00
|
|
|
auto pGrossini = getChildByTag(kTagGrossini);
|
|
|
|
auto director = Director::getInstance();
|
2013-07-23 08:25:44 +08:00
|
|
|
director->getActionManager()->resumeTarget(pGrossini);
|
2010-08-30 15:04:46 +08:00
|
|
|
}
|
2015-05-28 15:52:49 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// StopActionsByFlagsTest
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
void StopActionsByFlagsTest::onEnter()
|
|
|
|
{
|
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
|
|
|
auto l = Label::createWithTTF("Should stop scale & move after 4 seconds but keep rotate", "fonts/Thonburi.ttf", 16.0f);
|
|
|
|
addChild(l);
|
|
|
|
l->setPosition( Vec2(VisibleRect::center().x, VisibleRect::top().y - 75) );
|
|
|
|
|
|
|
|
auto pMove1 = MoveBy::create(2, Vec2(200, 0));
|
|
|
|
auto pMove2 = MoveBy::create(2, Vec2(-200, 0));
|
|
|
|
auto pSequenceMove = Sequence::createWithTwoActions(pMove1, pMove2);
|
|
|
|
auto pRepeatMove = RepeatForever::create(pSequenceMove);
|
|
|
|
pRepeatMove->setFlags(kMoveFlag | kRepeatForeverFlag);
|
|
|
|
|
|
|
|
auto pScale1 = ScaleBy::create(2, 1.5f);
|
|
|
|
auto pScale2 = ScaleBy::create(2, 1.0f/1.5f);
|
|
|
|
auto pSequenceScale = Sequence::createWithTwoActions(pScale1, pScale2);
|
|
|
|
auto pRepeatScale = RepeatForever::create(pSequenceScale);
|
|
|
|
pRepeatScale->setFlags(kScaleFlag | kRepeatForeverFlag);
|
|
|
|
|
|
|
|
auto pRotate = RotateBy::create(2, 360);
|
|
|
|
auto pRepeatRotate = RepeatForever::create(pRotate);
|
|
|
|
pRepeatRotate->setFlags(kRotateFlag | kRepeatForeverFlag);
|
|
|
|
|
|
|
|
auto pChild = Sprite::create(s_pathGrossini);
|
|
|
|
pChild->setPosition( VisibleRect::center() );
|
|
|
|
|
|
|
|
addChild(pChild, 1, kTagGrossini);
|
|
|
|
pChild->runAction(pRepeatMove);
|
|
|
|
pChild->runAction(pRepeatScale);
|
|
|
|
pChild->runAction(pRepeatRotate);
|
|
|
|
this->scheduleOnce((SEL_SCHEDULE)&StopActionsByFlagsTest::stopAction, 4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StopActionsByFlagsTest::stopAction(float time)
|
|
|
|
{
|
|
|
|
auto sprite = getChildByTag(kTagGrossini);
|
|
|
|
sprite->stopActionsByFlags(kMoveFlag | kScaleFlag);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string StopActionsByFlagsTest::subtitle() const
|
|
|
|
{
|
|
|
|
return "Stop All Actions By Flags Test";
|
|
|
|
}
|
2016-06-29 08:08:56 +08:00
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Issue14050Test
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
class SpriteIssue14050: public Sprite
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
SpriteIssue14050()
|
|
|
|
{
|
|
|
|
log("SpriteIssue14050::constructor");
|
|
|
|
}
|
|
|
|
virtual ~SpriteIssue14050()
|
|
|
|
{
|
|
|
|
log("SpriteIssue14050::destructor");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void Issue14050Test::onEnter()
|
|
|
|
{
|
|
|
|
ActionManagerTest::onEnter();
|
|
|
|
|
|
|
|
auto sprite = new (std::nothrow) SpriteIssue14050;
|
|
|
|
sprite->initWithFile("Images/grossini.png");
|
|
|
|
sprite->autorelease();
|
|
|
|
|
|
|
|
auto move = MoveBy::create(2, Vec2(100, 100));
|
|
|
|
sprite->runAction(move);
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string Issue14050Test::subtitle() const
|
|
|
|
{
|
|
|
|
return "Issue14050. Sprite should not leak.";
|
|
|
|
}
|