CVcmiTestConfig.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * CVcmiTestConfig.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CVcmiTestConfig.h"
  12. #include "../lib/CConsoleHandler.h"
  13. #include "../lib/logging/CBasicLogConfigurator.h"
  14. #include "../lib/VCMIDirs.h"
  15. #include "../lib/VCMI_Lib.h"
  16. #include "../lib/logging/CLogger.h"
  17. #include "../lib/CConfigHandler.h"
  18. #include "../lib/filesystem/Filesystem.h"
  19. #include "../lib/filesystem/CFilesystemLoader.h"
  20. #include "../lib/filesystem/AdapterLoaders.h"
  21. CVcmiTestConfig::CVcmiTestConfig()
  22. {
  23. console = new CConsoleHandler;
  24. CBasicLogConfigurator logConfig(VCMIDirs::get().userCachePath() / "VCMI_Test_log.txt", console);
  25. logConfig.configureDefault();
  26. preinitDLL(console);
  27. settings.init();
  28. logConfig.configure();
  29. loadDLLClasses();
  30. logGlobal->info("Initialized global test setup.");
  31. /* TEST_DATA_DIR may be wrong, if yes below test don't run,
  32. find your test data folder in your build and change TEST_DATA_DIR for it*/
  33. const std::string TEST_DATA_DIR = "test/";
  34. auto path = boost::filesystem::current_path();
  35. path+= "/" + TEST_DATA_DIR;
  36. if(boost::filesystem::exists(path)){
  37. auto loader = new CFilesystemLoader("test/", TEST_DATA_DIR);
  38. dynamic_cast<CFilesystemList*>(CResourceHandler::get())->addLoader(loader, false);
  39. }
  40. }
  41. CVcmiTestConfig::~CVcmiTestConfig()
  42. {
  43. std::cout << "Ending global test tear-down." << std::endl;
  44. }