2018-01-29 16:25:32 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-10-01 16:24:52 +08:00
|
|
|
https://axmolengine.github.io/
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
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:
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2018-01-29 16:25:32 +08:00
|
|
|
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.
|
|
|
|
****************************************************************************/
|
|
|
|
|
2010-09-09 16:15:21 +08:00
|
|
|
#ifndef _SCHEDULER_TEST_H_
|
|
|
|
#define _SCHEDULER_TEST_H_
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
2013-10-16 16:48:39 +08:00
|
|
|
#include "extensions/cocos-ext.h"
|
2013-06-12 07:30:05 +08:00
|
|
|
#include "../BaseTest.h"
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2015-04-03 14:31:03 +08:00
|
|
|
DEFINE_TEST_SUITE(SchedulerTests);
|
|
|
|
|
|
|
|
class SchedulerTestLayer : public TestCase
|
2010-09-09 16:15:21 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerAutoremove : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerAutoremove);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void autoremove(float dt);
|
|
|
|
void tick(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2010-09-09 16:15:21 +08:00
|
|
|
private:
|
2012-06-08 13:55:28 +08:00
|
|
|
float accum;
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerPauseResume : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerPauseResume);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
2014-08-15 12:06:16 +08:00
|
|
|
using SchedulerTestLayer::pause;
|
2012-06-08 13:55:28 +08:00
|
|
|
void pause(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
2012-06-12 18:12:45 +08:00
|
|
|
class SchedulerPauseResumeAll : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerPauseResumeAll);
|
|
|
|
|
2012-06-12 18:12:45 +08:00
|
|
|
SchedulerPauseResumeAll();
|
|
|
|
virtual ~SchedulerPauseResumeAll();
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float delta) override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-06-12 18:12:45 +08:00
|
|
|
|
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
2014-08-15 12:06:16 +08:00
|
|
|
using SchedulerTestLayer::pause;
|
2012-06-12 18:12:45 +08:00
|
|
|
void pause(float dt);
|
2014-08-15 12:06:16 +08:00
|
|
|
using SchedulerTestLayer::resume;
|
2012-06-12 18:12:45 +08:00
|
|
|
void resume(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2012-06-12 18:12:45 +08:00
|
|
|
private:
|
2014-02-20 14:11:47 +08:00
|
|
|
std::set<void*> _pausedTargets;
|
2012-06-12 18:12:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerPauseResumeAllUser : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerPauseResumeAllUser);
|
|
|
|
|
2012-06-12 18:12:45 +08:00
|
|
|
SchedulerPauseResumeAllUser();
|
|
|
|
virtual ~SchedulerPauseResumeAllUser();
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-06-12 18:12:45 +08:00
|
|
|
|
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
2014-08-15 12:06:16 +08:00
|
|
|
using SchedulerTestLayer::pause;
|
2012-06-12 18:12:45 +08:00
|
|
|
void pause(float dt);
|
2014-08-15 12:06:16 +08:00
|
|
|
using SchedulerTestLayer::resume;
|
2012-06-12 18:12:45 +08:00
|
|
|
void resume(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2012-06-12 18:12:45 +08:00
|
|
|
private:
|
2014-02-20 14:11:47 +08:00
|
|
|
std::set<void*> _pausedTargets;
|
2012-06-12 18:12:45 +08:00
|
|
|
};
|
|
|
|
|
2010-09-09 16:15:21 +08:00
|
|
|
class SchedulerUnscheduleAll : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerUnscheduleAll);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
|
|
|
void tick3(float dt);
|
|
|
|
void tick4(float dt);
|
|
|
|
void unscheduleAll(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerUnscheduleAllHard : public SchedulerTestLayer
|
|
|
|
{
|
2012-06-12 18:12:45 +08:00
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerUnscheduleAllHard);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2012-06-12 18:12:45 +08:00
|
|
|
|
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
|
|
|
void tick3(float dt);
|
|
|
|
void tick4(float dt);
|
|
|
|
void unscheduleAll(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2012-06-12 18:12:45 +08:00
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
bool _actionManagerActive;
|
2012-06-12 18:12:45 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerUnscheduleAllUserLevel : public SchedulerTestLayer
|
|
|
|
{
|
2010-09-09 16:15:21 +08:00
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerUnscheduleAllUserLevel);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
|
|
|
void tick3(float dt);
|
|
|
|
void tick4(float dt);
|
|
|
|
void unscheduleAll(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerSchedulesAndRemove : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerSchedulesAndRemove);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void tick1(float dt);
|
|
|
|
void tick2(float dt);
|
|
|
|
void tick3(float dt);
|
|
|
|
void tick4(float dt);
|
|
|
|
void scheduleAndUnschedule(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerUpdate : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerUpdate);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void removeUpdates(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerUpdateAndCustom : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerUpdateAndCustom);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
void update(float dt) override;
|
2012-06-08 13:55:28 +08:00
|
|
|
void tick(float dt);
|
|
|
|
void stopSelectors(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerUpdateFromCustom : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerUpdateFromCustom);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-09 16:15:21 +08:00
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
void update(float dt) override;
|
2012-06-08 13:55:28 +08:00
|
|
|
void schedUpdate(float dt);
|
|
|
|
void stopUpdate(float dt);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
class TestNode : public axis::Node
|
2010-09-09 16:15:21 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(TestNode);
|
|
|
|
|
2010-09-09 16:15:21 +08:00
|
|
|
~TestNode();
|
|
|
|
|
2021-12-28 15:58:56 +08:00
|
|
|
void initWithString(std::string_view str, int priority);
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2010-09-09 16:15:21 +08:00
|
|
|
private:
|
2013-12-18 16:03:07 +08:00
|
|
|
std::string _string;
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
2010-09-25 14:19:15 +08:00
|
|
|
class RescheduleSelector : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(RescheduleSelector);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2010-09-25 14:19:15 +08:00
|
|
|
|
2012-06-08 13:55:28 +08:00
|
|
|
void schedUpdate(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2010-09-25 14:19:15 +08:00
|
|
|
private:
|
2013-06-15 14:03:30 +08:00
|
|
|
float _interval;
|
2021-12-28 16:06:23 +08:00
|
|
|
int _ticks;
|
2010-09-25 14:19:15 +08:00
|
|
|
};
|
|
|
|
|
2012-04-18 13:58:24 +08:00
|
|
|
class SchedulerDelayAndRepeat : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerDelayAndRepeat);
|
|
|
|
|
2014-02-27 21:10:03 +08:00
|
|
|
virtual void onEnter() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2015-03-15 02:33:15 +08:00
|
|
|
void update(float dt) override;
|
2012-04-18 13:58:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class SchedulerTimeScale : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(SchedulerTimeScale);
|
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
void onEnter() override;
|
|
|
|
void onExit() override;
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::extension::ControlSlider* sliderCtl();
|
|
|
|
void sliderAction(axis::Ref* sender, axis::extension::Control::EventType controlEvent);
|
|
|
|
axis::extension::ControlSlider* _sliderCtl;
|
2012-04-18 13:58:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class TwoSchedulers : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
2013-11-14 07:55:36 +08:00
|
|
|
CREATE_FUNC(TwoSchedulers);
|
|
|
|
|
2012-04-18 13:58:24 +08:00
|
|
|
virtual ~TwoSchedulers();
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2015-03-15 02:33:15 +08:00
|
|
|
void onEnter() override;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::extension::ControlSlider* sliderCtl();
|
|
|
|
void sliderAction(axis::Ref* sender, axis::extension::Control::EventType controlEvent);
|
|
|
|
axis::Scheduler* sched1;
|
|
|
|
axis::Scheduler* sched2;
|
|
|
|
axis::ActionManager* actionManager1;
|
|
|
|
axis::ActionManager* actionManager2;
|
|
|
|
|
|
|
|
axis::extension::ControlSlider* sliderCtl1;
|
|
|
|
axis::extension::ControlSlider* sliderCtl2;
|
2012-04-18 13:58:24 +08:00
|
|
|
};
|
|
|
|
|
2013-03-29 21:48:35 +08:00
|
|
|
class SchedulerIssue2268 : public SchedulerTestLayer
|
|
|
|
{
|
2013-11-14 07:55:36 +08:00
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerIssue2268);
|
|
|
|
|
|
|
|
~SchedulerIssue2268();
|
2013-12-19 05:52:10 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2015-03-15 02:33:15 +08:00
|
|
|
void onEnter() override;
|
|
|
|
void update(float dt) override;
|
2013-11-14 07:55:36 +08:00
|
|
|
|
|
|
|
private:
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Node* testNode;
|
2013-03-29 21:48:35 +08:00
|
|
|
};
|
2012-04-18 13:58:24 +08:00
|
|
|
|
2017-05-04 16:24:20 +08:00
|
|
|
class SchedulerIssueWithReschedule : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerIssueWithReschedule);
|
|
|
|
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
void onEnter() override;
|
|
|
|
};
|
|
|
|
|
2014-03-01 13:30:20 +08:00
|
|
|
class ScheduleCallbackTest : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(ScheduleCallbackTest);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-03-01 13:30:20 +08:00
|
|
|
~ScheduleCallbackTest();
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2015-03-15 02:33:15 +08:00
|
|
|
void onEnter() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-03-01 13:30:20 +08:00
|
|
|
void callback(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2014-03-01 13:30:20 +08:00
|
|
|
private:
|
|
|
|
};
|
|
|
|
|
2014-05-29 13:51:43 +08:00
|
|
|
class ScheduleUpdatePriority : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(ScheduleUpdatePriority);
|
|
|
|
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
2015-03-15 02:33:15 +08:00
|
|
|
void onEnter() override;
|
|
|
|
void onExit() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
virtual void update(float dt) override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2022-07-11 17:50:21 +08:00
|
|
|
bool onTouchBegan(axis::Touch* touch, axis::Event* event);
|
2010-09-09 16:15:21 +08:00
|
|
|
};
|
|
|
|
|
2015-01-28 11:31:52 +08:00
|
|
|
class SchedulerIssue10232 : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerIssue10232);
|
|
|
|
|
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
|
2015-03-15 02:33:15 +08:00
|
|
|
void onEnter() override;
|
|
|
|
void update(float dt) override;
|
2015-01-28 11:31:52 +08:00
|
|
|
};
|
|
|
|
|
2016-12-08 11:58:58 +08:00
|
|
|
class SchedulerRemoveAllFunctionsToBePerformedInCocosThread : public SchedulerTestLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerRemoveAllFunctionsToBePerformedInCocosThread);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2016-12-08 11:58:58 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
void onEnter() override;
|
|
|
|
void onExit() override;
|
|
|
|
void update(float dt) override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2016-12-08 11:58:58 +08:00
|
|
|
private:
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Sprite* _sprite;
|
2016-12-08 11:58:58 +08:00
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class SchedulerIssue17149 : public SchedulerTestLayer
|
2017-01-16 17:37:59 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerIssue17149);
|
|
|
|
SchedulerIssue17149();
|
|
|
|
~SchedulerIssue17149();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-16 17:37:59 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void update(float dt) override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-16 17:37:59 +08:00
|
|
|
private:
|
|
|
|
class ClassA
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ClassA();
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-16 17:37:59 +08:00
|
|
|
void update(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-16 17:37:59 +08:00
|
|
|
int _member1;
|
|
|
|
int _member2;
|
|
|
|
int _member3;
|
|
|
|
};
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-16 17:37:59 +08:00
|
|
|
class ClassB
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ClassB();
|
|
|
|
void update(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-16 17:37:59 +08:00
|
|
|
int _member1;
|
|
|
|
int _member2;
|
|
|
|
int _member3;
|
|
|
|
};
|
2021-12-28 16:06:23 +08:00
|
|
|
|
|
|
|
void* _memoryPool;
|
2017-01-16 17:37:59 +08:00
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class SchedulerRemoveEntryWhileUpdate : public SchedulerTestLayer
|
2017-01-18 16:32:36 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerRemoveEntryWhileUpdate);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-18 16:32:36 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-18 16:32:36 +08:00
|
|
|
private:
|
|
|
|
class TestClass
|
|
|
|
{
|
|
|
|
public:
|
2022-07-11 17:50:21 +08:00
|
|
|
TestClass(int index, TestClass* nextObj, axis::Scheduler* scheduler);
|
2017-01-18 16:32:36 +08:00
|
|
|
void update(float dt);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-01-18 16:32:36 +08:00
|
|
|
private:
|
2021-12-28 16:06:23 +08:00
|
|
|
TestClass* _nextObj = nullptr;
|
|
|
|
int _index = 0;
|
2022-07-11 17:50:21 +08:00
|
|
|
axis::Scheduler* _scheduler = nullptr;
|
2021-12-28 16:06:23 +08:00
|
|
|
bool _cleanedUp = false;
|
2017-01-18 16:32:36 +08:00
|
|
|
};
|
2021-12-28 16:06:23 +08:00
|
|
|
std::vector<TestClass*> _testvector;
|
2017-01-18 16:32:36 +08:00
|
|
|
};
|
|
|
|
|
2021-12-28 16:06:23 +08:00
|
|
|
class SchedulerRemoveSelectorDuringCall : public SchedulerTestLayer
|
2017-03-07 11:16:30 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
CREATE_FUNC(SchedulerRemoveSelectorDuringCall);
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-03-07 11:16:30 +08:00
|
|
|
virtual std::string title() const override;
|
|
|
|
virtual std::string subtitle() const override;
|
|
|
|
virtual void onEnter() override;
|
|
|
|
virtual void onExit() override;
|
2021-12-28 16:06:23 +08:00
|
|
|
|
2017-03-07 11:16:30 +08:00
|
|
|
private:
|
2021-12-28 16:06:23 +08:00
|
|
|
void callback(float);
|
2017-03-07 11:16:30 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool _scheduled;
|
|
|
|
};
|
|
|
|
|
2010-09-09 16:15:21 +08:00
|
|
|
#endif
|