chore: snapshot editor work and restore tests
Key points:\n- restore the tests tree removed by bc47e6e\n- capture current editor workspace, scene, and docs reshuffle changes\n- keep local cloud.nvdb resources ignored from this commit
This commit is contained in:
63
tests/Resources/Texture/test_texture.cpp
Normal file
63
tests/Resources/Texture/test_texture.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <XCEngine/Resources/Texture/Texture.h>
|
||||
#include <XCEngine/Core/Asset/ResourceTypes.h>
|
||||
#include <XCEngine/Core/Asset/ResourceManager.h>
|
||||
|
||||
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
|
||||
Reference in New Issue
Block a user