1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

vcmi: fix heal and teleport tests

This commit is contained in:
Konstantin P 2023-04-25 12:45:48 +03:00
parent e5f78a8997
commit 705d7164ae
6 changed files with 11 additions and 20 deletions

View File

@ -362,6 +362,8 @@ TEST_P(HealApplyTest, Heals)
mechanicsMock.caster = &actualCaster;
EXPECT_CALL(mechanicsMock, getEffectValue()).WillRepeatedly(Return(effectValue));
EXPECT_CALL(mechanicsMock, applySpellBonus(Eq(effectValue), Eq(&targetUnit))).WillRepeatedly(Return(effectValue));
EXPECT_CALL(actualCaster, creatureIndex()).WillRepeatedly(Return(CreatureID(unitId)));
EXPECT_CALL(actualCaster, getHeroCaster()).WillRepeatedly(Return(nullptr));
GTEST_ASSERT_EQ(targetUnitState->getAvailableHealth(), unitAmount * unitHP / 2 + 1);
GTEST_ASSERT_EQ(targetUnitState->getFirstHPleft(), 1);
@ -372,18 +374,8 @@ TEST_P(HealApplyTest, Heals)
EXPECT_CALL(actualCaster, getCasterUnitId()).WillRepeatedly(Return(-1));
//There should be battle log message if resurrect
switch(healLevel)
{
case EHealLevel::RESURRECT:
case EHealLevel::OVERHEAL:
EXPECT_CALL(serverMock, apply(Matcher<BattleLogMessage *>(_))).Times(AtLeast(1));
break;
default:
break;
}
EXPECT_CALL(serverMock, apply(Matcher<BattleUnitsChanged *>(_))).Times(1);
EXPECT_CALL(serverMock, apply(Matcher<BattleLogMessage *>(_))).Times(AtLeast(1));
setupDefaultRNG();

View File

@ -65,7 +65,6 @@ TEST_F(TeleportApplyTest, MovesUnit)
EXPECT_CALL(unit, getPosition()).WillRepeatedly(Return(initial));
EXPECT_CALL(unit, unitId()).Times(AtLeast(1)).WillRepeatedly(Return(unitId));
EXPECT_CALL(unit, unitSide()).Times(AtLeast(1));
EXPECT_CALL(unit, doubleWide()).WillRepeatedly(Return(false));
EXPECT_CALL(unit, isValidTarget(Eq(false))).WillRepeatedly(Return(true));

View File

@ -279,7 +279,7 @@
"width" : 144
}
},
"mods" : {},
"mods" : null,
"name" : "ObjectPropertyTest v1",
"players" : {
"blue" : {
@ -363,5 +363,5 @@
"victoryIconIndex" : 11,
"victoryString" : "Test victoryString",
"versionMajor" : 1,
"versionMinor" : 0
"versionMinor" : 1
}

View File

@ -2686,7 +2686,7 @@
"spellBook" : [
"core:fly"
],
"tightFormation" : true,
"formation" : "tight",
"type" : "core:ingham"
}
},
@ -5065,7 +5065,7 @@
"buildings" : {},
"hasFort" : false,
"spells" : {},
"tightFormation" : true
"tightFormation" : "tight"
}
},
"sign_189" : {

View File

@ -2686,7 +2686,7 @@
"spellBook" : [
"core:fly"
],
"tightFormation" : true,
"formation" : "tight",
"type" : "core:ingham"
}
},
@ -5065,7 +5065,7 @@
"buildings" : {},
"hasFort" : false,
"spells" : {},
"tightFormation" : true
"tightFormation" : "tight"
}
},
"sign_189" : {

View File

@ -17,11 +17,11 @@
"width" : 32
}
},
"mods" : {},
"mods" : null,
"name" : "Untitled",
"players" : {},
"triggeredEvents" : {},
"victoryIconIndex" : 0,
"versionMajor" : 1,
"versionMinor" : 0
"versionMinor" : 1
}