From 8a932fed3e5700af283017deab3cb1da11cb0dce Mon Sep 17 00:00:00 2001 From: Zaba999 Date: Thu, 11 Oct 2012 23:09:29 +0200 Subject: Added saving user scripts on game save. Fixed bug in writing script to file. --- src/ui/test/stubs/app_stub.cpp | 26 ++++++++++++ src/ui/test/stubs/engine_stub.cpp | 79 ++++++++++++++++++++++++++++++++++++ src/ui/test/stubs/restext_stub.cpp | 11 +++++ src/ui/test/stubs/robotmain_stub.cpp | 17 ++++++++ 4 files changed, 133 insertions(+) create mode 100644 src/ui/test/stubs/app_stub.cpp create mode 100644 src/ui/test/stubs/engine_stub.cpp create mode 100644 src/ui/test/stubs/restext_stub.cpp create mode 100644 src/ui/test/stubs/robotmain_stub.cpp (limited to 'src/ui/test/stubs') diff --git a/src/ui/test/stubs/app_stub.cpp b/src/ui/test/stubs/app_stub.cpp new file mode 100644 index 0000000..5dd79e4 --- /dev/null +++ b/src/ui/test/stubs/app_stub.cpp @@ -0,0 +1,26 @@ +#include "../../app/app.h" +#include "../../graphics/opengl/gldevice.h" + +template<> CApplication* CSingleton::mInstance = nullptr; + +namespace Gfx { + +GLDeviceConfig::GLDeviceConfig() +{ +} + +} /* Gfx */ +CApplication::CApplication() +{ +} + +CApplication::~CApplication() +{ +} + +std::string CApplication::GetDataFilePath(DataDir /* dataDir */, const std::string& subpath) +{ + return subpath; +} + + diff --git a/src/ui/test/stubs/engine_stub.cpp b/src/ui/test/stubs/engine_stub.cpp new file mode 100644 index 0000000..6ec6006 --- /dev/null +++ b/src/ui/test/stubs/engine_stub.cpp @@ -0,0 +1,79 @@ +#include "../../graphics/engine/engine.h" +#include "../../graphics/engine/text.h" +#include "../mocks/text_mock.h" + +namespace Gfx { + +CEngine::CEngine(CInstanceManager* iMan, CApplication* app) : + m_iMan(iMan), m_app(app) +{ + m_text = new CTextMock(m_iMan, this); + m_text->Create(); +} + +CEngine::~CEngine() +{ + delete m_text; + m_text = NULL; +} + +Math::Point CEngine::WindowToInterfaceSize(Math::IntPoint size) +{ + return Math::Point(size.x, size.y); +} + +void CEngine::SetState(int state, const Color& color) +{ + if (state == m_lastState && color == m_lastColor) + return; + + m_lastState = state; + m_lastColor = color; +} + +Math::IntPoint CEngine::GetWindowSize() +{ + return m_size; +} + +void CEngine::AddStatisticTriangle(int count) +{ + m_statisticTriangle += count; +} + +void CEngine::SetMouseType(EngineMouseType type) +{ + m_mouseType = type; +} + +bool CEngine::SetTexture(const std::string& /* name */, int /* stage */) +{ + return true; +} + +CText* CEngine::GetText() +{ + return m_text; +} + +CDevice* CEngine::GetDevice() +{ + return m_device; +} + +int CEngine::GetEditIndentValue() +{ + return m_editIndentValue; +} + +void CEngine::DeleteTexture(const std::string& /* texName */) +{ +} +Texture CEngine::LoadTexture(const std::string& /* name */) +{ + Texture texture; + return texture; +} + +} /* Gfx */ + diff --git a/src/ui/test/stubs/restext_stub.cpp b/src/ui/test/stubs/restext_stub.cpp new file mode 100644 index 0000000..c1986ca --- /dev/null +++ b/src/ui/test/stubs/restext_stub.cpp @@ -0,0 +1,11 @@ +#include "../../common/restext.h" +bool GetResource(ResType /* type */, int /* num */, char* /* text */) +{ + return true; +} + +bool SearchKey(const char * /* cmd */, InputSlot & /* key */) +{ + return true; +} + diff --git a/src/ui/test/stubs/robotmain_stub.cpp b/src/ui/test/stubs/robotmain_stub.cpp new file mode 100644 index 0000000..93e0e82 --- /dev/null +++ b/src/ui/test/stubs/robotmain_stub.cpp @@ -0,0 +1,17 @@ +#include "../../object/robotmain.h" + + +template<> CRobotMain* CSingleton::mInstance = nullptr; + +bool CRobotMain::GetGlint() +{ + return false; +} + +const InputBinding& CRobotMain::GetInputBinding(InputSlot slot) +{ + unsigned int index = static_cast(slot); + assert(index >= 0 && index < INPUT_SLOT_MAX); + return m_inputBindings[index]; +} + -- cgit v1.2.3-1-g7c22