コード例 #1
0
ファイル: test.py プロジェクト: gabdube/pyshaders
 def test_from_files_bad_linking(self):
     " Test from_files with missing shaders "
     vert = open(vert_path('shader2'), 'r')
     frag = open(frag_path('shader2'), 'r')
     
     with self.assertRaises(ShaderCompilationError, msg='invalid shader was compiled') as cm:
         from_files(vert, frag)
         
     logs = cm.exception.logs
     self.assertIn('Function: secret_method( is not implemented', logs, 'Error not found')
     
     vert.close()
     frag.close()
コード例 #2
0
ファイル: test.py プロジェクト: gabdube/pyshaders
 def test_from_files_bad_compilation(self):
     " Test from_files with bad shaders "
     vert = open(vert_path('shader_bad'), 'r')
     frag = open(frag_path('shader_bad'), 'r')
     
     with self.assertRaises(ShaderCompilationError, msg='invalid shader was compiled') as cm:
         from_files(vert, frag)
         
     logs = cm.exception.logs     
     self.assertIn('Undeclared identifier: x', logs, 'Error not found')
     self.assertIn('Undeclared identifier: y', logs, 'Error not found')
     self.assertIn('Syntax error: "}" parse error', logs, 'Error not found')
     self.assertIn('3 compilation errors.  No code generated', logs, 'Error not found')
     self.assertIn('Syntax error: ";" parse error', logs, 'Error not found')
     self.assertIn('1 compilation errors.  No code generated', logs, 'Error not found')
         
     vert.close()
     frag.close()
コード例 #3
0
ファイル: test.py プロジェクト: gabdube/pyshaders
 def test_from_files_multiple(self):
     " Test from_files with multiple shaders files "
     vert = open(vert_path('shader2'), 'r')
     frag = open(frag_path('shader2'), 'r')
     lib = open(frag_path('frag_lib'), 'r')
     
     shader = from_files(vert, (frag, lib))
     
     self.assertTrue(shader.valid(), 'generated shader is not valid')
     
     vert.close()
     frag.close()
     lib.close()
コード例 #4
0
ファイル: test.py プロジェクト: gabdube/pyshaders
 def test_from_files(self):
     " Test from_files "        
     vert = open(vert_path('shader1'), 'r')
     frag = open(frag_path('shader1'), 'r')
     shader = from_files(vert, frag)
     
     self.assertFalse(vert.closed, 'vertex source file must not be closed')
     self.assertFalse(frag.closed, 'fragment source file must not be closed')
     
     self.assertTrue(eof(vert), 'vertex source must have been read')
     self.assertTrue(eof(frag), 'vertex source must have been read')
     
     self.assertTrue(shader.valid(), 'generated shader is not valid')
     
     vert.close()
     frag.close()