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:
65
tests/RHI/OpenGL/unit/test_render_target_view.cpp
Normal file
65
tests/RHI/OpenGL/unit/test_render_target_view.cpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#include "fixtures/OpenGLTestFixture.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLRenderTargetView.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLTexture.h"
|
||||
|
||||
using namespace XCEngine::RHI;
|
||||
|
||||
TEST_F(OpenGLTestFixture, RenderTargetView_Initialize_Texture2D) {
|
||||
OpenGLTexture texture;
|
||||
texture.Initialize2D(64, 64, 4, nullptr, false);
|
||||
|
||||
OpenGLRenderTargetView rtv;
|
||||
bool result = rtv.Initialize(texture.GetID());
|
||||
|
||||
ASSERT_TRUE(result);
|
||||
EXPECT_NE(rtv.GetFramebuffer(), 0u);
|
||||
|
||||
rtv.Shutdown();
|
||||
texture.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, RenderTargetView_Bind_Unbind) {
|
||||
OpenGLTexture texture;
|
||||
texture.Initialize2D(64, 64, 4, nullptr, false);
|
||||
|
||||
OpenGLRenderTargetView rtv;
|
||||
rtv.Initialize(texture.GetID());
|
||||
|
||||
rtv.Bind();
|
||||
GLint boundFBO = 0;
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFBO);
|
||||
EXPECT_NE(boundFBO, 0);
|
||||
|
||||
rtv.Unbind();
|
||||
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &boundFBO);
|
||||
EXPECT_EQ(boundFBO, 0);
|
||||
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user