#include #include #include #include using namespace XCEngine::Resources; namespace { TEST(Texture, DefaultConstructor) { Texture texture; EXPECT_EQ(texture.GetWidth(), 0u); EXPECT_EQ(texture.GetHeight(), 0u); EXPECT_EQ(texture.GetDepth(), 1u); EXPECT_EQ(texture.GetMipLevels(), 1u); EXPECT_EQ(texture.GetArraySize(), 1u); EXPECT_EQ(texture.GetTextureType(), TextureType::Texture2D); EXPECT_EQ(texture.GetFormat(), TextureFormat::RGBA8_UNORM); EXPECT_EQ(texture.GetUsage(), TextureUsage::ShaderResource); } TEST(Texture, GetMemorySize) { Texture texture; EXPECT_EQ(texture.GetMemorySize(), 0u); } TEST(Texture, GetType) { Texture texture; EXPECT_EQ(texture.GetType(), ResourceType::Texture); } TEST(Texture, IsValid) { Texture texture; EXPECT_FALSE(texture.IsValid()); } TEST(Texture, CreatePreservesExplicitTextureCubeArraySize) { Texture texture; const unsigned char pixels[6 * 4] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }; ASSERT_TRUE(texture.Create( 1, 1, 1, 1, TextureType::TextureCube, TextureFormat::RGBA8_UNORM, pixels, sizeof(pixels), 6)); EXPECT_EQ(texture.GetTextureType(), TextureType::TextureCube); EXPECT_EQ(texture.GetArraySize(), 6u); EXPECT_EQ(texture.GetPixelDataSize(), sizeof(pixels)); } } // namespace