This commit is contained in:
halx99 2022-06-09 17:56:54 +08:00
parent f79530837b
commit d8aa943ed9
4 changed files with 0 additions and 111 deletions

View File

@ -30,7 +30,6 @@ FileUtilsTests::FileUtilsTests()
{ {
ADD_TEST_CASE(TestResolutionDirectories); ADD_TEST_CASE(TestResolutionDirectories);
ADD_TEST_CASE(TestSearchPath); ADD_TEST_CASE(TestSearchPath);
ADD_TEST_CASE(TestFilenameLookup);
ADD_TEST_CASE(TestIsFileExist); ADD_TEST_CASE(TestIsFileExist);
ADD_TEST_CASE(TestIsDirectoryExist); ADD_TEST_CASE(TestIsDirectoryExist);
ADD_TEST_CASE(TestFileFuncs); ADD_TEST_CASE(TestFileFuncs);
@ -208,44 +207,6 @@ std::string TestSearchPath::subtitle() const
return "See the console, can see a orange box and a 'about' picture, except Android"; return "See the console, can see a orange box and a 'about' picture, except Android";
} }
// TestFilenameLookup
void TestFilenameLookup::onEnter()
{
FileUtilsDemo::onEnter();
auto sharedFileUtils = FileUtils::getInstance();
ValueMap dict;
dict["grossini.bmp"] = Value("Images/grossini.png");
dict["grossini.xcf"] = Value("Images/grossini.png");
sharedFileUtils->setFilenameLookupDictionary(dict);
// Instead of loading carlitos.xcf, it will load grossini.png
auto sprite = Sprite::create("grossini.xcf");
this->addChild(sprite);
auto s = Director::getInstance()->getWinSize();
sprite->setPosition(s.width / 2, s.height / 2);
}
void TestFilenameLookup::onExit()
{
FileUtils* sharedFileUtils = FileUtils::getInstance();
// reset filename lookup
sharedFileUtils->setFilenameLookupDictionary(ValueMap());
FileUtilsDemo::onExit();
}
std::string TestFilenameLookup::title() const
{
return "FileUtils: filename lookup";
}
// TestIsFileExist // TestIsFileExist
void TestIsFileExist::onEnter() void TestIsFileExist::onEnter()
@ -276,9 +237,6 @@ void TestIsFileExist::onExit()
FileUtils* sharedFileUtils = FileUtils::getInstance(); FileUtils* sharedFileUtils = FileUtils::getInstance();
// reset filename lookup
sharedFileUtils->setFilenameLookupDictionary(ValueMap());
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
@ -997,7 +955,6 @@ void TestUnicodePath::onExit()
FileUtils* sharedFileUtils = FileUtils::getInstance(); FileUtils* sharedFileUtils = FileUtils::getInstance();
sharedFileUtils->purgeCachedEntries(); sharedFileUtils->purgeCachedEntries();
sharedFileUtils->setFilenameLookupDictionary(ValueMap());
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }
@ -1037,12 +994,6 @@ void TestIsFileExistAsync::onEnter()
void TestIsFileExistAsync::onExit() void TestIsFileExistAsync::onExit()
{ {
FileUtils* sharedFileUtils = FileUtils::getInstance();
// reset filename lookup
sharedFileUtils->setFilenameLookupDictionary(ValueMap());
FileUtilsDemo::onExit(); FileUtilsDemo::onExit();
} }

View File

@ -64,16 +64,6 @@ private:
std::vector<std::string> _defaultResolutionsOrderArray; std::vector<std::string> _defaultResolutionsOrderArray;
}; };
class TestFilenameLookup : public FileUtilsDemo
{
public:
CREATE_FUNC(TestFilenameLookup);
virtual void onEnter() override;
virtual void onExit() override;
virtual std::string title() const override;
};
class TestIsFileExist : public FileUtilsDemo class TestIsFileExist : public FileUtilsDemo
{ {
public: public:

View File

@ -80,7 +80,6 @@ FontTests::FontTests()
}); });
} }
ADD_TEST_CASE(FontNoReplacementTest); ADD_TEST_CASE(FontNoReplacementTest);
ADD_TEST_CASE(FontReplacementTest);
} }
void FontTest::showFont(std::string_view fontFile) void FontTest::showFont(std::string_view fontFile)
@ -162,7 +161,6 @@ FontNoReplacementTest* FontNoReplacementTest::create()
FontNoReplacementTest::FontNoReplacementTest() FontNoReplacementTest::FontNoReplacementTest()
{ {
_replace = false;
} }
FontNoReplacementTest::~FontNoReplacementTest() FontNoReplacementTest::~FontNoReplacementTest()
@ -176,7 +174,6 @@ FontNoReplacementTest::~FontNoReplacementTest()
FontFreeType::releaseFont("fonts/Abduction.ttf"); FontFreeType::releaseFont("fonts/Abduction.ttf");
FontAtlasCache::unloadFontAtlasTTF("fonts/Schwarzwald.ttf"); FontAtlasCache::unloadFontAtlasTTF("fonts/Schwarzwald.ttf");
FontFreeType::releaseFont("fonts/Schwarzwald.ttf"); FontFreeType::releaseFont("fonts/Schwarzwald.ttf");
FileUtils::getInstance()->setFilenameLookupDictionary(ValueMap());
} }
void FontNoReplacementTest::onEnter() void FontNoReplacementTest::onEnter()
@ -184,17 +181,6 @@ void FontNoReplacementTest::onEnter()
TestCase::onEnter(); TestCase::onEnter();
std::string suffix; std::string suffix;
if (_replace)
{
ValueMap dict{{"fonts/A Damn Mess.ttf", Value("fonts/arial.ttf")},
{"fonts/Abberancy.ttf", Value("fonts/arial.ttf")},
{"fonts/Abduction.ttf", Value("fonts/arial.ttf")},
{"fonts/Schwarzwald.ttf", Value("fonts/arial.ttf")}};
FileUtils::getInstance()->setFilenameLookupDictionary(dict);
suffix = " replaced by arial.ttf";
}
auto s = Director::getInstance()->getWinSize(); auto s = Director::getInstance()->getWinSize();
auto blockSize = Size(s.width / 3, 200); auto blockSize = Size(s.width / 3, 200);
@ -253,29 +239,3 @@ std::string FontNoReplacementTest::title() const
{ {
return "Font no replacement test"; return "Font no replacement test";
} }
FontReplacementTest* FontReplacementTest::create()
{
auto ret = new FontReplacementTest;
if (ret->init())
{
ret->autorelease();
}
else
{
delete ret;
ret = nullptr;
}
return ret;
}
FontReplacementTest::FontReplacementTest()
{
_replace = true;
}
std::string FontReplacementTest::title() const
{
return "Font replacement test";
}

View File

@ -65,18 +65,6 @@ public:
protected: protected:
FontNoReplacementTest(); FontNoReplacementTest();
bool _replace;
};
class FontReplacementTest : public FontNoReplacementTest
{
public:
static FontReplacementTest* create();
virtual std::string title() const override;
protected:
FontReplacementTest();
}; };
#endif // _FONT_TEST_H_ #endif // _FONT_TEST_H_