def test_find_requirements_gles_version(): """test.shader_test.ShaderTest: finds gles_version.""" data = ('[require]\n' 'GL ES = 2.0\n' 'GL_ARB_ham_sandwhich\n') with mock.patch('framework.test.shader_test.open', mock.mock_open(read_data=data), create=True): test = testm.ShaderTest('null') nt.eq_(test.gles_version, 2.0)
def test_find_requirements_gl_requirements(): """test.shader_test.ShaderTest: populates gl_requirements properly""" data = ('[require]\n' 'GL = 2.0\n' 'GL_ARB_ham_sandwhich\n') with utils.tempfile(data) as temp: test = testm.ShaderTest(temp) nt.eq_(test.gl_required, set(['GL_ARB_ham_sandwhich']))
def test_parse_gles3_test(): """test.shader_test.ShaderTest: Identifies GLES3 tests successfully""" data = ('[require]\n' 'GL ES >= 3.0\n' 'GLSL ES >= 3.00\n') with utils.tempfile(data) as temp: test = testm.ShaderTest(temp) nt.assert_equal(os.path.basename(test.command[0]), "shader_runner_gles3", msg="This test should have run with shader_runner_gles3, " "but instead ran with " + os.path.basename(test.command[0]))
def test_parse_gl_test_no_decimal(): """test.shader_test.ShaderTest: raises if version lacks decminal""" data = ('[require]\n' 'GL = 2\n') with utils.tempfile(data) as temp: with nt.assert_raises(exceptions.PiglitFatalError) as exc: testm.ShaderTest(temp) nt.assert_equal(exc.exception, "No GL version set", msg="A GL version was passed without a decimal, " "which should have raised an exception, but " "did not")
def test_parse_gles2_test(): """ Tests the parser for GLES2 tests """ data = ('[require]\n' 'GL ES >= 2.0\n' 'GLSL ES >= 1.00\n') with utils.with_tempfile(data) as temp: test = testm.ShaderTest(temp) nt.assert_equal(os.path.basename(test.command[0]), "shader_runner_gles2", msg="This test should have run with shader_runner_gles2, " "but instead ran with " + os.path.basename(test.command[0]))
def test_parse_gl_test_no_decimal(): """ The GL Parser raises an exception if GL version lacks decimal """ data = ('[require]\n' 'GL = 2\n') with utils.with_tempfile(data) as temp: with nt.assert_raises(testm.ShaderTestParserException) as exc: testm.ShaderTest(temp) nt.assert_equal(exc.exception, "No GL version set", msg="A GL version was passed without a decimal, " "which should have raised an exception, but " "did not")
def test_initialize_shader_test(): """test.shader_test.ShaderTest: class initializes""" testm.ShaderTest('tests/spec/glsl-es-1.00/execution/sanity.shader_test')
def test(config): with mock.patch('framework.test.shader_test.open', mock.mock_open(read_data=config), create=True): test = testm.ShaderTest('null') nt.eq_(test.gl_required, {'GL_foobar'})
def test_add_auto(): """test.shader_test.ShaderTest: -auto is added to the command""" test = testm.ShaderTest( 'tests/spec/glsl-es-1.00/execution/sanity.shader_test') nt.assert_in('-auto', test.command)
def test_add_fbo(): """ ShaderTest.command adds -auto """ test = testm.ShaderTest( 'tests/spec/glsl-es-1.00/execution/sanity.shader_test') nt.assert_in('-auto', test.command)