From 705d7164ae472dd1b9669177bf3f99302a5dadf8 Mon Sep 17 00:00:00 2001 From: Konstantin P Date: Tue, 25 Apr 2023 12:45:48 +0300 Subject: [PATCH] vcmi: fix heal and teleport tests --- test/spells/effects/HealTest.cpp | 14 +++----------- test/spells/effects/TeleportTest.cpp | 1 - test/testdata/ObjectPropertyTest/header.json | 4 ++-- test/testdata/ObjectPropertyTest/objects.ex.json | 4 ++-- test/testdata/ObjectPropertyTest/objects.json | 4 ++-- test/testdata/TerrainTest/header.json | 4 ++-- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/test/spells/effects/HealTest.cpp b/test/spells/effects/HealTest.cpp index cb0ed65a1..e1e055ef0 100644 --- a/test/spells/effects/HealTest.cpp +++ b/test/spells/effects/HealTest.cpp @@ -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(_))).Times(AtLeast(1)); - break; - default: - break; - } - EXPECT_CALL(serverMock, apply(Matcher(_))).Times(1); + EXPECT_CALL(serverMock, apply(Matcher(_))).Times(AtLeast(1)); setupDefaultRNG(); diff --git a/test/spells/effects/TeleportTest.cpp b/test/spells/effects/TeleportTest.cpp index 70bef05c9..2bd751179 100644 --- a/test/spells/effects/TeleportTest.cpp +++ b/test/spells/effects/TeleportTest.cpp @@ -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)); diff --git a/test/testdata/ObjectPropertyTest/header.json b/test/testdata/ObjectPropertyTest/header.json index dfcb92067..32ddf1f18 100644 --- a/test/testdata/ObjectPropertyTest/header.json +++ b/test/testdata/ObjectPropertyTest/header.json @@ -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 } diff --git a/test/testdata/ObjectPropertyTest/objects.ex.json b/test/testdata/ObjectPropertyTest/objects.ex.json index 85cd411cd..2bb522d26 100644 --- a/test/testdata/ObjectPropertyTest/objects.ex.json +++ b/test/testdata/ObjectPropertyTest/objects.ex.json @@ -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" : { diff --git a/test/testdata/ObjectPropertyTest/objects.json b/test/testdata/ObjectPropertyTest/objects.json index 2ca059c41..96808ee40 100644 --- a/test/testdata/ObjectPropertyTest/objects.json +++ b/test/testdata/ObjectPropertyTest/objects.json @@ -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" : { diff --git a/test/testdata/TerrainTest/header.json b/test/testdata/TerrainTest/header.json index c05aa8f78..61a3fe41e 100644 --- a/test/testdata/TerrainTest/header.json +++ b/test/testdata/TerrainTest/header.json @@ -17,11 +17,11 @@ "width" : 32 } }, - "mods" : {}, + "mods" : null, "name" : "Untitled", "players" : {}, "triggeredEvents" : {}, "victoryIconIndex" : 0, "versionMajor" : 1, - "versionMinor" : 0 + "versionMinor" : 1 } \ No newline at end of file