mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 16:36:41 +00:00
Fix tests on windows
This commit is contained in:
parent
a854a6e04a
commit
b5f0057ac9
6 changed files with 12 additions and 41 deletions
|
@ -77,17 +77,12 @@ if (GTEST_FOUND AND GMOCK_FOUND)
|
||||||
endif (CMAKE_CL_64)
|
endif (CMAKE_CL_64)
|
||||||
endif (MSVC)
|
endif (MSVC)
|
||||||
|
|
||||||
include(FetchContent)
|
file(DOWNLOAD
|
||||||
FetchContent_Declare(example_suite_template_game
|
https://gitlab.com/OpenMW/example-suite/-/raw/8966dab24692555eec720c854fb0f73d108070cd/data/template.omwgame
|
||||||
URL https://gitlab.com/OpenMW/example-suite/-/raw/8966dab24692555eec720c854fb0f73d108070cd/data/template.omwgame
|
${CMAKE_CURRENT_BINARY_DIR}/data/template.omwgame
|
||||||
URL_HASH MD5=bf3691034a38611534c74c3b89a7d2c3
|
EXPECTED_MD5 bf3691034a38611534c74c3b89a7d2c3
|
||||||
SOURCE_DIR fetched/example_suite_template_game
|
|
||||||
DOWNLOAD_NO_EXTRACT ON
|
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailableExcludeFromAll(example_suite_template_game)
|
|
||||||
|
|
||||||
add_custom_target(example_suite_template_game SOURCES fetched/example_suite_template_game/template.omwgame)
|
target_compile_definitions(openmw_test_suite PRIVATE OPENMW_DATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data")
|
||||||
|
|
||||||
add_dependencies(openmw_test_suite example_suite_template_game)
|
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#include "settings.hpp"
|
|
||||||
|
|
||||||
#include <components/esmloader/load.cpp>
|
#include <components/esmloader/load.cpp>
|
||||||
#include <components/files/collections.hpp>
|
#include <components/files/collections.hpp>
|
||||||
#include <components/files/multidircollection.hpp>
|
#include <components/files/multidircollection.hpp>
|
||||||
|
@ -7,16 +5,18 @@
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#ifndef OPENMW_DATA_DIR
|
||||||
|
#error "OPENMW_DATA_DIR is not defined"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
using namespace testing;
|
using namespace testing;
|
||||||
using namespace EsmLoader;
|
using namespace EsmLoader;
|
||||||
using EsmLoaderTests::Settings;
|
|
||||||
|
|
||||||
struct EsmLoaderTest : Test
|
struct EsmLoaderTest : Test
|
||||||
{
|
{
|
||||||
const boost::filesystem::path mDataDir {Settings::impl().mBasePath / "apps/openmw_test_suite/fetched/example_suite_template_game"};
|
const Files::PathContainer mDataDirs {{std::string(OPENMW_DATA_DIR)}};
|
||||||
const Files::PathContainer mDataDirs {{mDataDir.string()}};
|
|
||||||
const Files::Collections mFileCollections {mDataDirs, true};
|
const Files::Collections mFileCollections {mDataDirs, true};
|
||||||
const std::vector<std::string> mContentFiles {{"template.omwgame"}};
|
const std::vector<std::string> mContentFiles {{"template.omwgame"}};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef OPENMW_TEST_SUITE_LOAD_SETTINGS_H
|
|
||||||
#define OPENMW_TEST_SUITE_LOAD_SETTINGS_H
|
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
|
||||||
|
|
||||||
namespace EsmLoaderTests
|
|
||||||
{
|
|
||||||
struct Settings
|
|
||||||
{
|
|
||||||
boost::filesystem::path mBasePath;
|
|
||||||
|
|
||||||
static Settings& impl()
|
|
||||||
{
|
|
||||||
static Settings value;
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,9 +1,5 @@
|
||||||
#include "esmloader/settings.hpp"
|
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <boost/filesystem/path.hpp>
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
//we cannot use GTEST_API_ before main if we're building standalone exe application,
|
//we cannot use GTEST_API_ before main if we're building standalone exe application,
|
||||||
//and we're linking GoogleTest / GoogleMock as DLLs and not linking gtest_main / gmock_main
|
//and we're linking GoogleTest / GoogleMock as DLLs and not linking gtest_main / gmock_main
|
||||||
|
@ -11,7 +7,6 @@ int main(int argc, char **argv) {
|
||||||
#else
|
#else
|
||||||
GTEST_API_ int main(int argc, char **argv) {
|
GTEST_API_ int main(int argc, char **argv) {
|
||||||
#endif
|
#endif
|
||||||
EsmLoaderTests::Settings::impl().mBasePath = boost::filesystem::path(argv[0]).parent_path();
|
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace ESM
|
||||||
struct GameSetting;
|
struct GameSetting;
|
||||||
struct Land;
|
struct Land;
|
||||||
struct Static;
|
struct Static;
|
||||||
struct Variant;
|
class Variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace EsmLoader
|
namespace EsmLoader
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <iterator>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
Loading…
Reference in a new issue