PuzzleSDK
UILayoutComponentTest类 参考

#include <UILayoutTest.h>

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

Public 成员函数

 CREATE_FUNC (UILayoutComponentTest)
 
virtual bool init () override
 
void touchEvent (cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
 
- 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::LayerColor * _baseLayer
 
- 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
 

详细描述

在文件 UILayoutTest.h137 行定义.

成员函数说明

◆ CREATE_FUNC()

UILayoutComponentTest::CREATE_FUNC ( UILayoutComponentTest  )

◆ init()

bool UILayoutComponentTest::init ( )
overridevirtual

重载 UIScene .

UILayoutComponent_Berth_Test , 以及 UILayoutComponent_Berth_Stretch_Test 重载.

在文件 UILayoutTest.cpp810 行定义.

811{
812 if (UIScene::init())
813 {
814 Size widgetSize = _widget->getContentSize();
815
816 _baseLayer = LayerColor::create();
817 _baseLayer->setColor(Color3B(50, 100, 0));
818 _baseLayer->setOpacity(100);
819 _baseLayer->setContentSize(Size(200, 200));
820 _uiLayer->addChild(_baseLayer);
821
822 Button* button = Button::create("cocosui/animationbuttonnormal.png");
823 CCLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width,
824 button->getContentSize().height);
825 button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
826 button->addTouchEventListener(CC_CALLBACK_2(UILayoutComponentTest::touchEvent, this));
827 button->setZoomScale(0.4f);
828 button->setPressedActionEnabled(true);
829 _uiLayer->addChild(button);
830
831 return true;
832 }
833 return false;
834}
cocos2d::LayerColor * _baseLayer
Definition: UILayoutTest.h:145
void touchEvent(cocos2d::Ref *sender, cocos2d::ui::Widget::TouchEventType type)
cocos2d::Layer * _uiLayer
Definition: UIScene.h:44
virtual bool init() override
Definition: UIScene.cpp:46
cocos2d::ui::Layout * _widget
Definition: UIScene.h:45

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

被这些函数引用 UILayoutComponent_Berth_Test::init() , 以及 UILayoutComponent_Berth_Stretch_Test::init().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ touchEvent()

void UILayoutComponentTest::touchEvent ( cocos2d::Ref *  sender,
cocos2d::ui::Widget::TouchEventType  type 
)

在文件 UILayoutTest.cpp836 行定义.

837{
838 switch (type)
839 {
840 case Widget::TouchEventType::BEGAN:
841 break;
842
843 case Widget::TouchEventType::MOVED:
844 break;
845
846 case Widget::TouchEventType::ENDED:
847 {
848 Size widgetSize = _widget->getContentSize();
849 Size layerSize = _baseLayer->getContentSize();
850 if (layerSize.width == widgetSize.width && layerSize.height == widgetSize.height)
851 _baseLayer->setContentSize(Size(200, 200));
852 else
853 _baseLayer->setContentSize(widgetSize);
854 Helper::doLayout(_baseLayer);
855 }
856 break;
857
858 case Widget::TouchEventType::CANCELED:
859 break;
860
861 default:
862 break;
863 }
864}

引用了 _baseLayer , 以及 UIScene::_widget.

被这些函数引用 init().

+ 这是这个函数的调用关系图:

类成员变量说明

◆ _baseLayer

cocos2d::LayerColor* UILayoutComponentTest::_baseLayer
protected

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