Files
XCEngine/tests/RHI/OpenGL/unit/test_depth_stencil_view.cpp
ssdfasd 12b71a319f 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
2026-04-25 22:11:47 +08:00

61 lines
1.4 KiB
C++

#include "fixtures/OpenGLTestFixture.h"
#include "XCEngine/RHI/OpenGL/OpenGLDepthStencilView.h"
#include "XCEngine/RHI/OpenGL/OpenGLTexture.h"
using namespace XCEngine::RHI;
TEST_F(OpenGLTestFixture, DepthStencilView_Bind_Unbind) {
OpenGLDepthStencilView dsv;
dsv.Initialize(0);
dsv.Bind();
GLint boundFBO = 0;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFBO);
dsv.Unbind();
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFBO);
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();
}