mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Fix tests compilation
This commit is contained in:
@@ -282,7 +282,7 @@ void BattleResultProcessor::endBattle(const CBattleInfoCallback & battle)
|
||||
otherBattleQuery->result = battleQuery->result;
|
||||
}
|
||||
|
||||
gameHandler->turnTimerHandler.onBattleEnd(battle.battleID);
|
||||
gameHandler->turnTimerHandler.onBattleEnd(battle.getBattle()->getBattleID());
|
||||
|
||||
if (battleResult->queryID == QueryID::NONE)
|
||||
endBattleConfirm(battle);
|
||||
|
||||
@@ -124,6 +124,7 @@ public:
|
||||
{
|
||||
public:
|
||||
|
||||
const IBattleInfo * battle;
|
||||
#if SCRIPTING_ENABLED
|
||||
scripting::Pool * pool;
|
||||
|
||||
@@ -137,9 +138,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void setBattle(const IBattleInfo * battleInfo)
|
||||
const IBattleInfo * getBattle() const override
|
||||
{
|
||||
CBattleInfoCallback::setBattle(battleInfo);
|
||||
return battle;
|
||||
}
|
||||
|
||||
std::optional<PlayerColor> getPlayerID() const override
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
#if SCRIPTING_ENABLED
|
||||
@@ -170,7 +176,7 @@ public:
|
||||
|
||||
void startBattle()
|
||||
{
|
||||
subject.setBattle(&battleMock);
|
||||
subject.battle = &battleMock;
|
||||
}
|
||||
|
||||
void redirectUnitsToFake()
|
||||
|
||||
@@ -87,7 +87,6 @@ BattleFake::BattleFake() = default;
|
||||
|
||||
void BattleFake::setUp()
|
||||
{
|
||||
CBattleInfoCallback::setBattle(this);
|
||||
}
|
||||
|
||||
void BattleFake::setupEmptyBattlefield()
|
||||
|
||||
@@ -88,6 +88,17 @@ public:
|
||||
pack->applyBattle(this);
|
||||
}
|
||||
|
||||
const IBattleInfo * getBattle() const override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::optional<PlayerColor> getPlayerID() const override
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
@@ -16,7 +16,7 @@ class EnvironmentMock : public Environment
|
||||
{
|
||||
public:
|
||||
MOCK_CONST_METHOD0(services, const Services *());
|
||||
MOCK_CONST_METHOD0(battle, const BattleCb *());
|
||||
MOCK_CONST_METHOD1(battle, const BattleCb *(const BattleID & battleID));
|
||||
MOCK_CONST_METHOD0(game, const GameCb *());
|
||||
MOCK_CONST_METHOD0(logger, ::vstd::CLoggerBase *());
|
||||
MOCK_CONST_METHOD0(eventBus, ::events::EventBus *());
|
||||
|
||||
@@ -36,6 +36,8 @@ public:
|
||||
MOCK_CONST_METHOD0(battleActiveUnit, const battle::Unit *());
|
||||
|
||||
MOCK_CONST_METHOD0(getBonusBearer, IBonusBearer*());
|
||||
MOCK_CONST_METHOD0(getBattle, IBattleInfo*());
|
||||
MOCK_CONST_METHOD0(getPlayerID, std::optional<PlayerColor>());
|
||||
|
||||
MOCK_CONST_METHOD2(battleGetAllObstaclesOnPos, std::vector<std::shared_ptr<const CObstacleInstance>>(BattleHex, bool));
|
||||
MOCK_CONST_METHOD2(getAllAffectedObstaclesByStack, std::vector<std::shared_ptr<const CObstacleInstance>>(const battle::Unit *, const std::set<BattleHex> &));
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
//player
|
||||
MOCK_CONST_METHOD1(getPlayer, const Player *(PlayerColor));
|
||||
MOCK_CONST_METHOD0(getLocalPlayer, PlayerColor());
|
||||
MOCK_CONST_METHOD0(getPlayerID, std::optional<PlayerColor>());
|
||||
|
||||
//hero
|
||||
MOCK_CONST_METHOD1(getHero, const CGHeroInstance *(ObjectInstanceID));
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../lib/battle/IBattleState.h"
|
||||
#include "../../lib/int3.h"
|
||||
|
||||
class BattleStateMock : public IBattleState
|
||||
{
|
||||
@@ -34,8 +35,12 @@ public:
|
||||
MOCK_CONST_METHOD0(getBonusBearer, const IBonusBearer *());
|
||||
MOCK_CONST_METHOD0(nextUnitId, uint32_t());
|
||||
MOCK_CONST_METHOD3(getActualDamage, int64_t(const DamageRange &, int32_t, vstd::RNG &));
|
||||
MOCK_CONST_METHOD0(getBattleID, BattleID());
|
||||
MOCK_CONST_METHOD0(getLocation, int3());
|
||||
MOCK_CONST_METHOD0(isCreatureBank, bool());
|
||||
MOCK_CONST_METHOD1(getUsedSpells, std::vector<SpellID>(ui8));
|
||||
|
||||
MOCK_METHOD1(nextRound, void(int32_t));
|
||||
MOCK_METHOD0(nextRound, void());
|
||||
MOCK_METHOD1(nextTurn, void(uint32_t));
|
||||
MOCK_METHOD2(addUnit, void(uint32_t, const JsonNode &));
|
||||
MOCK_METHOD3(setUnitState, void(uint32_t, const JsonNode &, int64_t));
|
||||
|
||||
@@ -64,7 +64,6 @@ void ScriptFixture::setUp()
|
||||
{
|
||||
pool = std::make_shared<PoolMock>();
|
||||
|
||||
EXPECT_CALL(environmentMock, battle()).WillRepeatedly(Return(&binfoMock));
|
||||
EXPECT_CALL(environmentMock, game()).WillRepeatedly(Return(&infoMock));
|
||||
EXPECT_CALL(environmentMock, logger()).WillRepeatedly(Return(&loggerMock));
|
||||
EXPECT_CALL(environmentMock, eventBus()).WillRepeatedly(Return(&eventBus));
|
||||
|
||||
Reference in New Issue
Block a user