PuzzleSDK
TestIsDirectoryExist类 参考

#include <FileUtilsTest.h>

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

Public 成员函数

 CREATE_FUNC (TestIsDirectoryExist)
 
virtual void onEnter () override
 
virtual void onExit () override
 
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
 

额外继承的成员函数

- 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
 

详细描述

在文件 FileUtilsTest.h87 行定义.

成员函数说明

◆ CREATE_FUNC()

TestIsDirectoryExist::CREATE_FUNC ( TestIsDirectoryExist  )

◆ onEnter()

void TestIsDirectoryExist::onEnter ( )
overridevirtual

重载 TestCase .

在文件 FileUtilsTest.cpp293 行定义.

294{
296 auto s = Director::getInstance()->getWinSize();
297 auto util = FileUtils::getInstance();
298 int x = s.width/2, y = s.height/3;
299
300 Label* label = nullptr;
301 std::string dir;
302 auto getMsg = [&dir](bool b)-> std::string
303 {
304 char msg[512];
305 snprintf((char *)msg, 512, "%s for dir: \"%s\"", b ? "success" : "failed", dir.c_str());
306 return std::string(msg);
307 };
308
309 dir = "Images";
310 label = Label::createWithSystemFont(getMsg(util->isDirectoryExist(dir)), "", 20);
311 label->setPosition(x, y * 2);
312 this->addChild(label);
313
314 dir = util->getWritablePath();
315 label = Label::createWithSystemFont(getMsg(util->isDirectoryExist(dir)), "", 20);
316 label->setPosition(x, y * 1);
317 this->addChild(label);
318
319 dir = util->getWritablePath();
320 label = Label::createWithSystemFont(getMsg(util->isDirectoryExist(dir)), "", 20);
321 label->setPosition(x, y * 1);
322 this->addChild(label);
323}
virtual void onEnter() override
Definition: BaseTest.cpp:430

引用了 TestCase::onEnter().

+ 函数调用图:

◆ onExit()

void TestIsDirectoryExist::onExit ( )
overridevirtual

在文件 FileUtilsTest.cpp325 行定义.

326{
327
328 FileUtils *sharedFileUtils = FileUtils::getInstance();
329
330 // reset filename lookup
331 sharedFileUtils->purgeCachedEntries();
332
333 FileUtilsDemo::onExit();
334}

◆ subtitle()

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

重载 TestCase .

在文件 FileUtilsTest.cpp341 行定义.

342{
343 return "";
344}

◆ title()

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

重载 TestCase .

在文件 FileUtilsTest.cpp336 行定义.

337{
338 return "FileUtils: check whether the directory exists";
339}

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