示例#1
0
    def test_skip_glsl_es_version(self, tmpdir):
        """test.shader_test.ShaderTest: finds glsl_es_version."""
        p = tmpdir.join('test.shader_test')
        p.write(
            textwrap.dedent("""\
            [require]
            GL ES >= 2.0
            GLSL ES >= 1.00
            """))
        test = shader_test.ShaderTest(six.text_type(p))

        assert test.glsl_es_version == 1.0
示例#2
0
    def test_gles3_bin(self, tmpdir):
        """test.shader_test.ShaderTest: Identifies GLES3 tests successfully."""
        p = tmpdir.join('test.shader_test')
        p.write(
            textwrap.dedent("""\
            [require]
            GL ES >= 3.0
            GLSL ES >= 3.00 es
            """))
        test = shader_test.ShaderTest(six.text_type(p))

        assert os.path.basename(test.command[0]) == "shader_runner_gles3"
示例#3
0
    def test_skip_gl_version(self, tmpdir):
        """test.shader_test.ShaderTest: finds gl_version."""
        p = tmpdir.join('test.shader_test')
        p.write(
            textwrap.dedent("""\
            [require]
            GL >= 2.0
            GL_ARB_ham_sandwhich
            """))
        test = shader_test.ShaderTest(six.text_type(p))

        assert test.gl_version == 2.0
示例#4
0
    def test_skip_gl_required(self, tmpdir):
        """test.shader_test.ShaderTest: populates gl_requirements properly"""
        p = tmpdir.join('test.shader_test')
        p.write(
            textwrap.dedent("""\
            [require]
            GL >= 3.0
            GL_ARB_ham_sandwhich
            """))
        test = shader_test.ShaderTest(six.text_type(p))

        assert test.gl_required == {'GL_ARB_ham_sandwhich'}
示例#5
0
def test_command_add_auto(tmpdir):
    """test.shader_test.ShaderTest: -auto is added to the command."""
    p = tmpdir.join('test.shader_test')
    p.write(
        textwrap.dedent("""\
        [require]
        GL ES >= 3.0
        GLSL ES >= 3.00 es
        """))
    test = shader_test.ShaderTest(six.text_type(p))

    assert '-auto' in test.command
示例#6
0
    def test_bin(self, gles, operator, expected, tmpdir):
        """Test that the shader_runner parse picks the correct binary."""
        p = tmpdir.join('test.shader_test')
        p.write(
            textwrap.dedent("""\
            [require]
            GL ES {} {}
            GLSL ES >= 1.00

            [next section]
            """.format(operator, gles)))
        test = shader_test.ShaderTest(six.text_type(p))

        assert os.path.basename(test.command[0]) == expected
示例#7
0
    def test_ignore_directives(self, tmpdir):
        """There are some directives for shader_runner that are not interpreted
        by the python layer, they are only for the C layer. These should be
        ignored by the python layer.
        """
        p = tmpdir.join('test.shader_test')
        p.write(
            textwrap.dedent("""\
            [require]
            GL >= 3.3
            GLSL >= 1.50
            GL_MAX_VERTEX_OUTPUT_COMPONENTS
            GL_MAX_FRAGMENT_UNIFORM_COMPONENTS
            GL_MAX_VERTEX_UNIFORM_COMPONENTS
            GL_MAX_VARYING_COMPONENTS
            GL_ARB_foobar
            """))
        test = shader_test.ShaderTest(six.text_type(p))

        assert test.gl_version == 3.3
        assert test.glsl_version == 1.50
        assert test.gl_required == {'GL_ARB_foobar'}
示例#8
0
 def test_setter_doesnt_add_auto_and_fbo(self, test_file):
     """Don't add -fbo or -auto to self._command when using the setter."""
     test = shader_test.ShaderTest(test_file)
     test.command += ['-newarg']
     assert '-auto' not in test._command
     assert '-fbo' not in test._command
示例#9
0
 def test_getter_adds_auto_and_fbo(self, test_file):
     """test.shader_test.ShaderTest: -auto and -fbo is added to the command.
     """
     test = shader_test.ShaderTest(test_file)
     assert '-auto' in test.command
     assert '-fbo' in test.command