Пример #1
0
    def testGetInfoLogForZeroLogSize(self):
        program = ShaderProgram()
        program.getInfoLogLength = lambda: 0

        log = program.getInfoLog()

        self.assertEquals(log, '')
Пример #2
0
 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))
Пример #3
0
    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)
Пример #4
0
    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')