summaryrefslogtreecommitdiff
path: root/tests
diff options
authorManuel de la Pena <manuel@canonical.com>2012-12-11 16:03:23 +0100
committerManuel de la Pena <manuel@canonical.com>2012-12-11 16:03:23 +0100
commitaae55ad2e337d26b09859f3d02a42d72393252af (patch)
tree517e23de2db07c3e1cd39588c6bf1d3bbd15ae1e /tests
parent4ef98f75ac0d985e827c56f77234eaa2b180bfca (diff)
parent0deba28329ffea282878b29f5d7697c7bc624aa6 (diff)
Merged with static cairo text fix.
(bzr r2791.11.54)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_static_cairo_text.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/test_static_cairo_text.cpp b/tests/test_static_cairo_text.cpp
index 2553349ac..618af4f27 100644
--- a/tests/test_static_cairo_text.cpp
+++ b/tests/test_static_cairo_text.cpp
@@ -33,17 +33,33 @@ namespace
class MockStaticCairoText : public nux::StaticCairoText
{
public:
+ MOCK_METHOD2(SetBaseSize, void(int, int));
+
MockStaticCairoText():StaticCairoText("") {}
using StaticCairoText::GetTextureStartIndices;
using StaticCairoText::GetTextureEndIndices;
+ using StaticCairoText::PreLayoutManagement;
};
-TEST(TestStaticCairoText, TextTextureSize)
+class TestStaticCairoText : public ::testing::Test
{
+
+protected:
+ TestStaticCairoText() : Test()
+ {
+ text = new MockStaticCairoText();
+ }
+
+ nux::ObjectPtr<MockStaticCairoText> text;
+
+};
+
+TEST_F(TestStaticCairoText, TextTextureSize)
+{
+ EXPECT_CALL(*text.GetPointer(), SetBaseSize(_, _)).Times(AnyNumber());
// Test multi-texture stitching support.
- nux::ObjectPtr<MockStaticCairoText> text(new MockStaticCairoText());
text->SetLines(-2000);
text->SetMaximumWidth(100);
@@ -70,4 +86,16 @@ TEST(TestStaticCairoText, TextTextureSize)
}
}
+TEST_F(TestStaticCairoText, TextPreLayoutManagementMultipleCalls)
+{
+ EXPECT_CALL(*text.GetPointer(), SetBaseSize(_, _)).Times(2);
+ text->PreLayoutManagement();
+
+ // the first prelayout methods should have called set base size and therefore
+ // we should not call it again
+
+ EXPECT_CALL(*text.GetPointer(), SetBaseSize(_, _)).Times(0);
+ text->PreLayoutManagement();
+}
+
}