- Add CommandList tests: Clear (color/depth/stencil), SetIndexBuffer, Draw (VAO), SetViewport, SetScissor - Add RTV tests: Initialize (Texture2D), Bind/Unbind - Add DSV tests: Bind/Unbind - Simplify tests to work with available GL context
40 lines
1.0 KiB
C++
40 lines
1.0 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();
|
|
}
|