diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 03:26:25 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-12 03:26:25 +0000 |
commit | 95b6410d01c83492c108ca117c41aee03c774225 (patch) | |
tree | 0de198b5b3b78a1b7cdbba9b7ac6210000511bfe /o3d | |
parent | 2c76397c5f2905238200294b70388ce52603a4d6 (diff) | |
download | chromium_src-95b6410d01c83492c108ca117c41aee03c774225.zip chromium_src-95b6410d01c83492c108ca117c41aee03c774225.tar.gz chromium_src-95b6410d01c83492c108ca117c41aee03c774225.tar.bz2 |
...
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23156 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r-- | o3d/core/cross/image_utils_test.cc | 16 | ||||
-rw-r--r-- | o3d/core/cross/message_commands_test.cc | 107 |
2 files changed, 65 insertions, 58 deletions
diff --git a/o3d/core/cross/image_utils_test.cc b/o3d/core/cross/image_utils_test.cc index 58cebdf..ae069e0 100644 --- a/o3d/core/cross/image_utils_test.cc +++ b/o3d/core/cross/image_utils_test.cc @@ -73,14 +73,14 @@ TEST_F(ImageTest, ComputePOTSize) { } TEST_F(ImageTest, CanMakeMips) { - EXPECT_TRUE(image::CanMakeMips(Texture::Format::XRGB8)); - EXPECT_TRUE(image::CanMakeMips(Texture::Format::ARGB8)); - EXPECT_TRUE(image::CanMakeMips(Texture::Format::ABGR16F)); - EXPECT_TRUE(image::CanMakeMips(Texture::Format::R32F)); - EXPECT_TRUE(image::CanMakeMips(Texture::Format::ABGR32F)); - EXPECT_FALSE(image::CanMakeMips(Texture::Format::DXT1)); - EXPECT_FALSE(image::CanMakeMips(Texture::Format::DXT3)); - EXPECT_FALSE(image::CanMakeMips(Texture::Format::DXT5)); + EXPECT_TRUE(image::CanMakeMips(Texture::XRGB8)); + EXPECT_TRUE(image::CanMakeMips(Texture::ARGB8)); + EXPECT_TRUE(image::CanMakeMips(Texture::ABGR16F)); + EXPECT_TRUE(image::CanMakeMips(Texture::R32F)); + EXPECT_TRUE(image::CanMakeMips(Texture::ABGR32F)); + EXPECT_FALSE(image::CanMakeMips(Texture::DXT1)); + EXPECT_FALSE(image::CanMakeMips(Texture::DXT3)); + EXPECT_FALSE(image::CanMakeMips(Texture::DXT5)); }; static const uint8 kScaleUPDataNPOT[] = { diff --git a/o3d/core/cross/message_commands_test.cc b/o3d/core/cross/message_commands_test.cc index ca0c72b..add1010 100644 --- a/o3d/core/cross/message_commands_test.cc +++ b/o3d/core/cross/message_commands_test.cc @@ -41,90 +41,97 @@ class MessageCommandsTest : public testing::Test { TEST_F(MessageCommandsTest, GetMessageDescription) {
EXPECT_STREQ(IMCMessage::GetMessageDescription(
IMCMessage::ALLOCATE_SHARED_MEMORY), "ALLOCATE_SHARED_MEMORY");
-};
+}
TEST_F(MessageCommandsTest, IMCMessage) {
IMCMessage msg(IMCMessage::INVALID_ID);
EXPECT_EQ(IMCMessage::INVALID_ID, msg.message_id);
- EXPECT_EQ(4, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(IMCMessage, message_id));
+ EXPECT_EQ(4u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(IMCMessage, message_id));
}
-TEST_F(MessageCommandsTest, MessageInvalidId) {
- MessageInvalidId msg();
+TEST_F(MessageCommandsTest, MessageInvalidIdTest) {
+ MessageInvalidId msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::INVALID_ID), 0);
EXPECT_EQ(IMCMessage::INVALID_ID, MessageInvalidId::kMessageId);
EXPECT_EQ(IMCMessage::INVALID_ID, msg.message_id);
- EXPECT_EQ(4, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageInvalidId, message_id));
+ EXPECT_EQ(4u, sizeof(msg));
+ EXPECT_EQ(0u, offsetof(MessageInvalidId, message_id));
}
-TEST_F(MessageHCommandsTest, MessageHello) {
- MessageHello msg();
+TEST_F(MessageCommandsTest, MessageHelloTest) {
+ MessageHello msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::HELLO), 1);
EXPECT_EQ(IMCMessage::HELLO, MessageHello::kMessageId);
- EXPECT_EQ(IMCMessage::HELLO, msg.message_id);
- EXPECT_EQ(4, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageHello, message_id));
+ EXPECT_EQ(msg.message_id, IMCMessage::HELLO);
+ EXPECT_EQ(4u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(MessageHello, message_id));
}
-TEST_F(MessageCommandsTest, MessageAllocateSharedMemory) {
- MessageAllocateSharedMemory msg();
+TEST_F(MessageCommandsTest, MessageAllocateSharedMemoryTest) {
+ MessageAllocateSharedMemory msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::ALLOCATE_SHARED_MEMORY), 2);
EXPECT_EQ(IMCMessage::ALLOCATE_SHARED_MEMORY,
MessageAllocateSharedMemory::kMessageId);
EXPECT_EQ(IMCMessage::ALLOCATE_SHARED_MEMORY, msg.message_id);
- EXPECT_EQ(8, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageAllocateSharedMemory, message_id));
- EXPECT_EQ(4, OFFSETOF(MessageAllocateSharedMemory, mem_size));
+ EXPECT_EQ(8u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(MessageAllocateSharedMemory, message_id));
+ EXPECT_EQ(4u, offsetof(MessageAllocateSharedMemory, mem_size));
+}
+
+TEST_F(MessageCommandsTest, MessageUpdateTexture2D) {
+ MessageUpdateTexture2D msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::UPDATE_TEXTURE2D), 3);
+ EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, MessageUpdateTexture2D::kMessageId);
+ EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, msg.message_id);
+ EXPECT_EQ(24u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(MessageUpdateTexture2D, message_id));
+ EXPECT_EQ(4u, offsetof(MessageUpdateTexture2D, texture_id));
+ EXPECT_EQ(8u, offsetof(MessageUpdateTexture2D, level));
+ EXPECT_EQ(12u, offsetof(MessageUpdateTexture2D, shared_memory_id));
+ EXPECT_EQ(16u, offsetof(MessageUpdateTexture2D, offset));
+ EXPECT_EQ(20u, offsetof(MessageUpdateTexture2D, number_of_bytes));
}
TEST_F(MessageCommandsTest, MessageRegisterSharedMemory) {
- MessageRegisterSharedMemory msg();
+ MessageRegisterSharedMemory msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::REGISTER_SHARED_MEMORY), 4);
EXPECT_EQ(IMCMessage::REGISTER_SHARED_MEMORY,
MessageRegisterSharedMemory::kMessageId);
EXPECT_EQ(IMCMessage::REGISTER_SHARED_MEMORY, msg.message_id);
- EXPECT_EQ(8, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageRegisterSharedMemory, message_id));
- EXPECT_EQ(4, OFFSETOF(MessageRegisterSharedMemory, mem_size));
+ EXPECT_EQ(8u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(MessageRegisterSharedMemory, message_id));
+ EXPECT_EQ(4u, offsetof(MessageRegisterSharedMemory, mem_size));
}
TEST_F(MessageCommandsTest, MessageUnregisterSharedMemory) {
- MessageUnregisterSharedMemory msg();
+ MessageUnregisterSharedMemory msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::UNREGISTER_SHARED_MEMORY), 5);
EXPECT_EQ(IMCMessage::UNREGISTER_SHARED_MEMORY,
MessageUnregisterSharedMemory::kMessageId);
EXPECT_EQ(IMCMessage::UNREGISTER_SHARED_MEMORY, msg.message_id);
- EXPECT_EQ(8, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageUnregisterSharedMemory, message_id));
- EXPECT_EQ(4, OFFSETOF(MessageUnregisterSharedMemory, buffer_id));
-}
-
-TEST_F(MessageCommandsTest, MessageUpdateTexture2D) {
- MessageUpdateTexture2D msg();
- EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, MessageUpdateTexture2D::kMessageId);
- EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D, msg.message_id);
- EXPECT_EQ(24, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageUpdateTexture2D, message_id));
- EXPECT_EQ(4, OFFSETOF(MessageUpdateTexture2D, texture_id));
- EXPECT_EQ(8, OFFSETOF(MessageUpdateTexture2D, level));
- EXPECT_EQ(12, OFFSETOF(MessageUpdateTexture2D, shared_memory_id));
- EXPECT_EQ(16, OFFSETOF(MessageUpdateTexture2D, offset));
- EXPECT_EQ(20, OFFSETOF(MessageUpdateTexture2D, number_of_bytes));
+ EXPECT_EQ(8u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(MessageUnregisterSharedMemory, message_id));
+ EXPECT_EQ(4u, offsetof(MessageUnregisterSharedMemory, buffer_id));
}
TEST_F(MessageCommandsTest, MessageUpdateTexture2DRect) {
- MessageUpdateTexture2DRect msg();
+ MessageUpdateTexture2DRect msg;
+ EXPECT_EQ(static_cast<int>(IMCMessage::UPDATE_TEXTURE2D_RECT), 6);
EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D_RECT,
MessageUpdateTexture2DRect::kMessageId);
EXPECT_EQ(IMCMessage::UPDATE_TEXTURE2D_RECT, msg.message_id);
- EXPECT_EQ(40, sizeof(msg));
- EXPECT_EQ(0, OFFSETOF(MessageUpdateTexture2D, message_id));
- EXPECT_EQ(4, OFFSETOF(MessageUpdateTexture2D, texture_id));
- EXPECT_EQ(8, OFFSETOF(MessageUpdateTexture2D, level));
- EXPECT_EQ(12, OFFSETOF(MessageUpdateTexture2D, x));
- EXPECT_EQ(16, OFFSETOF(MessageUpdateTexture2D, y));
- EXPECT_EQ(20, OFFSETOF(MessageUpdateTexture2D, width));
- EXPECT_EQ(24, OFFSETOF(MessageUpdateTexture2D, height));
- EXPECT_EQ(28, OFFSETOF(MessageUpdateTexture2D, shared_memory_id));
- EXPECT_EQ(32, OFFSETOF(MessageUpdateTexture2D, offset));
- EXPECT_EQ(36, OFFSETOF(MessageUpdateTexture2D, number_of_bytes));
+ EXPECT_EQ(40u, sizeof msg);
+ EXPECT_EQ(0u, offsetof(MessageUpdateTexture2DRect, message_id));
+ EXPECT_EQ(4u, offsetof(MessageUpdateTexture2DRect, texture_id));
+ EXPECT_EQ(8u, offsetof(MessageUpdateTexture2DRect, level));
+ EXPECT_EQ(12u, offsetof(MessageUpdateTexture2DRect, x));
+ EXPECT_EQ(16u, offsetof(MessageUpdateTexture2DRect, y));
+ EXPECT_EQ(20u, offsetof(MessageUpdateTexture2DRect, width));
+ EXPECT_EQ(24u, offsetof(MessageUpdateTexture2DRect, height));
+ EXPECT_EQ(28u, offsetof(MessageUpdateTexture2DRect, shared_memory_id));
+ EXPECT_EQ(32u, offsetof(MessageUpdateTexture2DRect, offset));
+ EXPECT_EQ(36u, offsetof(MessageUpdateTexture2DRect, number_of_bytes));
}
} // namespace o3d
|