|
|
@@ -9,14 +9,18 @@
|
|
|
#include <window/SdlWindowApi.hpp>
|
|
|
#include <core/StatusCodes.hpp>
|
|
|
#include <ls-std/core/exception/IllegalArgumentException.hpp>
|
|
|
+#include <interface/AStatusCode.hpp>
|
|
|
+#include <string>
|
|
|
|
|
|
using ls::atlantis::core::StatusCodes;
|
|
|
+using ls::atlantis::interfaces::AStatusCode;
|
|
|
using ls::atlantis::interfaces::ISdlApi;
|
|
|
using ls::atlantis::window::SdlWindowApi;
|
|
|
using ls::atlantis::window::test::SdlApiMock;
|
|
|
using ls::std::core::IllegalArgumentException;
|
|
|
using ::std::make_shared;
|
|
|
using ::std::shared_ptr;
|
|
|
+using ::std::string;
|
|
|
using ::testing::Return;
|
|
|
using ::testing::StrEq;
|
|
|
using ::testing::Test;
|
|
|
@@ -61,10 +65,17 @@ namespace
|
|
|
|
|
|
TEST_F(SdlWindowApiTest, init_windowCreationFailed)
|
|
|
{
|
|
|
+ const string hint = "Upsi Dupsi";
|
|
|
+
|
|
|
EXPECT_CALL(*sdlApiMock, Init(SDL_INIT_VIDEO)).WillOnce(Return(1));
|
|
|
EXPECT_CALL(*sdlApiMock, CreateWindow(StrEq(""), 0, 0, SDL_WINDOW_FULLSCREEN)).WillOnce(Return(nullptr));
|
|
|
+ EXPECT_CALL(*sdlApiMock, GetError()).WillOnce(Return(hint.c_str()));
|
|
|
EXPECT_CALL(*sdlApiMock, Quit());
|
|
|
|
|
|
- ASSERT_EQ(StatusCodes::WINDOW_CREATION_FAILED, SdlWindowApi(sdlApiMock).init()->getId());
|
|
|
+ const shared_ptr<AStatusCode> statusCode = SdlWindowApi(sdlApiMock).init();
|
|
|
+
|
|
|
+ ASSERT_EQ(StatusCodes::WINDOW_CREATION_FAILED, statusCode->getId());
|
|
|
+ ASSERT_EQ(1, statusCode->getHints().size());
|
|
|
+ ASSERT_STREQ(hint.c_str(), statusCode->getHints()[0].c_str());
|
|
|
}
|
|
|
}
|