mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 14:18:31 +09:00
[Fix] (MG_Test/VertexArrayTest): Fix incorrect check in General_BindWithoutCreation.
This commit is contained in:
@@ -16,10 +16,7 @@ protected:
|
||||
auto vbo = glContext.CreateBufferObject(bufferNames[0]);
|
||||
glContext.GetBufferBindingSlot(BufferTarget::Vertex).Bind(vbo);
|
||||
|
||||
Vector<float> vertexData = {
|
||||
0.0f, 0.0f, 0.0f, 1.0f,
|
||||
1.0f, 0.0f, 0.0f, 1.0f
|
||||
};
|
||||
Vector<float> vertexData = {0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f};
|
||||
SizeT byteSize = vertexData.size() * sizeof(float);
|
||||
vbo->Resize(byteSize);
|
||||
DataPtr ptr{.data = vertexData.data(), .size = byteSize};
|
||||
@@ -202,14 +199,11 @@ TEST_F(VertexArrayTest, BoundVAOPreservesState) {
|
||||
ASSERT_FALSE(vao2->IsAttributeEnabled(0));
|
||||
}
|
||||
|
||||
|
||||
using namespace MobileGL::MG_Impl::GLImpl;
|
||||
|
||||
class GeneralVertexArrayTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
MG_State::pGLContext = new MG_State::GLState::GLContext();
|
||||
}
|
||||
void SetUp() override { MG_State::pGLContext = new MG_State::GLState::GLContext(); }
|
||||
|
||||
void TearDown() override {
|
||||
delete MG_State::pGLContext;
|
||||
@@ -296,7 +290,8 @@ TEST_F(GeneralVertexArrayTest, General_IndexBufferBinding) {
|
||||
GenBuffers(1, &newEbo);
|
||||
BindBuffer(GL_ELEMENT_ARRAY_BUFFER, newEbo);
|
||||
|
||||
EXPECT_EQ(MG_State::pGLContext->GetBufferBindingSlot(BufferTarget::Index).GetBoundObject(), MG_State::pGLContext->GetBufferObject(newEbo));
|
||||
EXPECT_EQ(MG_State::pGLContext->GetBufferBindingSlot(BufferTarget::Index).GetBoundObject(),
|
||||
MG_State::pGLContext->GetBufferObject(newEbo));
|
||||
|
||||
EXPECT_EQ(GetError(), GL_NO_ERROR);
|
||||
}
|
||||
@@ -415,13 +410,13 @@ TEST_F(GeneralVertexArrayTest, General_BindWithoutCreation) {
|
||||
GLuint vao = 1;
|
||||
|
||||
BindVertexArray(vao);
|
||||
EXPECT_EQ(GetError(), GL_NO_ERROR);
|
||||
EXPECT_EQ(GetError(), GL_INVALID_OPERATION);
|
||||
|
||||
EXPECT_NE(MG_State::pGLContext->GetVertexArrayObject(vao), nullptr);
|
||||
EXPECT_EQ(MG_State::pGLContext->GetVertexArrayObject(vao), nullptr);
|
||||
|
||||
GLuint vbo = CreateVBO(GL_ARRAY_BUFFER, 64);
|
||||
VertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, nullptr);
|
||||
EXPECT_EQ(GetError(), GL_NO_ERROR);
|
||||
EXPECT_EQ(GetError(), GL_INVALID_OPERATION);
|
||||
|
||||
EXPECT_EQ(GetError(), GL_NO_ERROR);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user