CArtifactTest.cpp 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * CArtifactTest.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/CArtHandler.h"
  12. namespace test
  13. {
  14. using namespace ::testing;
  15. class CArtifactTest : public Test
  16. {
  17. public:
  18. MOCK_METHOD4(registarCb, void(int32_t, int32_t, const std::string &, const std::string &));
  19. protected:
  20. std::shared_ptr<CArtifact> subject;
  21. void SetUp() override
  22. {
  23. subject = std::make_shared<CArtifact>();
  24. }
  25. };
  26. TEST_F(CArtifactTest, RegistersIcons)
  27. {
  28. subject->iconIndex = 4242;
  29. subject->image = "Test1";
  30. subject->large = "Test2";
  31. auto cb = [this](auto && PH1, auto && PH2, auto && PH3, auto && PH4)
  32. {
  33. registarCb(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2), std::forward<decltype(PH3)>(PH3), std::forward<decltype(PH4)>(PH4));
  34. };
  35. EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "ARTIFACT", "Test1"));
  36. EXPECT_CALL(*this, registarCb(Eq(4242), Eq(0), "ARTIFACTLARGE", "Test2"));
  37. subject->registerIcons(cb);
  38. }
  39. }