Files
XCEngine/tests/RHI/OpenGL/test_depth_stencil_view.cpp

61 lines
1.4 KiB
C++
Raw Normal View History

#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();
}