tests/
: Compare only the non-empty measures
This commit is contained in:
parent
0bef98c10d
commit
305b70eb27
@ -279,7 +279,7 @@ def applyFumenStructureToParsedTJA(globalHeader, courseHeader, measures):
|
|||||||
# TODO: Figure out what the unknown Wii1, Wii4, and PS4 notes represent (just in case they're important somehow)
|
# TODO: Figure out what the unknown Wii1, Wii4, and PS4 notes represent (just in case they're important somehow)
|
||||||
|
|
||||||
|
|
||||||
def readFumen(fumenFile, byteOrder=None):
|
def readFumen(fumenFile, byteOrder=None, exclude_empty_measures=False):
|
||||||
"""
|
"""
|
||||||
Parse bytes of a fumen .bin file into nested measure, branch, and note dictionaries.
|
Parse bytes of a fumen .bin file into nested measure, branch, and note dictionaries.
|
||||||
|
|
||||||
@ -432,4 +432,13 @@ def readFumen(fumenFile, byteOrder=None):
|
|||||||
break
|
break
|
||||||
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
|
# NB: Official fumens often include empty measures as a way of inserting barlines for visual effect.
|
||||||
|
# But, TJA authors tend not to add these empty measures, because even without them, the song plays correctly.
|
||||||
|
# So, in tests, if we want to only compare the timing of the non-empty measures between an official fumen and
|
||||||
|
# a converted non-official TJA, then it's useful to exclude the empty measures.
|
||||||
|
if exclude_empty_measures:
|
||||||
|
song['measures'] = [m for m in song['measures']
|
||||||
|
if m['normal']['length'] or m['advanced']['length'] or m['master']['length']]
|
||||||
|
|
||||||
return song
|
return song
|
||||||
|
@ -56,8 +56,8 @@ def test_converted_tja_vs_cached_fumen(id_song, tmp_path, entry_point):
|
|||||||
i_difficult_id = os.path.basename(path_out).split(".")[0].split("_")[1]
|
i_difficult_id = os.path.basename(path_out).split(".")[0].split("_")[1]
|
||||||
i_difficulty = NORMALIZE_COURSE[{v: k for k, v in COURSE_IDS.items()}[i_difficult_id]] # noqa
|
i_difficulty = NORMALIZE_COURSE[{v: k for k, v in COURSE_IDS.items()}[i_difficult_id]] # noqa
|
||||||
# 0. Read fumen data (converted vs. cached)
|
# 0. Read fumen data (converted vs. cached)
|
||||||
co_song = readFumen(path_out)
|
co_song = readFumen(path_out, exclude_empty_measures=True)
|
||||||
ca_song = readFumen(os.path.join(path_bin, os.path.basename(path_out)))
|
ca_song = readFumen(os.path.join(path_bin, os.path.basename(path_out)), exclude_empty_measures=True)
|
||||||
# 1. Check song headers
|
# 1. Check song headers
|
||||||
checkValidHeader(co_song['headerPadding']+co_song['headerMetadata'], strict=True)
|
checkValidHeader(co_song['headerPadding']+co_song['headerMetadata'], strict=True)
|
||||||
checkValidHeader(ca_song['headerPadding']+ca_song['headerMetadata'])
|
checkValidHeader(ca_song['headerPadding']+ca_song['headerMetadata'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user