示例#1
0
文件: test.py 项目: gabdube/pyshaders
 def test_using(self):
     " Test shader with-block "
     prog = ShaderProgram.new_program()
     prog.attach(*self.get_objects())
     prog.link()
     self.assertIsNone(current_program(), 'Current program is not None')
     with prog.using():
         self.assertEqual(current_program(), prog, 'Program is not in use')
     self.assertIsNone(current_program(), 'Current program is not None')
示例#2
0
文件: test.py 项目: vintch/pyshaders
 def test_use_remove(self):
     " Test use and clear "
     prog = ShaderProgram.new_program()
     vert, frag = self.get_objects()
     prog.attach(vert, frag)
     prog.link()
     prog.use()
     self.assertEqual(current_program(), prog, 'Program is not in use')
     ShaderProgram.clear()
     self.assertIsNone(current_program(), 'Current program is not None')
示例#3
0
文件: test.py 项目: gabdube/pyshaders
 def test_using_multiple(self):
     " Test multiple shaders with-block "
     prog1 = ShaderProgram.new_program()
     prog1.attach(*self.get_objects())
     prog1.link()
     
     prog2 = ShaderProgram.new_program()
     prog2.attach(*self.get_objects('shader2'))
     prog2.link()
     
     self.assertIsNone(current_program(), 'Current program is not None')
     with prog1.using():
         self.assertEqual(current_program(), prog1, 'Program 1 is not in use')
         with prog2.using():
             self.assertEqual(current_program(), prog2, 'Program 2 is not in use')
         self.assertEqual(current_program(), prog1, 'Program 1 is not in use')
     self.assertIsNone(current_program(), 'Current program is not None')