1 #include "DefaultContentManagerUT.h"
2
3 #include "sgp/FileMan.h"
4 #include "externalized/TestUtils.h"
5
DefaultContentManagerUT(GameVersion gameVersion,const ST::string & configFolder,const ST::string & gameResRootPath,const ST::string & externalizedDataPath)6 DefaultContentManagerUT::DefaultContentManagerUT(GameVersion gameVersion,
7 const ST::string& configFolder,
8 const ST::string& gameResRootPath,
9 const ST::string& externalizedDataPath)
10 : DefaultContentManager(gameVersion, configFolder, gameResRootPath, externalizedDataPath)
11 {}
12
init(EngineOptions * engine_options)13 void DefaultContentManagerUT::init(EngineOptions* engine_options)
14 {
15 Vfs_addDir(m_vfs.get(), m_externalizedDataPath.c_str());
16 }
17
_readJsonDataFile(const char * fileName) const18 std::unique_ptr<rapidjson::Document> DefaultContentManagerUT::_readJsonDataFile(const char* fileName) const
19 {
20 return DefaultContentManager::readJsonDataFile(fileName);
21 }
22
createDefaultCMForTesting()23 DefaultContentManagerUT* DefaultContentManagerUT::createDefaultCMForTesting()
24 {
25 ST::string extraDataDir = GetExtraDataDir();
26 ST::string configFolderPath = FileMan::joinPaths(extraDataDir, "unittests");
27 ST::string gameResRootPath = FileMan::joinPaths(extraDataDir, "unittests");
28 ST::string externalizedDataPath = FileMan::joinPaths(extraDataDir, "externalized");
29
30 DefaultContentManagerUT* cm = new DefaultContentManagerUT(GameVersion::ENGLISH,
31 configFolderPath,
32 gameResRootPath, externalizedDataPath);
33 cm->init(NULL);
34
35 return cm;
36 }
37