mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-22 22:13:35 +02:00
Update tests
This commit is contained in:
parent
08fbcd5239
commit
04ca8aca9f
@ -275,7 +275,7 @@ std::string MapRendererAdventureContext::overlayText(const int3 & coordinates) c
|
||||
|
||||
const auto & tile = getMapTile(coordinates);
|
||||
|
||||
if (!tile.visitable)
|
||||
if (!tile.visitable())
|
||||
return {};
|
||||
|
||||
return tile.visitableObjects.back()->getObjectName();
|
||||
@ -288,7 +288,7 @@ ColorRGBA MapRendererAdventureContext::overlayTextColor(const int3 & coordinates
|
||||
|
||||
const auto & tile = getMapTile(coordinates);
|
||||
|
||||
if (!tile.visitable)
|
||||
if (!tile.visitable())
|
||||
return {};
|
||||
|
||||
const auto * object = tile.visitableObjects.back();
|
||||
|
@ -291,7 +291,7 @@ float Statistic::getMapExploredRatio(const CGameState * gs, PlayerColor player)
|
||||
{
|
||||
TerrainTile tile = gs->map->getTile(int3(x, y, layer));
|
||||
|
||||
if(tile.blocked && (!tile.visitable))
|
||||
if(tile.blocked() && !tile.visitable())
|
||||
continue;
|
||||
|
||||
if(gs->isVisible(int3(x, y, layer), player))
|
||||
|
@ -4211,7 +4211,7 @@ CGObjectInstance * CGameHandler::createNewObject(const int3 & visitablePosition,
|
||||
throw std::runtime_error("Attempt to create object outside map at " + visitablePosition.toString());
|
||||
|
||||
const TerrainTile & t = gs->map->getTile(visitablePosition);
|
||||
terrainType = t.terType->getId();
|
||||
terrainType = t.getTerrainID();
|
||||
|
||||
auto handler = VLC->objtypeh->getHandlerFor(objectID, subID);
|
||||
|
||||
|
@ -423,7 +423,7 @@ RumorState NewTurnProcessor::pickNewRumor()
|
||||
rumorId = *RandomGeneratorUtil::nextItem(sRumorTypes, rand);
|
||||
if(rumorId == RumorState::RUMOR_GRAIL)
|
||||
{
|
||||
rumorExtra = gameHandler->gameState()->getTile(gameHandler->gameState()->map->grailPos)->terType->getIndex();
|
||||
rumorExtra = gameHandler->gameState()->getTile(gameHandler->gameState()->map->grailPos)->getTerrainID().getNum();
|
||||
break;
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ std::vector<SetMovePoints> NewTurnProcessor::updateHeroesMovementPoints()
|
||||
{
|
||||
auto ti = std::make_unique<TurnInfo>(h, 1);
|
||||
// NOTE: this code executed when bonuses of previous day not yet updated (this happen in NewTurn::applyGs). See issue 2356
|
||||
int32_t newMovementPoints = h->movementPointsLimitCached(gameHandler->gameState()->map->getTile(h->visitablePos()).terType->isLand(), ti.get());
|
||||
int32_t newMovementPoints = h->movementPointsLimitCached(gameHandler->gameState()->map->getTile(h->visitablePos()).isLand(), ti.get());
|
||||
|
||||
if (newMovementPoints != h->movementPointsRemaining())
|
||||
result.emplace_back(h->id, newMovementPoints, true);
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
|
||||
const auto & t = *gameCallback->getTile(tile);
|
||||
|
||||
auto terrain = t.terType->getId();
|
||||
auto terrain = t.getTerrainID();
|
||||
BattleField terType(0);
|
||||
BattleLayout layout = BattleLayout::createDefaultLayout(gameState->callback, attacker, defender);
|
||||
|
||||
|
@ -38,17 +38,17 @@ TEST(MapManager, DrawTerrain_Type)
|
||||
static const int3 squareCheck[] = { int3(5,5,0), int3(5,4,0), int3(4,4,0), int3(4,5,0) };
|
||||
for(const auto & tile : squareCheck)
|
||||
{
|
||||
EXPECT_EQ(map->getTile(tile).terType->getId(), ETerrainId::GRASS);
|
||||
EXPECT_EQ(map->getTile(tile).getTerrainID(), ETerrainId::GRASS);
|
||||
}
|
||||
|
||||
// Concat to square
|
||||
editManager->getTerrainSelection().select(int3(6, 5, 0));
|
||||
editManager->drawTerrain(ETerrainId::GRASS, 10, &rand);
|
||||
EXPECT_EQ(map->getTile(int3(6, 4, 0)).terType->getId(), ETerrainId::GRASS);
|
||||
EXPECT_EQ(map->getTile(int3(6, 4, 0)).getTerrainID(), ETerrainId::GRASS);
|
||||
editManager->getTerrainSelection().select(int3(6, 5, 0));
|
||||
editManager->drawTerrain(ETerrainId::LAVA, 10, &rand);
|
||||
EXPECT_EQ(map->getTile(int3(4, 4, 0)).terType->getId(), ETerrainId::GRASS);
|
||||
EXPECT_EQ(map->getTile(int3(7, 4, 0)).terType->getId(), ETerrainId::LAVA);
|
||||
EXPECT_EQ(map->getTile(int3(4, 4, 0)).getTerrainID(), ETerrainId::GRASS);
|
||||
EXPECT_EQ(map->getTile(int3(7, 4, 0)).getTerrainID(), ETerrainId::LAVA);
|
||||
|
||||
// Special case water,rock
|
||||
editManager->getTerrainSelection().selectRange(MapRect(int3(10, 10, 0), 10, 5));
|
||||
@ -57,7 +57,7 @@ TEST(MapManager, DrawTerrain_Type)
|
||||
editManager->drawTerrain(ETerrainId::GRASS, 10, &rand);
|
||||
editManager->getTerrainSelection().select(int3(21, 16, 0));
|
||||
editManager->drawTerrain(ETerrainId::GRASS, 10, &rand);
|
||||
EXPECT_EQ(map->getTile(int3(20, 15, 0)).terType->getId(), ETerrainId::GRASS);
|
||||
EXPECT_EQ(map->getTile(int3(20, 15, 0)).getTerrainID(), ETerrainId::GRASS);
|
||||
|
||||
// Special case non water,rock
|
||||
static const int3 diagonalCheck[] = { int3(31,42,0), int3(32,42,0), int3(32,43,0), int3(33,43,0), int3(33,44,0),
|
||||
@ -68,7 +68,7 @@ TEST(MapManager, DrawTerrain_Type)
|
||||
editManager->getTerrainSelection().select(tile);
|
||||
}
|
||||
editManager->drawTerrain(ETerrainId::GRASS, 10, &rand);
|
||||
EXPECT_EQ(map->getTile(int3(35, 44, 0)).terType->getId(), ETerrainId::WATER);
|
||||
EXPECT_EQ(map->getTile(int3(35, 44, 0)).getTerrainID(), ETerrainId::WATER);
|
||||
|
||||
// Rock case
|
||||
editManager->getTerrainSelection().selectRange(MapRect(int3(1, 1, 1), 15, 15));
|
||||
@ -77,7 +77,7 @@ TEST(MapManager, DrawTerrain_Type)
|
||||
int3(8, 7, 1), int3(4, 8, 1), int3(5, 8, 1), int3(6, 8, 1)});
|
||||
editManager->getTerrainSelection().setSelection(vec);
|
||||
editManager->drawTerrain(ETerrainId::ROCK, 10, &rand);
|
||||
EXPECT_TRUE(!map->getTile(int3(5, 6, 1)).terType->isPassable() || !map->getTile(int3(7, 8, 1)).terType->isPassable());
|
||||
EXPECT_TRUE(!map->getTile(int3(5, 6, 1)).getTerrain()->isPassable() || !map->getTile(int3(7, 8, 1)).getTerrain()->isPassable());
|
||||
|
||||
//todo: add checks here and enable, also use smaller size
|
||||
#if 0
|
||||
@ -144,7 +144,7 @@ TEST(MapManager, DrawTerrain_View)
|
||||
int3 pos((si32)posVector[0].Float(), (si32)posVector[1].Float(), (si32)posVector[2].Float());
|
||||
const auto & originalTile = originalMap->getTile(pos);
|
||||
editManager->getTerrainSelection().selectRange(MapRect(pos, 1, 1));
|
||||
editManager->drawTerrain(originalTile.terType->getId(), 10, &gen);
|
||||
editManager->drawTerrain(originalTile.getTerrainID(), 10, &gen);
|
||||
const auto & tile = map->getTile(pos);
|
||||
bool isInRange = false;
|
||||
for(const auto & range : mapping)
|
||||
|
@ -133,7 +133,7 @@ void checkEqual(const ObjectTemplate & actual, const ObjectTemplate & expected)
|
||||
void checkEqual(const TerrainTile & actual, const TerrainTile & expected)
|
||||
{
|
||||
//fatal fail here on any error
|
||||
VCMI_REQUIRE_FIELD_EQUAL(terType);
|
||||
VCMI_REQUIRE_FIELD_EQUAL(terrainType);
|
||||
VCMI_REQUIRE_FIELD_EQUAL(terView);
|
||||
VCMI_REQUIRE_FIELD_EQUAL(riverType);
|
||||
VCMI_REQUIRE_FIELD_EQUAL(riverDir);
|
||||
@ -143,9 +143,6 @@ void checkEqual(const TerrainTile & actual, const TerrainTile & expected)
|
||||
|
||||
ASSERT_EQ(actual.blockingObjects.size(), expected.blockingObjects.size());
|
||||
ASSERT_EQ(actual.visitableObjects.size(), expected.visitableObjects.size());
|
||||
|
||||
VCMI_REQUIRE_FIELD_EQUAL(visitable);
|
||||
VCMI_REQUIRE_FIELD_EQUAL(blocked);
|
||||
}
|
||||
|
||||
//MapComparer
|
||||
|
Loading…
Reference in New Issue
Block a user