#!/usr/bin/env python
# Copyright (c) 2019 The Khronos Group Inc.
# Use of this source code is governed by an MIT-style license that can be
# found in the LICENSE.txt file.
"""
Generator for textureformat* tests.
This file needs to be run in its folder.
"""
import sys
_DO_NOT_EDIT_WARNING = """
"""
_HTML_TEMPLATE = """
WebGL Texture Specification Tests
"""
_GROUPS = [
'rgba8_pot',
'rgba8_npot',
'eac_r11_pot',
'eac_r11_npot',
'eac_signed_r11_pot',
'eac_signed_r11_npot',
'eac_rg11_pot',
'eac_rg11_npot',
'eac_signed_rg11_pot',
'eac_signed_rg11_npot',
'etc2_rgb8_pot',
'etc2_rgb8_npot',
'etc2_srgb8_pot',
'etc2_srgb8_npot',
'etc2_rgb8_punchthrough_alpha1_pot',
'etc2_rgb8_punchthrough_alpha1_npot',
'etc2_srgb8_punchthrough_alpha1_pot',
'etc2_srgb8_punchthrough_alpha1_npot',
'etc2_eac_rgba8_pot',
'etc2_eac_rgba8_npot',
'etc2_eac_srgb8_alpha8_pot',
'etc2_eac_srgb8_alpha8_npot',
]
def GenerateFilename(group):
"""Generate test filename."""
filename = group
filename += ".html"
return filename
def WriteTest(filename, start, end):
"""Write one test."""
file = open(filename, "wb")
file.write(_DO_NOT_EDIT_WARNING)
file.write(_HTML_TEMPLATE % {
'start': start,
'end': end
})
file.close
def GenerateTests():
"""Generate all tests."""
filelist = []
for ii in range(len(_GROUPS)):
filename = GenerateFilename(_GROUPS[ii])
filelist.append(filename)
WriteTest(filename, ii, ii + 1)
return filelist
def GenerateTestList(filelist):
file = open("00_test_list.txt", "wb")
file.write('\n'.join(filelist))
file.close
def main(argv):
"""This is the main function."""
filelist = GenerateTests()
GenerateTestList(filelist)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))