mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-02-17 01:22:33 +00:00
Add more test cases for UTF8 filenames (#889)
This commit is contained in:
parent
fbd9d139ec
commit
8446023255
5 changed files with 31 additions and 9 deletions
|
@ -705,8 +705,10 @@ endif()
|
|||
|
||||
# manipulate some variables to setup a proper test env
|
||||
set(TEST_SOUNDFONT "${CMAKE_SOURCE_DIR}/sf2/VintageDreamsWaves-v2.sf2")
|
||||
set(TEST_SOUNDFONT_UTF8 "${CMAKE_SOURCE_DIR}/sf2/\\xE2\\x96\\xA0VintageDreamsWaves-v2\\xE2\\x96\\xA0.sf2")
|
||||
set(TEST_SOUNDFONT_UTF8_1 "${CMAKE_SOURCE_DIR}/sf2/\\xE2\\x96\\xA0VintageDreamsWaves-v2\\xE2\\x96\\xA0.sf2")
|
||||
set(TEST_SOUNDFONT_UTF8_2 "${CMAKE_SOURCE_DIR}/sf2/VìntàgèDrèàmsWàvès-v2.sf2")
|
||||
set(TEST_SOUNDFONT_SF3 "${CMAKE_SOURCE_DIR}/sf2/VintageDreamsWaves-v2.sf3")
|
||||
set(TEST_MIDI_UTF8 "${CMAKE_SOURCE_DIR}/test/èmpty.mid")
|
||||
|
||||
# Make sure to link against libm before checking for math functions below
|
||||
set ( CMAKE_REQUIRED_LIBRARIES "${LIBFLUID_LIBS};${WINDOWS_LIBS}" )
|
||||
|
|
1
sf2/VìntàgèDrèàmsWàvès-v2.sf2
Symbolic link
1
sf2/VìntàgèDrèàmsWàvès-v2.sf2
Symbolic link
|
@ -0,0 +1 @@
|
|||
VintageDreamsWaves-v2.sf2
|
|
@ -212,7 +212,9 @@
|
|||
#cmakedefine TEST_SOUNDFONT "@TEST_SOUNDFONT@"
|
||||
|
||||
/* Soundfont to load for UTF-8 unit testing */
|
||||
#cmakedefine TEST_SOUNDFONT_UTF8 "@TEST_SOUNDFONT_UTF8@"
|
||||
#cmakedefine TEST_SOUNDFONT_UTF8_1 "@TEST_SOUNDFONT_UTF8_1@"
|
||||
#cmakedefine TEST_SOUNDFONT_UTF8_2 "@TEST_SOUNDFONT_UTF8_2@"
|
||||
#cmakedefine TEST_MIDI_UTF8 "@TEST_MIDI_UTF8@"
|
||||
|
||||
/* SF3 Soundfont to load for unit testing */
|
||||
#cmakedefine TEST_SOUNDFONT_SF3 "@TEST_SOUNDFONT_SF3@"
|
||||
|
|
|
@ -11,11 +11,20 @@ int main(void)
|
|||
int id;
|
||||
fluid_settings_t *settings;
|
||||
fluid_synth_t *synth;
|
||||
fluid_player_t *player;
|
||||
|
||||
FILE *sfont_file;
|
||||
sfont_file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8, "rb");
|
||||
TEST_ASSERT(sfont_file != NULL);
|
||||
TEST_ASSERT(FLUID_FCLOSE(sfont_file) == 0);
|
||||
FILE *file;
|
||||
file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8_1, "rb");
|
||||
TEST_ASSERT(file != NULL);
|
||||
TEST_ASSERT(FLUID_FCLOSE(file) == 0);
|
||||
|
||||
file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8_2, "rb");
|
||||
TEST_ASSERT(file != NULL);
|
||||
TEST_ASSERT(FLUID_FCLOSE(file) == 0);
|
||||
|
||||
file = FLUID_FOPEN(TEST_MIDI_UTF8, "rb");
|
||||
TEST_ASSERT(file != NULL);
|
||||
TEST_ASSERT(FLUID_FCLOSE(file) == 0);
|
||||
|
||||
settings = new_fluid_settings();
|
||||
synth = new_fluid_synth(settings);
|
||||
|
@ -26,11 +35,19 @@ int main(void)
|
|||
// no sfont loaded
|
||||
TEST_ASSERT(fluid_synth_sfcount(synth) == 0);
|
||||
|
||||
TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8) == TRUE);
|
||||
TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_1) == TRUE);
|
||||
TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_1, 1));
|
||||
|
||||
// load a sfont to synth
|
||||
TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8, 1));
|
||||
TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_2) == TRUE);
|
||||
TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_2, 1));
|
||||
|
||||
player = new_fluid_player(synth);
|
||||
TEST_ASSERT(player != NULL);
|
||||
|
||||
TEST_ASSERT(fluid_is_midifile(TEST_MIDI_UTF8) == TRUE);
|
||||
TEST_SUCCESS(fluid_player_add(player, TEST_MIDI_UTF8));
|
||||
|
||||
delete_fluid_player(player);
|
||||
delete_fluid_synth(synth);
|
||||
delete_fluid_settings(settings);
|
||||
|
||||
|
|
BIN
test/èmpty.mid
Normal file
BIN
test/èmpty.mid
Normal file
Binary file not shown.
Loading…
Reference in a new issue