def testGetInfoLogForZeroLogSize(self): program = ShaderProgram() program.getInfoLogLength = lambda: 0 log = program.getInfoLog() self.assertEquals(log, '')
def testUseRaisesOnLinkFailure(self): program = ShaderProgram() program.getLinkStatus = lambda: False program.getInfoLog = lambda: 'linkerror' try: program.use() self.fail('should raise') except LinkError, e: self.assertTrue('linkerror' in str(e))
def testGetInfoLog(self, mockGl): expected = 'logmessage' mockGl.glGetProgramInfoLog.side_effect = mockGetInfoLog(expected) program = ShaderProgram() program.getInfoLogLength = lambda: len(expected) log = program.getInfoLog() self.assertEquals(log, expected)
def testUseReturnsConcatenatedMessages(self): shader1 = Mock() shader2 = Mock() shader1.getInfoLog = lambda: 's1' shader2.getInfoLog = lambda: 's2' program = ShaderProgram(shader1, shader2) program.getInfoLog = lambda: 'p0' program.getLinkStatus = lambda: True message = program.use() self.assertEquals(message, 's1\ns2\np0')