Add test case for reproducing Repeat bug

This commit is contained in:
Ishiguro Yusuke 2014-05-27 15:40:38 +09:00
parent 90cea76008
commit b8f9b1f20b
2 changed files with 46 additions and 1 deletions

View File

@ -81,7 +81,8 @@ static std::function<Layer*()> createFunctions[] = {
CL(Issue1288), CL(Issue1288),
CL(Issue1288_2), CL(Issue1288_2),
CL(Issue1327), CL(Issue1327),
CL(Issue1398) CL(Issue1398),
CL(Issue2599)
}; };
static int sceneIdx=-1; static int sceneIdx=-1;
@ -2094,6 +2095,38 @@ std::string Issue1398::title() const
return "Issue 1398"; return "Issue 1398";
} }
void Issue2599::onEnter()
{
ActionsDemo::onEnter();
this->centerSprites(0);
_count = 0;
log("before: count = %d", _count);
log("start count up 50 times using Repeat action");
auto delay = 1.0f / 50;
auto repeatAction = Repeat::create(
Sequence::createWithTwoActions(
CallFunc::create([&](){ this->_count++; }),
DelayTime::create(delay)),
50);
this->runAction(
Sequence::createWithTwoActions(
repeatAction,
CallFunc::create([&]() { log("after: count = %d", this->_count); })
));
}
std::string Issue2599::subtitle() const
{
return "See console: You should see '50'";
}
std::string Issue2599::title() const
{
return "Issue 2599";
}
/** ActionCatmullRom /** ActionCatmullRom
*/ */
void ActionCatmullRom::onEnter() void ActionCatmullRom::onEnter()

View File

@ -564,6 +564,18 @@ private:
int _testInteger; int _testInteger;
}; };
class Issue2599 : public ActionsDemo
{
public:
CREATE_FUNC(Issue2599);
virtual void onEnter() override;
virtual std::string subtitle() const override;
virtual std::string title() const override;
private:
int _count;
};
class ActionCatmullRom : public ActionsDemo class ActionCatmullRom : public ActionsDemo
{ {
public: public: