tests: remove legacy test tree
This commit is contained in:
@@ -1,115 +0,0 @@
|
||||
#include "fixtures/OpenGLTestFixture.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLVertexArray.h"
|
||||
#include "XCEngine/RHI/OpenGL/OpenGLBuffer.h"
|
||||
|
||||
using namespace XCEngine::RHI;
|
||||
|
||||
TEST_F(OpenGLTestFixture, VertexArray_Initialize_CreatesVAO) {
|
||||
OpenGLVertexArray vao;
|
||||
|
||||
bool result = vao.Initialize();
|
||||
|
||||
ASSERT_TRUE(result);
|
||||
EXPECT_NE(vao.GetID(), 0u);
|
||||
|
||||
vao.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, VertexArray_AddVertexBuffer) {
|
||||
OpenGLVertexArray vao;
|
||||
vao.Initialize();
|
||||
|
||||
OpenGLBuffer buffer;
|
||||
buffer.InitializeVertexBuffer(nullptr, 64);
|
||||
|
||||
VertexAttribute attr;
|
||||
attr.index = 0;
|
||||
attr.count = 3;
|
||||
attr.type = VertexAttributeType::Float;
|
||||
attr.normalized = VertexAttributeNormalized::False;
|
||||
attr.stride = sizeof(float) * 3;
|
||||
attr.offset = 0;
|
||||
|
||||
vao.AddVertexBuffer(buffer.GetID(), attr);
|
||||
|
||||
EXPECT_EQ(vao.GetID(), 1u);
|
||||
|
||||
buffer.Shutdown();
|
||||
vao.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, VertexArray_SetIndexBuffer) {
|
||||
OpenGLVertexArray vao;
|
||||
vao.Initialize();
|
||||
|
||||
OpenGLBuffer buffer;
|
||||
buffer.InitializeIndexBuffer(nullptr, 12);
|
||||
|
||||
vao.SetIndexBuffer(buffer.GetID(), GL_UNSIGNED_INT);
|
||||
|
||||
EXPECT_NE(vao.GetIndexBuffer(), 0u);
|
||||
|
||||
buffer.Shutdown();
|
||||
vao.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, VertexArray_Bind_Unbind) {
|
||||
OpenGLVertexArray vao;
|
||||
vao.Initialize();
|
||||
|
||||
vao.Bind();
|
||||
GLint boundVAO = 0;
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVAO);
|
||||
EXPECT_EQ(boundVAO, static_cast<GLint>(vao.GetID()));
|
||||
|
||||
vao.Unbind();
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVAO);
|
||||
EXPECT_EQ(boundVAO, 0);
|
||||
|
||||
vao.Shutdown();
|
||||
}
|
||||
|
||||
TEST_F(OpenGLTestFixture, VertexArray_Bind_MultipleAttributes) {
|
||||
OpenGLVertexArray vao;
|
||||
vao.Initialize();
|
||||
|
||||
OpenGLBuffer buffer1;
|
||||
float positions[] = { 0.0f, 0.0f, 0.5f, 0.5f };
|
||||
buffer1.InitializeVertexBuffer(positions, sizeof(positions));
|
||||
|
||||
OpenGLBuffer buffer2;
|
||||
float colors[] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||
buffer2.InitializeVertexBuffer(colors, sizeof(colors));
|
||||
|
||||
VertexAttribute attrPos;
|
||||
attrPos.index = 0;
|
||||
attrPos.count = 2;
|
||||
attrPos.type = VertexAttributeType::Float;
|
||||
attrPos.normalized = VertexAttributeNormalized::False;
|
||||
attrPos.stride = sizeof(float) * 2;
|
||||
attrPos.offset = 0;
|
||||
|
||||
VertexAttribute attrColor;
|
||||
attrColor.index = 1;
|
||||
attrColor.count = 4;
|
||||
attrColor.type = VertexAttributeType::Float;
|
||||
attrColor.normalized = VertexAttributeNormalized::False;
|
||||
attrColor.stride = sizeof(float) * 4;
|
||||
attrColor.offset = 0;
|
||||
|
||||
vao.AddVertexBuffer(buffer1.GetID(), attrPos);
|
||||
vao.AddVertexBuffer(buffer2.GetID(), attrColor);
|
||||
|
||||
vao.Bind();
|
||||
GLint boundVAO = 0;
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVAO);
|
||||
EXPECT_EQ(boundVAO, static_cast<GLint>(vao.GetID()));
|
||||
|
||||
vao.Unbind();
|
||||
glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &boundVAO);
|
||||
EXPECT_EQ(boundVAO, 0);
|
||||
|
||||
buffer1.Shutdown();
|
||||
buffer2.Shutdown();
|
||||
vao.Shutdown();
|
||||
}
|
||||
Reference in New Issue
Block a user