CHeroTest.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * CHeroTest.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "../../lib/CHeroHandler.h"
  12. namespace test
  13. {
  14. using namespace ::testing;
  15. class CHeroTest : public Test
  16. {
  17. public:
  18. MOCK_METHOD3(registarCb, void(int32_t, const std::string &, const std::string &));
  19. protected:
  20. std::shared_ptr<CHero> subject;
  21. void SetUp() override
  22. {
  23. subject = std::make_shared<CHero>();
  24. }
  25. };
  26. TEST_F(CHeroTest, RegistersIcons)
  27. {
  28. subject->imageIndex = 4242;
  29. subject->iconSpecSmall = "Test1";
  30. subject->iconSpecLarge = "Test2";
  31. subject->portraitSmall = "Test3";
  32. subject->portraitLarge = "Test4";
  33. auto cb = std::bind(&CHeroTest::registarCb, this, _1, _2, _3);
  34. EXPECT_CALL(*this, registarCb(Eq(4242), "UN32", "Test1"));
  35. EXPECT_CALL(*this, registarCb(Eq(4242), "UN44", "Test2"));
  36. EXPECT_CALL(*this, registarCb(Eq(4242), "PORTRAITSSMALL", "Test3"));
  37. EXPECT_CALL(*this, registarCb(Eq(4242), "PORTRAITSLARGE", "Test4"));
  38. subject->registerIcons(cb);
  39. }
  40. }