OpenGL: Restructure tests similar to D3D12 layout

- Move old test files to new unit/integration structure
- Add OpenGL Test Fixture
- Update CMakeLists.txt for new layout
- Add OpenGL_Test_Restructuring_Plan.md
This commit is contained in:
2026-03-20 17:37:09 +08:00
parent 3cd3b04c7e
commit 0a19fdfb0f
19 changed files with 843 additions and 103 deletions

View File

@@ -0,0 +1,60 @@
#include "fixtures/OpenGLTestFixture.h"
#include "XCEngine/RHI/OpenGL/OpenGLSampler.h"
using namespace XCEngine::RHI;
TEST_F(OpenGLTestFixture, Sampler_Initialize_Default) {
OpenGLSampler sampler;
OpenGLSamplerDesc desc;
bool result = sampler.Initialize(desc);
ASSERT_TRUE(result);
EXPECT_NE(sampler.GetID(), 0u);
sampler.Shutdown();
}
TEST_F(OpenGLTestFixture, Sampler_Initialize_Custom) {
OpenGLSampler sampler;
OpenGLSamplerDesc desc;
desc.minFilter = SamplerFilter::LinearMipmapLinear;
desc.magFilter = SamplerFilter::Linear;
desc.wrapS = SamplerWrapMode::Repeat;
desc.wrapT = SamplerWrapMode::Repeat;
desc.wrapR = SamplerWrapMode::ClampToEdge;
bool result = sampler.Initialize(desc);
ASSERT_TRUE(result);
EXPECT_NE(sampler.GetID(), 0u);
sampler.Shutdown();
}
TEST_F(OpenGLTestFixture, Sampler_Bind_Unbind) {
OpenGLSampler sampler;
OpenGLSamplerDesc desc;
sampler.Initialize(desc);
sampler.Bind(0);
GLint boundSampler = 0;
glGetIntegerv(GL_SAMPLER_BINDING, &boundSampler);
EXPECT_EQ(boundSampler, static_cast<GLint>(sampler.GetID()));
sampler.Unbind(0);
glGetIntegerv(GL_SAMPLER_BINDING, &boundSampler);
EXPECT_EQ(boundSampler, 0);
sampler.Shutdown();
}
TEST_F(OpenGLTestFixture, Sampler_GetID_ReturnsValid) {
OpenGLSampler sampler;
OpenGLSamplerDesc desc;
sampler.Initialize(desc);
EXPECT_NE(sampler.GetID(), 0u);
sampler.Shutdown();
}