1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

Fix tests

This commit is contained in:
Ivan Savenko
2025-05-15 13:04:47 +03:00
parent 4d4da0454f
commit 6aadcf43d3
2 changed files with 45 additions and 3 deletions

View File

@@ -156,6 +156,7 @@ public:
virtual bool isTeleportEntrancePassable(const CGTeleport * obj, PlayerColor player) const = 0;
/// gives 3 treasures, 3 minors, 1 major -> used by Black Market and Artifact Merchant
/// TODO: remove non-const method from this interface
virtual void pickAllowedArtsSet(std::vector<ArtifactID> & out, vstd::RNG & rand) = 0;
#if SCRIPTING_ENABLED

View File

@@ -12,12 +12,18 @@
#include "../../lib/callback/CGameInfoCallback.h"
#if SCRIPTING_ENABLED
#include <vcmi/scripting/Service.h>
#endif
class IGameInfoCallbackMock : public IGameInfoCallback
{
public:
//various
MOCK_CONST_METHOD1(getDate, int(Date));
MOCK_CONST_METHOD0(getStartInfo, const StartInfo *());
MOCK_CONST_METHOD0(getMapHeader, const CMapHeader *());
MOCK_CONST_METHOD0(getMapSize, int3());
MOCK_CONST_METHOD0(getInitialStartInfo, const StartInfo *());
MOCK_CONST_METHOD1(isAllowed, bool(SpellID));
@@ -36,7 +42,42 @@ public:
//objects
MOCK_CONST_METHOD2(getObj, const CGObjectInstance *(ObjectInstanceID, bool));
MOCK_CONST_METHOD2(getVisitableObjs, std::vector<const CGObjectInstance*>(int3, bool));
CGameState & gameState() { throw std::runtime_error("not implemented");}
const CGameState & gameState() const { throw std::runtime_error("not implemented");}
const IGameSettings & getSettings() const { throw std::runtime_error("not implemented");}
MOCK_CONST_METHOD2(isVisibleFor, bool(int3 pos, PlayerColor player));
MOCK_CONST_METHOD2(isVisibleFor, bool(const CGObjectInstance * obj, PlayerColor player));
MOCK_CONST_METHOD1(isInTheMap, bool(const int3 & pos));
MOCK_CONST_METHOD1(getTeam, const TeamState *(TeamID teamID));
MOCK_CONST_METHOD1(getPlayerTeam, const TeamState *(PlayerColor color));
MOCK_CONST_METHOD2(getPlayerState, const PlayerState *(PlayerColor color, bool verbose));
MOCK_CONST_METHOD1(getPlayerSettings, const PlayerSettings *(PlayerColor color));
MOCK_CONST_METHOD2(getPlayerRelations, PlayerRelations(PlayerColor color1, PlayerColor color2));
MOCK_CONST_METHOD2(getHeroCount, int(PlayerColor player, bool includeGarrisoned));
MOCK_CONST_METHOD2(getPlayerStatus, EPlayerStatus(PlayerColor player, bool verbose));
MOCK_CONST_METHOD2(getResource, int(PlayerColor Player, GameResID which));
MOCK_CONST_METHOD1(getTown, const CGTownInstance *(ObjectInstanceID objid));
MOCK_CONST_METHOD1(getObjInstance, const CGObjectInstance *(ObjectInstanceID oid));
MOCK_CONST_METHOD1(getArtInstance, const CArtifactInstance *(ArtifactInstanceID aid));
MOCK_CONST_METHOD2(getTile, const TerrainTile *(int3 tile, bool verbose));
MOCK_CONST_METHOD1(getTileUnchecked, const TerrainTile *(int3 tile));
MOCK_CONST_METHOD1(getTopObj, const CGObjectInstance *(int3 pos));
MOCK_CONST_METHOD2(getTileDigStatus, EDiggingStatus(int3 tile, bool verbose));
MOCK_CONST_METHOD1(calculatePaths, void(const std::shared_ptr<PathfinderConfig> & config));
MOCK_CONST_METHOD6(getTilesInRange, void( std::unordered_set<int3> & tiles, const int3 & pos, int radius, ETileVisibility mode, std::optional<PlayerColor> player, int3::EDistanceFormula formula));
MOCK_CONST_METHOD4(getAllTiles, void(std::unordered_set<int3> & tiles, std::optional<PlayerColor> player, int level, std::function<bool(const TerrainTile *)> filter));
MOCK_CONST_METHOD2(getVisibleTeleportObjects, std::vector<ObjectInstanceID>(std::vector<ObjectInstanceID> ids, PlayerColor player));
MOCK_CONST_METHOD2(getTeleportChannelEntrances, std::vector<ObjectInstanceID>(TeleportChannelID id, PlayerColor Player));
MOCK_CONST_METHOD2(getTeleportChannelExits, std::vector<ObjectInstanceID>(TeleportChannelID id, PlayerColor Player));
MOCK_CONST_METHOD2(isTeleportChannelImpassable, bool(TeleportChannelID id, PlayerColor player));
MOCK_CONST_METHOD2(isTeleportChannelBidirectional, bool(TeleportChannelID id, PlayerColor player));
MOCK_CONST_METHOD2(isTeleportChannelUnidirectional, bool(TeleportChannelID id, PlayerColor player));
MOCK_CONST_METHOD2(isTeleportEntrancePassable, bool(const CGTeleport * obj, PlayerColor player));
MOCK_METHOD2(pickAllowedArtsSet, void(std::vector<ArtifactID> & out, vstd::RNG & rand));
#if SCRIPTING_ENABLED
MOCK_CONST_METHOD0(getGlobalContextPool, scripting::Pool *());
#endif
};