mirror of https://github.com/axmolengine/axmol.git
Add test case for reproducing Repeat bug
This commit is contained in:
parent
90cea76008
commit
b8f9b1f20b
|
@ -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()
|
||||||
|
|
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue