Skip to content

Commit

Permalink
Add test cases for unicode filenames (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
aqnuep authored Oct 26, 2023
1 parent 27c53b0 commit b41b3f9
Show file tree
Hide file tree
Showing 43 changed files with 110 additions and 1 deletion.
6 changes: 6 additions & 0 deletions clitests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@ set(CASELIST
tests/info/invalid_file.json
tests/info/sample.json
tests/info/stdin.json
tests/info/unicode_filenames.json

tests/validate/cli_errors.json
tests/validate/help.json
tests/validate/stdin.json
tests/validate/unicode_filenames.json

tests/validate/fatal_1003_UnexpectedEOF.json
tests/validate/fatal_2001_NotKTX2.json
Expand Down Expand Up @@ -227,6 +229,7 @@ set(CASELIST
tests/extract/raw_zstd.json
tests/extract/stdin.json
tests/extract/stdout.json
tests/extract/unicode_filenames.json

tests/create/astc_params.json
tests/create/3d_with_1_depth.json
Expand Down Expand Up @@ -298,6 +301,7 @@ set(CASELIST
tests/create/sample_zstd.json
tests/create/stdin.json
tests/create/stdout.json
tests/create/unicode_filenames.json

tests/encode/compare.json
tests/encode/encode_blze.json
Expand All @@ -313,10 +317,12 @@ set(CASELIST
tests/encode/help.json
tests/encode/stdin.json
tests/encode/stdout.json
tests/encode/unicode_filenames.json

tests/transcode/help.json
tests/transcode/stdin.json
tests/transcode/stdout.json
tests/transcode/unicode_filenames.json
tests/transcode/transcode_blze.json
tests/transcode/transcode_error_invalid.json
tests/transcode/transcode_error_not_transcodable.json
Expand Down
7 changes: 6 additions & 1 deletion clitests/clitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import argparse
import os
import sys
import subprocess
import re
import json
Expand Down Expand Up @@ -71,13 +72,17 @@ def cmdArgs(self):
cli_args, unknown_args = parser.parse_known_args()


# Use UTF-8 output
sys.stdout.reconfigure(encoding='utf-8')


# Load JSON test case description and check basic contents

if not os.path.isfile(cli_args.json_test_file):
print(f"ERROR: Cannot find JSON test file '{cli_args.json_test_file}'")
exit(1)

f = open(cli_args.json_test_file)
f = open(cli_args.json_test_file, encoding='utf-8')
testcase = json.load(f)
f.close()

Expand Down
Binary file added clitests/golden/create/unicode/hűtő.ktx2
Binary file not shown.
Binary file added clitests/golden/create/unicode/نَسِيج.ktx2
Binary file not shown.
Binary file not shown.
Binary file added clitests/golden/create/unicode/质地.ktx2
Binary file not shown.
Binary file added clitests/golden/create/unicode/조직.ktx2
Binary file not shown.
Binary file added clitests/golden/encode/unicode/hűtő.ktx2
Binary file not shown.
Binary file added clitests/golden/encode/unicode/نَسِيج.ktx2
Binary file not shown.
Binary file added clitests/golden/encode/unicode/テクスチャ.ktx2
Binary file not shown.
Binary file added clitests/golden/encode/unicode/质地.ktx2
Binary file not shown.
Binary file added clitests/golden/encode/unicode/조직.ktx2
Binary file not shown.
Binary file added clitests/golden/extract/unicode/hűtő.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/golden/extract/unicode/نَسِيج.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/golden/extract/unicode/テクスチャ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/golden/extract/unicode/质地.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/golden/extract/unicode/조직.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/golden/transcode/unicode/hűtő.ktx2
Binary file not shown.
Binary file added clitests/golden/transcode/unicode/نَسِيج.ktx2
Binary file not shown.
Binary file not shown.
Binary file added clitests/golden/transcode/unicode/质地.ktx2
Binary file not shown.
Binary file added clitests/golden/transcode/unicode/조직.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/hűtő.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/hűtő.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/input/unicode/hűtő_BLZE.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/نَسِيج.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/نَسِيج.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/input/unicode/نَسِيج_BLZE.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/テクスチャ.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/テクスチャ.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/input/unicode/テクスチャ_BLZE.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/质地.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/质地.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/input/unicode/质地_BLZE.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/조직.ktx2
Binary file not shown.
Binary file added clitests/input/unicode/조직.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added clitests/input/unicode/조직_BLZE.ktx2
Binary file not shown.
17 changes: 17 additions & 0 deletions clitests/tests/create/unicode_filenames.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"description": "Test the use of unicode characters in input and output filenames.",
"command": "ktx create --testrun --format R8G8B8A8_UNORM input/unicode/${name}.png output/create/unicode/${name}/${name}.ktx2",
"status": 0,
"outputs": {
"output/create/unicode/${name}/${name}.ktx2": "golden/create/unicode/${name}.ktx2"
},
"args": {
"name": [
"hűtő",
"テクスチャ",
"نَسِيج",
"조직",
"质地"
]
}
}
19 changes: 19 additions & 0 deletions clitests/tests/encode/unicode_filenames.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"description": "Test the use of unicode characters in input and output filenames.",
"command": "ktx encode --testrun --threads 1 --codec basis-lz input/unicode/${name}.ktx2 output/encode/unicode/${name}/${name}.ktx2",
"status": 0,
"comment": "BasisLZ compression relies on undefined order of std::unordered_map containers.",
"outputTolerance": 0.08,
"outputs": {
"output/encode/unicode/${name}/${name}.ktx2": "golden/encode/unicode/${name}.ktx2"
},
"args": {
"name": [
"hűtő",
"テクスチャ",
"نَسِيج",
"조직",
"质地"
]
}
}
17 changes: 17 additions & 0 deletions clitests/tests/extract/unicode_filenames.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"description": "Test the use of unicode characters in input and output filenames.",
"command": "ktx extract --testrun input/unicode/${name}.ktx2 output/extract/unicode/${name}/${name}.png",
"status": 0,
"outputs": {
"output/extract/unicode/${name}/${name}.png": "golden/extract/unicode/${name}.png"
},
"args": {
"name": [
"hűtő",
"テクスチャ",
"نَسِيج",
"조직",
"质地"
]
}
}
14 changes: 14 additions & 0 deletions clitests/tests/info/unicode_filenames.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"description": "Test the use of unicode characters in input filenames.",
"command": "ktx info --testrun input/unicode/${name}.ktx2",
"status": 0,
"args": {
"name": [
"hűtő",
"テクスチャ",
"نَسِيج",
"조직",
"质地"
]
}
}
17 changes: 17 additions & 0 deletions clitests/tests/transcode/unicode_filenames.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"description": "Test the use of unicode characters in input and output filenames.",
"command": "ktx transcode --testrun input/unicode/${name}_BLZE.ktx2 output/transcode/unicode/${name}/${name}.ktx2",
"status": 0,
"outputs": {
"output/transcode/unicode/${name}/${name}.ktx2": "golden/transcode/unicode/${name}.ktx2"
},
"args": {
"name": [
"hűtő",
"テクスチャ",
"نَسِيج",
"조직",
"质地"
]
}
}
14 changes: 14 additions & 0 deletions clitests/tests/validate/unicode_filenames.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"description": "Test the use of unicode characters in input filenames.",
"command": "ktx validate --testrun input/unicode/${name}.ktx2",
"status": 0,
"args": {
"name": [
"hűtő",
"テクスチャ",
"نَسِيج",
"조직",
"质地"
]
}
}

0 comments on commit b41b3f9

Please sign in to comment.