- 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
66 lines
1.6 KiB
C++
66 lines
1.6 KiB
C++
#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();
|
|
}
|