PuzzleSDK
PrettyPrinterDemo类 参考

#include <DataVisitorTest.h>

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

Public 成员函数

 CREATE_FUNC (PrettyPrinterDemo)
 
virtual std::string title () const override
 
virtual std::string subtitle () const override
 
virtual void onEnter () override
 
void addSprite ()
 
- 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
 

Protected 属性

std::string _title
 
- 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
 

详细描述

在文件 DataVisitorTest.h34 行定义.

成员函数说明

◆ addSprite()

void PrettyPrinterDemo::addSprite ( )

在文件 DataVisitorTest.cpp44 行定义.

45{
46 // create sprites
47
48 auto s1 = Sprite::create("Images/grossini.png");
49 auto s2 = Sprite::create("Images/grossini_dance_01.png");
50 auto s3 = Sprite::create("Images/grossini_dance_02.png");
51 auto s4 = Sprite::create("Images/grossini_dance_03.png");
52 auto s5 = Sprite::create("Images/grossini_dance_04.png");
53
54 s1->setPosition(50, 50);
55 s2->setPosition(60, 50);
56 s3->setPosition(70, 50);
57 s4->setPosition(80, 50);
58 s5->setPosition(90, 50);
59
60 this->addChild(s1);
61 this->addChild(s2);
62 this->addChild(s3);
63 this->addChild(s4);
64 this->addChild(s5);
65}

被这些函数引用 onEnter().

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

◆ CREATE_FUNC()

PrettyPrinterDemo::CREATE_FUNC ( PrettyPrinterDemo  )

◆ onEnter()

void PrettyPrinterDemo::onEnter ( )
overridevirtual

重载 TestCase .

在文件 DataVisitorTest.cpp67 行定义.

68{
70 auto s = Director::getInstance()->getWinSize();
71
72 auto label = Label::createWithTTF(title().c_str(), "fonts/arial.ttf", 28);
73 label->setPosition(s.width/2, s.height * 4/5);
74 this->addChild(label, 1);
75
76 std::string strSubtitle = subtitle();
77 if(strSubtitle.empty() == false)
78 {
79 auto subLabel = Label::createWithTTF(strSubtitle.c_str(), "fonts/Thonburi.ttf", 16);
80 subLabel->setPosition(s.width/2, s.height * 3/5);
81 this->addChild(subLabel, 1);
82 }
83
84 // Test code
85 //TODO: minggo
86// PrettyPrinter visitor;
87//
88// // print dictionary
89// auto dict = __Dictionary::createWithContentsOfFile("animations/animations.plist");
90// dict->acceptVisitor(visitor);
91// log("%s", visitor.getResult().c_str());
92// log("-------------------------------");
93//
94// __Set myset;
95// for (int i = 0; i < 30; ++i) {
96// myset.addObject(__String::createWithFormat("str: %d", i));
97// }
98// visitor.clear();
99// myset.acceptVisitor(visitor);
100// log("%s", visitor.getResult().c_str());
101// log("-------------------------------");
102//
103// visitor.clear();
104 addSprite();
105// dict = Director::getInstance()->getTextureCache()->snapshotTextures();
106// dict->acceptVisitor(visitor);
107// log("%s", visitor.getResult().c_str());
108}
virtual std::string title() const override
virtual std::string subtitle() const override
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 addSprite(), TestCase::onEnter(), subtitle() , 以及 title().

+ 函数调用图:

◆ subtitle()

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

重载 TestCase .

在文件 DataVisitorTest.cpp39 行定义.

40{
41 return "Please see log!";
42}

被这些函数引用 onEnter().

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

◆ title()

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

重载 TestCase .

在文件 DataVisitorTest.cpp34 行定义.

35{
36 return "PrettyPrinter Test";
37}

被这些函数引用 onEnter().

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

类成员变量说明

◆ _title

std::string PrettyPrinterDemo::_title
protected

在文件 DataVisitorTest.h43 行定义.


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