1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Merge branch 'develop' into handlersAbstraction

# Conflicts:
#	CI/linux/before_install.sh
#	CI/mac/before_install.sh
#	CI/mxe/before_install.sh
#	lib/CModHandler.cpp
#	lib/mapObjects/CObjectClassesHandler.cpp
#	lib/mapObjects/CObjectClassesHandler.h
#	lib/mapObjects/CommonConstructors.cpp
#	server/CGameHandler.cpp
#	test/CMakeLists.txt
#	test/spells/effects/TeleportTest.cpp
This commit is contained in:
Andrii Danylchenko
2021-07-16 00:32:13 +03:00
30 changed files with 1452 additions and 280 deletions

View File

@@ -42,6 +42,12 @@ TEST(MapFormat, Random)
SCOPED_TRACE("MapFormat_Random start");
CMapGenOptions opt;
CRmgTemplate tmpl;
const_cast<CRmgTemplate::CPlayerCountRange &>(tmpl.getCpuPlayers()).addRange(1, 4);
const_cast<CRmgTemplate::Zones &>(tmpl.getZones())[0] = std::make_shared<rmg::ZoneOptions>();
opt.setMapTemplate(&tmpl);
opt.setHeight(CMapHeader::MAP_SIZE_MIDDLE);
opt.setWidth(CMapHeader::MAP_SIZE_MIDDLE);
@@ -84,7 +90,7 @@ static JsonNode getFromArchive(CZipLoader & archive, const std::string & archive
ResourceID resource(archiveFilename, EResType::TEXT);
if(!archive.existsResource(resource))
throw std::runtime_error(archiveFilename+" not found");
throw std::runtime_error(archiveFilename + " not found");
auto data = archive.load(resource)->readAll();
@@ -144,14 +150,14 @@ TEST(MapFormat, Objects)
{
static const std::string MAP_DATA_PATH = "test/ObjectPropertyTest/";
const JsonNode initialHeader(ResourceID(MAP_DATA_PATH+CMapFormatJson::HEADER_FILE_NAME));
const JsonNode expectedHeader(ResourceID(MAP_DATA_PATH+CMapFormatJson::HEADER_FILE_NAME));//same as initial for now
const JsonNode initialHeader(ResourceID(MAP_DATA_PATH + CMapFormatJson::HEADER_FILE_NAME));
const JsonNode expectedHeader(ResourceID(MAP_DATA_PATH + CMapFormatJson::HEADER_FILE_NAME));//same as initial for now
const JsonNode initialObjects(ResourceID(MAP_DATA_PATH+CMapFormatJson::OBJECTS_FILE_NAME));
const JsonNode expectedObjects(ResourceID(MAP_DATA_PATH+"objects.ex.json"));
const JsonNode initialObjects(ResourceID(MAP_DATA_PATH + CMapFormatJson::OBJECTS_FILE_NAME));
const JsonNode expectedObjects(ResourceID(MAP_DATA_PATH + "objects.ex.json"));
const JsonNode expectedSurface(ResourceID(MAP_DATA_PATH+"surface_terrain.json"));
const JsonNode expectedUnderground(ResourceID(MAP_DATA_PATH+"underground_terrain.json"));
const JsonNode expectedSurface(ResourceID(MAP_DATA_PATH + "surface_terrain.json"));
const JsonNode expectedUnderground(ResourceID(MAP_DATA_PATH + "underground_terrain.json"));
std::unique_ptr<CMap> originalMap = loadOriginal(initialHeader, initialObjects, expectedSurface, expectedUnderground);
@@ -183,11 +189,11 @@ TEST(MapFormat, Terrain)
{
static const std::string MAP_DATA_PATH = "test/TerrainTest/";
const JsonNode expectedHeader(ResourceID(MAP_DATA_PATH+CMapFormatJson::HEADER_FILE_NAME));
const JsonNode expectedObjects(ResourceID(MAP_DATA_PATH+CMapFormatJson::OBJECTS_FILE_NAME));
const JsonNode expectedHeader(ResourceID(MAP_DATA_PATH + CMapFormatJson::HEADER_FILE_NAME));
const JsonNode expectedObjects(ResourceID(MAP_DATA_PATH + CMapFormatJson::OBJECTS_FILE_NAME));
const JsonNode expectedSurface(ResourceID(MAP_DATA_PATH+"surface_terrain.json"));
const JsonNode expectedUnderground(ResourceID(MAP_DATA_PATH+"underground_terrain.json"));
const JsonNode expectedSurface(ResourceID(MAP_DATA_PATH + "surface_terrain.json"));
const JsonNode expectedUnderground(ResourceID(MAP_DATA_PATH + "underground_terrain.json"));
std::unique_ptr<CMap> originalMap = loadOriginal(expectedHeader, expectedObjects, expectedSurface, expectedUnderground);