예제 #1
0
    def testGetInfoLogLength(self):
        program = ShaderProgram()
        program._get = Mock(return_value=123)

        actual = program.getInfoLogLength()

        self.assertEquals(program._get.call_args,
            ((gl.GL_INFO_LOG_LENGTH,), {}))
        self.assertEquals(actual, 123)
예제 #2
0
    def testGet(self, mockGl):
        mockGl.glGetProgramiv.side_effect = mockGet(123)
        program = ShaderProgram()
        program.id = object()

        actual = program._get(456)

        self.assertEquals(mockGl.glGetProgramiv.call_args[0][:2],
            (program.id, 456))
        self.assertEquals(actual, 123)
예제 #3
0
    def testGetLinkStatus(self):
        data = [
            (gl.GL_TRUE, True),
            (gl.GL_FALSE, False),
        ]
        for getReturn, expected in data:
            program = ShaderProgram()
            program._get = Mock(return_value=getReturn)

            actual = program.getLinkStatus()

            self.assertEquals(program._get.call_args,
                ((gl.GL_LINK_STATUS,), {}))
            self.assertEquals(actual, expected)
            self.assertEquals(type(actual), type(expected))