PuzzleSDK
UIButtonCloneTest类 参考

#include <UIButtonTest.h>

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

Public 成员函数

 CREATE_FUNC (UIButtonCloneTest)
 
 UIButtonCloneTest ()
 
 ~UIButtonCloneTest ()
 
virtual bool init () override
 
- Public 成员函数 继承自 UIScene
 UIScene ()
 
 ~UIScene ()
 
virtual void onEnter () override
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual std::string title () const
 
virtual std::string subtitle () const
 
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
 

Protected 属性

cocos2d::ui::Text * _displayValueLabel
 
- Protected 属性 继承自 UIScene
cocos2d::Layer * _uiLayer
 
cocos2d::ui::Layout * _widget
 
cocos2d::ui::Text * _sceneTitle
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 

详细描述

在文件 UIButtonTest.h239 行定义.

构造及析构函数说明

◆ UIButtonCloneTest()

UIButtonCloneTest::UIButtonCloneTest ( )

在文件 UIButtonTest.cpp1089 行定义.

1090: _displayValueLabel(nullptr)
1091{
1092
1093}
cocos2d::ui::Text * _displayValueLabel
Definition: UIButtonTest.h:250

◆ ~UIButtonCloneTest()

UIButtonCloneTest::~UIButtonCloneTest ( )

在文件 UIButtonTest.cpp1095 行定义.

1096{
1097}

成员函数说明

◆ CREATE_FUNC()

UIButtonCloneTest::CREATE_FUNC ( UIButtonCloneTest  )

◆ init()

bool UIButtonCloneTest::init ( )
overridevirtual

重载 UIScene .

在文件 UIButtonTest.cpp1099 行定义.

1100{
1101 if (UIScene::init())
1102 {
1103 Size widgetSize = _widget->getContentSize();
1104
1105 // Add a label in which the button events will be displayed
1106 _displayValueLabel = Text::create("", "fonts/Marker Felt.ttf",32);
1107 _displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
1108 _displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f,
1109 widgetSize.height / 2.0f));
1110 _uiLayer->addChild(_displayValueLabel);
1111
1112 // Add the alert
1113 Text* alert = Text::create("This test case shouldn't trigger the Assertion!",
1114 "fonts/Marker Felt.ttf",20);
1115 alert->setColor(Color3B(159, 168, 176));
1116
1117 alert->setPosition(Vec2(widgetSize.width / 2.0f,
1118 widgetSize.height / 2.0f
1119 - alert->getContentSize().height * 1.75f));
1120
1121 _uiLayer->addChild(alert);
1122
1123 // Create the button
1124 Button* button = Button::create("cocosui/animationbuttonnormal.png");
1125 button->setPosition(Vec2(widgetSize.width / 2.0f - 80,
1126 widgetSize.height / 2.0f + 40));
1127 _uiLayer->addChild(button);
1128
1129
1130 CCASSERT(button->getTitleRenderer() == nullptr,
1131 "Button title render must be nullptr ");
1132
1133 auto buttonCopy = (Button*)button->clone();
1134 buttonCopy->setPosition(Vec2(widgetSize.width / 2.0f + 80,
1135 widgetSize.height / 2.0f + 40));
1136 this->addChild(buttonCopy);
1137
1138
1139
1140 auto buttonScale9Copy = (Button*)button->clone();
1141 buttonScale9Copy->setPosition(button->getPosition() + Vec2(0.0f, -60.0f));
1142 buttonScale9Copy->setScale9Enabled(true);
1143 buttonScale9Copy->setContentSize(button->getContentSize() * 1.5f);
1144 this->addChild(buttonScale9Copy);
1145
1146
1147 auto buttonScale9Copy2 = (Button*)buttonScale9Copy->clone();
1148 buttonScale9Copy2->setPosition(buttonCopy->getPosition() + Vec2(0.0f, -60.0f));
1149 buttonScale9Copy2->setScale9Enabled(true);
1150 buttonScale9Copy2->setContentSize(buttonCopy->getContentSize() * 1.5f);
1151 this->addChild(buttonScale9Copy2);
1152
1153
1154 CCASSERT(button->getTitleRenderer() == nullptr,
1155 "Original Button title render must be nullptr ");
1156
1157 CCASSERT(buttonCopy->getTitleRenderer() == nullptr,
1158 "Copied Button title render must be nullptr ");
1159
1160 return true;
1161 }
1162 return false;
1163}
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

引用了 _displayValueLabel, UIScene::_uiLayer, UIScene::_widget , 以及 UIScene::init().

+ 函数调用图:

类成员变量说明

◆ _displayValueLabel

cocos2d::ui::Text* UIButtonCloneTest::_displayValueLabel
protected

在文件 UIButtonTest.h250 行定义.

被这些函数引用 init().


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