PuzzleSDK
Issue4129类 参考

#include <NewEventDispatcherTest.h>

+ 类 Issue4129 继承关系图:
+ Issue4129 的协作图:

Public 成员函数

 CREATE_FUNC (Issue4129)
 
 Issue4129 ()
 
virtual ~Issue4129 ()
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 
virtual void onEnter () override
 

Private 属性

cocos2d::EventListenerCustom * _customlistener
 
bool _bugFixed
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 NewEventDispatcherTest.h227 行定义.

构造及析构函数说明

◆ Issue4129()

Issue4129::Issue4129 ( )

在文件 NewEventDispatcherTest.cpp1286 行定义.

1287: _bugFixed(false)
1288{
1289 _customlistener = _eventDispatcher->addCustomEventListener(EVENT_COME_TO_BACKGROUND, [this](EventCustom* event){
1290
1291 auto label = Label::createWithSystemFont("Yeah, this issue was fixed.", "", 20);
1292 label->setAnchorPoint(Vec2(0.0f, 0.5f));
1293 label->setPosition(Vec2(VisibleRect::left() + Vec2(0.0f, 30.0f)));
1294 this->addChild(label);
1295
1296 // After test, remove it.
1297 _eventDispatcher->removeEventListener(_customlistener);
1298 _customlistener = nullptr;
1299
1300 _bugFixed = true;
1301 });
1302
1303 auto removeAllTouchItem = MenuItemFont::create("Remove All Listeners", [this](Ref* sender){
1304 auto senderItem = static_cast<MenuItemFont*>(sender);
1305 senderItem->setString("Only 'Reset' item could be clicked");
1306
1307 _eventDispatcher->removeAllEventListeners();
1308
1309 auto nextItem = MenuItemFont::create("Reset", [=](Ref* sender){
1310 CCASSERT(_bugFixed, "This issue was not fixed!");
1312 });
1313
1314 nextItem->setFontSizeObj(16);
1315 nextItem->setPosition(VisibleRect::right() + Vec2(-100.0f, -30.0f));
1316
1317 auto menu2 = Menu::create(nextItem, nullptr);
1318 menu2->setPosition(Vec2(0, 0));
1319 menu2->setAnchorPoint(Vec2(0, 0));
1320 this->addChild(menu2);
1321
1322 // Simulate to dispatch 'come to background' event
1323 _eventDispatcher->dispatchCustomEvent(EVENT_COME_TO_BACKGROUND);
1324 });
1325
1326 removeAllTouchItem->setFontSizeObj(16);
1327 removeAllTouchItem->setPosition(VisibleRect::right() + Vec2(-100.0f, 0.0f));
1328
1329 auto menu = Menu::create(removeAllTouchItem, nullptr);
1330 menu->setPosition(Vec2(0, 0));
1331 menu->setAnchorPoint(Vec2(0, 0));
1332 addChild(menu);
1333}
cocos2d::EventListenerCustom * _customlistener
TestSuite * getTestSuite() const
Definition: BaseTest.h:83
virtual void restartCurrTest()
Definition: BaseTest.cpp:299
static cocos2d::Vec2 left()
Definition: VisibleRect.cpp:45
static cocos2d::Vec2 right()
Definition: VisibleRect.cpp:51

引用了 _bugFixed, _customlistener, TestCase::getTestSuite(), VisibleRect::left(), TestSuite::restartCurrTest() , 以及 VisibleRect::right().

+ 函数调用图:

◆ ~Issue4129()

Issue4129::~Issue4129 ( )
virtual

在文件 NewEventDispatcherTest.cpp1335 行定义.

1336{
1337 if (_customlistener)
1338 {
1339 _eventDispatcher->removeEventListener(_customlistener);
1340 }
1341}

引用了 _customlistener.

成员函数说明

◆ CREATE_FUNC()

Issue4129::CREATE_FUNC ( Issue4129  )

◆ subtitle()

std::string Issue4129::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 NewEventDispatcherTest.cpp1348 行定义.

1349{
1350 return "Should see 'Yeah, this issue was fixed.'";
1351}

◆ title()

std::string Issue4129::title ( ) const
overridevirtual

重载 EventDispatcherTestDemo .

在文件 NewEventDispatcherTest.cpp1343 行定义.

1344{
1345 return "Issue 4129: Remove All Listeners";
1346}

类成员变量说明

◆ _bugFixed

bool Issue4129::_bugFixed
private

在文件 NewEventDispatcherTest.h239 行定义.

被这些函数引用 Issue4129().

◆ _customlistener

cocos2d::EventListenerCustom* Issue4129::_customlistener
private

在文件 NewEventDispatcherTest.h238 行定义.

被这些函数引用 Issue4129() , 以及 ~Issue4129().


该类的文档由以下文件生成: