Complete OpenGL test suite - 56 tests

Added missing tests to reach planned 56:
- CommandList: EnableDisable_DepthTest, EnableDisable_Blending
- RTV: GetTexture, GetMipLevel
- DSV: Initialize_Texture, GetTexture, GetMipLevel

Final count: 56 tests across all 12 components
This commit is contained in:
2026-03-17 12:48:17 +08:00
parent 7bf586f6fa
commit f2ae95e0a7
5 changed files with 94 additions and 26 deletions

View File

@@ -1,24 +0,0 @@
[2026-03-15 17:36:10] [DEBUG] [Rendering] [DEBUG] D3D12 Test Application Started
[2026-03-15 17:52:42] [DEBUG] [Rendering] [DEBUG] D3D12 Test Application Started
[2026-03-15 17:52:53] [DEBUG] [Rendering] [DEBUG] D3D12 Test Application Started
[2026-03-15 17:57:07] [DEBUG] [Rendering] [DEBUG] D3D12 Test Application Started
[2026-03-16 13:25:12] [DEBUG] [Rendering] [DEBUG] D3D12 Test Application Started
[2026-03-16 13:25:13] [DEBUG] [Rendering] [DEBUG] Texture loaded: width=-858993460, height=-858993460, channels=-858993460, pixels=0000000000000000
[2026-03-16 13:25:13] [DEBUG] [Rendering] [DEBUG] WaitForCompletion: completed=1, waiting for=1
[2026-03-16 13:25:13] [DEBUG] [Rendering] [DEBUG] WaitForCompletion: completed=1, waiting for=1
[2026-03-17 00:39:42] [DEBUG] [Rendering] [DEBUG] D3D12 Test Application Started
[2026-03-17 00:39:42] [DEBUG] [Rendering] [DEBUG] Texture loaded: width=-858993460, height=-858993460, channels=-858993460, pixels=0000000000000000
[2026-03-17 00:39:42] [DEBUG] [Rendering] [DEBUG] WaitForCompletion: completed=1, waiting for=1
[2026-03-17 00:39:42] [DEBUG] [Rendering] [DEBUG] WaitForCompletion: completed=1, waiting for=1

View File

@@ -1,2 +0,0 @@
@echo off
dir /b "D:\Xuanchi\Main\XCEngine"

View File

@@ -104,3 +104,29 @@ TEST_F(OpenGLTestFixture, CommandList_SetScissor) {
EXPECT_EQ(scissor[2], 800);
EXPECT_EQ(scissor[3], 600);
}
TEST_F(OpenGLTestFixture, CommandList_EnableDisable_DepthTest) {
OpenGLCommandList cmdList;
cmdList.EnableDepthTest(true);
GLint depthTest = 0;
glGetIntegerv(GL_DEPTH_TEST, &depthTest);
EXPECT_EQ(depthTest, 1);
cmdList.EnableDepthTest(false);
glGetIntegerv(GL_DEPTH_TEST, &depthTest);
EXPECT_EQ(depthTest, 0);
}
TEST_F(OpenGLTestFixture, CommandList_EnableDisable_Blending) {
OpenGLCommandList cmdList;
cmdList.EnableBlending(true);
GLint blend = 0;
glGetIntegerv(GL_BLEND, &blend);
EXPECT_EQ(blend, 1);
cmdList.EnableBlending(false);
glGetIntegerv(GL_BLEND, &blend);
EXPECT_EQ(blend, 0);
}

View File

@@ -1,5 +1,6 @@
#include "fixtures/OpenGLTestFixture.h"
#include "XCEngine/RHI/OpenGL/OpenGLDepthStencilView.h"
#include "XCEngine/RHI/OpenGL/OpenGLTexture.h"
using namespace XCEngine::RHI;
@@ -16,3 +17,44 @@ TEST_F(OpenGLTestFixture, DepthStencilView_Bind_Unbind) {
dsv.Shutdown();
}
TEST_F(OpenGLTestFixture, DepthStencilView_Initialize_Texture) {
OpenGLTexture texture;
texture.Initialize2D(64, 64, 4, nullptr, false);
OpenGLDepthStencilView dsv;
bool result = dsv.Initialize(texture.GetID());
if (result) {
EXPECT_NE(dsv.GetFramebuffer(), 0u);
dsv.Shutdown();
}
texture.Shutdown();
}
TEST_F(OpenGLTestFixture, DepthStencilView_GetTexture) {
OpenGLTexture texture;
texture.Initialize2D(64, 64, 4, nullptr, false);
OpenGLDepthStencilView dsv;
dsv.Initialize(texture.GetID());
EXPECT_EQ(dsv.GetTexture(), texture.GetID());
dsv.Shutdown();
texture.Shutdown();
}
TEST_F(OpenGLTestFixture, DepthStencilView_GetMipLevel) {
OpenGLTexture texture;
texture.Initialize2D(64, 64, 4, nullptr, false);
OpenGLDepthStencilView dsv;
dsv.Initialize(texture.GetID(), 2);
EXPECT_EQ(dsv.GetMipLevel(), 2);
dsv.Shutdown();
texture.Shutdown();
}

View File

@@ -37,3 +37,29 @@ TEST_F(OpenGLTestFixture, RenderTargetView_Bind_Unbind) {
rtv.Shutdown();
texture.Shutdown();
}
TEST_F(OpenGLTestFixture, RenderTargetView_GetTexture) {
OpenGLTexture texture;
texture.Initialize2D(64, 64, 4, nullptr, false);
OpenGLRenderTargetView rtv;
rtv.Initialize(texture.GetID());
EXPECT_EQ(rtv.GetTexture(), texture.GetID());
rtv.Shutdown();
texture.Shutdown();
}
TEST_F(OpenGLTestFixture, RenderTargetView_GetMipLevel) {
OpenGLTexture texture;
texture.Initialize2D(64, 64, 4, nullptr, false);
OpenGLRenderTargetView rtv;
rtv.Initialize(texture.GetID(), 0);
EXPECT_EQ(rtv.GetMipLevel(), 0);
rtv.Shutdown();
texture.Shutdown();
}