1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

vcmi: entity tests passed

This commit is contained in:
Konstantin 2023-02-28 14:59:02 +03:00 committed by Konstantin P
parent 2680046dd0
commit 56601a0c2a
6 changed files with 33 additions and 7 deletions

View File

@ -36,7 +36,10 @@ TEST_F(CArtifactTest, RegistersIcons)
subject->image = "Test1";
subject->large = "Test2";
auto cb = std::bind(&CArtifactTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "ARTIFACT", "Test1"));
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "ARTIFACTLARGE", "Test2"));

View File

@ -35,7 +35,10 @@ TEST_F(CCreatureTest, RegistersIcons)
subject->smallIconName = "Test1";
subject->largeIconName = "Test2";
auto cb = std::bind(&CCreatureTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "CPRSMALL", "Test1"));
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "TWCRPORT", "Test2"));

View File

@ -41,13 +41,19 @@ TEST_F(CFactionTest, HasTown)
TEST_F(CFactionTest, RegistersNoIconsIfNoTown)
{
auto cb = std::bind(&CFactionTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
subject->registerIcons(cb);
}
TEST_F(CFactionTest, RegistersIcons)
{
auto cb = std::bind(&CFactionTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
subject->town = new CTown();
@ -67,6 +73,8 @@ TEST_F(CFactionTest, RegistersIcons)
info.iconSmall[0][1] = "Test20";
info.iconSmall[1][0] = "Test30";
info.iconSmall[1][1] = "Test40";
info.towerIconSmall = "Test5";
info.towerIconLarge = "Test6";
EXPECT_CALL(*this, registarCb(Eq(10), Eq(0), "ITPT", "Test1"));
@ -79,6 +87,9 @@ TEST_F(CFactionTest, RegistersIcons)
EXPECT_CALL(*this, registarCb(Eq(14), Eq(0), "ITPA", "Test30"));
EXPECT_CALL(*this, registarCb(Eq(15), Eq(0), "ITPA", "Test40"));
EXPECT_CALL(*this, registarCb(Eq(0), Eq(1), "CPRSMALL", "Test5"));
EXPECT_CALL(*this, registarCb(Eq(0), Eq(1), "TWCRPORT", "Test6"));
subject->registerIcons(cb);
}

View File

@ -32,7 +32,10 @@ protected:
TEST_F(CHeroClassTest, RegistersIconsDoesNothing)
{
auto cb = std::bind(&CHeroClassTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
subject->registerIcons(cb);
}

View File

@ -39,7 +39,10 @@ TEST_F(CHeroTest, RegistersIcons)
subject->portraitSmall = "Test3";
subject->portraitLarge = "Test4";
auto cb = std::bind(&CHeroTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "UN32", "Test1"));
EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "UN44", "Test2"));

View File

@ -41,7 +41,10 @@ TEST_F(CSkillTest, RegistersIcons)
skillAtLevel.iconLarge = "TestL"+std::to_string(level);
}
auto cb = std::bind(&CSkillTest::registarCb, this, _1, _2, _3, _4);
auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
{
registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
};
for(int level = 1; level <= 3; level++)
{