[drape] tests fix

This commit is contained in:
ExMix 2014-11-18 13:38:59 +03:00 committed by Alex Zolotarev
parent e3d23660d2
commit 20f48e426e
3 changed files with 16 additions and 0 deletions

View file

@ -109,12 +109,17 @@ public:
EXPECTGL(glBindBuffer(m_dataBufferID, gl_const::GLArrayBuffer));
EXPECTGL(glBufferSubData(gl_const::GLArrayBuffer, vertxeCount * sizeof(float), _, 0))
.WillOnce(Invoke(&vertexCmp, &MemoryComparer::cmpSubBuffer));
EXPECTGL(glBindBuffer(0, gl_const::GLElementArrayBuffer));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
}
void ExpectBufferDeletion()
{
InSequence seq;
EXPECTGL(glBindBuffer(0, gl_const::GLElementArrayBuffer));
EXPECTGL(glDeleteBuffer(m_indexBufferID));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
EXPECTGL(glDeleteBuffer(m_dataBufferID));
}
@ -284,13 +289,18 @@ namespace
EXPECTGL(glBindBuffer(currentNode.m_vertexBufferID, gl_const::GLArrayBuffer));
EXPECTGL(glBufferSubData(gl_const::GLArrayBuffer, currentNode.m_vertexByteCount, _, 0))
.WillOnce(Invoke(vertexComparer, &MemoryComparer::cmpSubBuffer));
EXPECTGL(glBindBuffer(0, gl_const::GLElementArrayBuffer));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
}
void CloseExpection()
{
for (size_t i = 0; i < m_nodes.size(); ++i)
{
EXPECTGL(glBindBuffer(0, gl_const::GLElementArrayBuffer));
EXPECTGL(glDeleteBuffer(m_nodes[i].m_indexBufferID));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
EXPECTGL(glDeleteBuffer(m_nodes[i].m_vertexBufferID));
}
}

View file

@ -20,6 +20,7 @@ UNIT_TEST(CreateDestroyDataBufferTest)
EXPECTGL(glGenBuffer()).WillOnce(Return(1));
EXPECTGL(glBindBuffer(1, gl_const::GLArrayBuffer));
EXPECTGL(glBufferData(gl_const::GLArrayBuffer, 3 * 100 * sizeof(float), NULL, gl_const::GLStaticDraw));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
EXPECTGL(glDeleteBuffer(1));
GPUBuffer * buffer = new DataBuffer(3 * sizeof(float), 100);
@ -32,6 +33,7 @@ UNIT_TEST(CreateDestroyIndexBufferTest)
EXPECTGL(glGenBuffer()).WillOnce(Return(1));
EXPECTGL(glBindBuffer(1, gl_const::GLElementArrayBuffer));
EXPECTGL(glBufferData(gl_const::GLElementArrayBuffer, 100 * sizeof(uint16_t), NULL, gl_const::GLStaticDraw));
EXPECTGL(glBindBuffer(0, gl_const::GLElementArrayBuffer));
EXPECTGL(glDeleteBuffer(1));
GPUBuffer * buffer = new IndexBuffer(100);
@ -50,6 +52,7 @@ UNIT_TEST(UploadDataTest)
EXPECTGL(glBufferData(gl_const::GLArrayBuffer, 3 * 100 * sizeof(float), NULL, gl_const::GLStaticDraw));
EXPECTGL(glBindBuffer(1, gl_const::GLArrayBuffer));
EXPECTGL(glBufferSubData(gl_const::GLArrayBuffer, 3 * 100 * sizeof(float), data, 0));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
EXPECTGL(glDeleteBuffer(1));
GPUBuffer * buffer = new GPUBuffer(GPUBuffer::ElementBuffer, 3 * sizeof(float), 100);
@ -75,6 +78,7 @@ UNIT_TEST(ParticalUploadDataTest)
EXPECTGL(glBufferSubData(gl_const::GLArrayBuffer, 3 * 30 * sizeof(float), part1Data, 0));
EXPECTGL(glBindBuffer(1, gl_const::GLArrayBuffer));
EXPECTGL(glBufferSubData(gl_const::GLArrayBuffer, 3 * 70 * sizeof(float), part2Data, 3 * 30 * sizeof(float)));
EXPECTGL(glBindBuffer(0, gl_const::GLArrayBuffer));
EXPECTGL(glDeleteBuffer(1));
GPUBuffer * buffer = new GPUBuffer(GPUBuffer::ElementBuffer, 3 * sizeof(float), 100);

View file

@ -105,10 +105,12 @@ UNIT_TEST(UniformValueTest)
InSequence seq;
// vertexShader->Ref()
EXPECTGL(glCreateShader(gl_const::GLVertexShader)).WillOnce(Return(VertexShaderID));
//EXPECTGL(glGetInteger(gl_const::GLMaxFragmentTextures)).WillOnce(Return(8));
EXPECTGL(glShaderSource(VertexShaderID, _)).Times(1);
EXPECTGL(glCompileShader(VertexShaderID, _)).WillOnce(Return(true));
// fragmentShader->Ref()
EXPECTGL(glCreateShader(gl_const::GLFragmentShader)).WillOnce(Return(FragmentShaderID));
EXPECTGL(glGetInteger(gl_const::GLMaxFragmentTextures)).WillOnce(Return(8));
EXPECTGL(glShaderSource(FragmentShaderID, _)).Times(1);
EXPECTGL(glCompileShader(FragmentShaderID, _)).WillOnce(Return(true));