summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2013-12-20 20:18:30 +0100
committerPiotr Dziwinski <piotrdz@gmail.com>2013-12-20 20:18:30 +0100
commit95661918ce5da32cce84055e80fcc15343591638 (patch)
tree0356b59d13cd1b59bdfc42ddc550700a32109372 /test
parent8deb1305726966b3b583865dec1ba7ba1327d8cb (diff)
downloadcolobot-95661918ce5da32cce84055e80fcc15343591638.tar.gz
colobot-95661918ce5da32cce84055e80fcc15343591638.tar.bz2
colobot-95661918ce5da32cce84055e80fcc15343591638.zip
Some further refactoring and test corrections
Diffstat (limited to 'test')
-rw-r--r--test/unit/ui/edit_test.cpp3
-rw-r--r--test/unit/ui/mocks/text_mock.h16
-rw-r--r--test/unit/ui/stubs/restext_stub.cpp2
3 files changed, 16 insertions, 5 deletions
diff --git a/test/unit/ui/edit_test.cpp b/test/unit/ui/edit_test.cpp
index 21af00f..4a4063e 100644
--- a/test/unit/ui/edit_test.cpp
+++ b/test/unit/ui/edit_test.cpp
@@ -51,6 +51,7 @@ protected:
};
using ::testing::_;
+using ::testing::An;
using ::testing::Return;
TEST_F(CEditTest, WriteTest)
@@ -58,7 +59,7 @@ TEST_F(CEditTest, WriteTest)
ASSERT_TRUE(true);
CTextMock * text = dynamic_cast<CTextMock *>(m_engine->GetText());
EXPECT_CALL(*text, GetCharWidth(_, _, _, _)).WillRepeatedly(Return(1.0f));
- EXPECT_CALL(*text, GetStringWidth(_, _, _, _)).WillOnce(Return(1.0f));
+ EXPECT_CALL(*text, GetStringWidth(An<const std::string&>(), _, _, _)).WillOnce(Return(1.0f));
std::string filename = "test.file";
m_edit->SetMaxChar(Ui::EDITSTUDIOMAX);
m_edit->SetAutoIndent(true);
diff --git a/test/unit/ui/mocks/text_mock.h b/test/unit/ui/mocks/text_mock.h
index f38b977..b9af6d3 100644
--- a/test/unit/ui/mocks/text_mock.h
+++ b/test/unit/ui/mocks/text_mock.h
@@ -15,11 +15,21 @@ public:
{
};
- MOCK_METHOD4(GetCharWidth, float(Gfx::UTF8Char, Gfx::FontType, float, float));
+ MOCK_METHOD4(GetCharWidth, float(Gfx::UTF8Char ch,
+ Gfx::FontType type,
+ float size,
+ float offset));
MOCK_METHOD4(GetStringWidth, float(const std::string &text,
std::vector<Gfx::FontMetaChar>::iterator format,
- std::vector<Gfx::FontMetaChar>::iterator end, float size));
- MOCK_METHOD3(GetStringWidth, float(const std::string &, Gfx::FontType, float));
+ std::vector<Gfx::FontMetaChar>::iterator end,
+ float size));
+ MOCK_METHOD3(GetStringWidth, float(std::string text,
+ Gfx::FontType font,
+ float size));
+ MOCK_METHOD4(GetStringWidth, float(Gfx::UTF8Char ch,
+ Gfx::FontType font,
+ float size,
+ float offset));
};
diff --git a/test/unit/ui/stubs/restext_stub.cpp b/test/unit/ui/stubs/restext_stub.cpp
index 004da19..fa47da6 100644
--- a/test/unit/ui/stubs/restext_stub.cpp
+++ b/test/unit/ui/stubs/restext_stub.cpp
@@ -1,6 +1,6 @@
#include "common/restext.h"
-bool GetResource(ResType /* type */, int /* num */, char* /* text */)
+bool GetResource(ResType /* type */, int /* num */, std::string& /* text */)
{
return true;
}