refactor(tests): reorganize tests directory to match engine structure
- Created tests/Core/Asset/ with tests for IResource, ResourceTypes, ResourceHandle, ResourceCache, ResourceDependencyGraph, ResourceGUID - Created tests/Core/IO/ with tests for IResourceLoader, ResourcePath, ResourceFileSystem, FileArchive, ResourcePackage - Reorganized tests/Resources/ into subdirectories: Texture/, Mesh/, Material/, Shader/, AudioClip/ - Added CMakeLists.txt for each new test subdirectory - Fixed Material.h missing ResourceManager.h include (lost during engine refactor) - tests/Core/CMakeLists.txt updated to include Asset/ and IO/ subdirectories
This commit is contained in:
38
tests/Resources/Shader/test_shader_loader.cpp
Normal file
38
tests/Resources/Shader/test_shader_loader.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <XCEngine/Resources/Shader/ShaderLoader.h>
|
||||
#include <XCEngine/Core/Asset/ResourceTypes.h>
|
||||
#include <XCEngine/Core/Containers/Array.h>
|
||||
|
||||
using namespace XCEngine::Resources;
|
||||
using namespace XCEngine::Containers;
|
||||
|
||||
namespace {
|
||||
|
||||
TEST(ShaderLoader, GetResourceType) {
|
||||
ShaderLoader loader;
|
||||
EXPECT_EQ(loader.GetResourceType(), ResourceType::Shader);
|
||||
}
|
||||
|
||||
TEST(ShaderLoader, GetSupportedExtensions) {
|
||||
ShaderLoader loader;
|
||||
auto extensions = loader.GetSupportedExtensions();
|
||||
EXPECT_GE(extensions.Size(), 1u);
|
||||
}
|
||||
|
||||
TEST(ShaderLoader, CanLoad) {
|
||||
ShaderLoader loader;
|
||||
EXPECT_TRUE(loader.CanLoad("test.vert"));
|
||||
EXPECT_TRUE(loader.CanLoad("test.frag"));
|
||||
EXPECT_TRUE(loader.CanLoad("test.glsl"));
|
||||
EXPECT_TRUE(loader.CanLoad("test.hlsl"));
|
||||
EXPECT_FALSE(loader.CanLoad("test.txt"));
|
||||
EXPECT_FALSE(loader.CanLoad("test.png"));
|
||||
}
|
||||
|
||||
TEST(ShaderLoader, LoadInvalidPath) {
|
||||
ShaderLoader loader;
|
||||
LoadResult result = loader.Load("invalid/path/shader.glsl");
|
||||
EXPECT_FALSE(result);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
Reference in New Issue
Block a user