PuzzleSDK
Issue9898类 参考

#include <NewEventDispatcherTest.h>

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

Public 成员函数

 CREATE_FUNC (Issue9898)
 
 Issue9898 ()
 
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 * _listener
 

额外继承的成员函数

- 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.h300 行定义.

构造及析构函数说明

◆ Issue9898()

Issue9898::Issue9898 ( )

在文件 NewEventDispatcherTest.cpp1659 行定义.

1660{
1661 auto origin = Director::getInstance()->getVisibleOrigin();
1662 auto size = Director::getInstance()->getVisibleSize();
1663
1664 auto nodeA = Node::create();
1665 addChild(nodeA);
1666
1667 _listener = cocos2d::EventListenerCustom::create("Issue9898", [&](cocos2d::EventCustom *event){
1668 _eventDispatcher->removeEventListener(_listener);
1669 _eventDispatcher->dispatchCustomEvent("Issue9898");
1670 });
1671 _eventDispatcher->addEventListenerWithSceneGraphPriority(_listener, nodeA);
1672
1673 auto menuItem = MenuItemFont::create("Dispatch Custom Event", [&](Ref *sender) {
1674 _eventDispatcher->dispatchCustomEvent("Issue9898");
1675 });
1676 menuItem->setPosition(origin.x + size.width/2, origin.y + size.height/2);
1677 auto menu = Menu::create(menuItem, nullptr);
1678 menu->setPosition(Vec2::ZERO);
1679 addChild(menu);
1680}
cocos2d::EventListenerCustom * _listener

引用了 _listener.

成员函数说明

◆ CREATE_FUNC()

Issue9898::CREATE_FUNC ( Issue9898  )

◆ subtitle()

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

重载 TestCase .

在文件 NewEventDispatcherTest.cpp1687 行定义.

1688{
1689 return "Should not crash if dispatch event after remove\n event listener in callback";
1690}

◆ title()

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

重载 EventDispatcherTestDemo .

在文件 NewEventDispatcherTest.cpp1682 行定义.

1683{
1684 return "Issue 9898";
1685}

类成员变量说明

◆ _listener

cocos2d::EventListenerCustom* Issue9898::_listener
private

在文件 NewEventDispatcherTest.h310 行定义.

被这些函数引用 Issue9898().


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