From eaa0418debe9911b4aed2adf07465884cd905abb Mon Sep 17 00:00:00 2001 From: DeeJayLSP Date: Wed, 4 Dec 2024 16:46:18 -0300 Subject: [PATCH] TestAudioStreamWAV: use runtime load instead of importer --- tests/scene/test_audio_stream_wav.h | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/tests/scene/test_audio_stream_wav.h b/tests/scene/test_audio_stream_wav.h index 7276dd0878c9..30e3f5b9ba47 100644 --- a/tests/scene/test_audio_stream_wav.h +++ b/tests/scene/test_audio_stream_wav.h @@ -37,11 +37,6 @@ #include "tests/test_macros.h" -#ifdef TOOLS_ENABLED -#include "core/io/resource_loader.h" -#include "editor/import/resource_importer_wav.h" -#endif - namespace TestAudioStreamWAV { // Default wav rate for test cases. @@ -148,25 +143,8 @@ void run_test(String file_name, AudioStreamWAV::Format data_format, bool stereo, Ref wav_file = FileAccess::open(save_path, FileAccess::READ, &error); REQUIRE(error == OK); -#ifdef TOOLS_ENABLED - // The WAV importer can be used if enabled to check that the saved file is valid. - Ref wav_importer = memnew(ResourceImporterWAV); - - List options_list; - wav_importer->get_import_options("", &options_list); - - HashMap options_map; - for (const ResourceImporter::ImportOption &E : options_list) { - options_map[E.option.name] = E.default_value; - } - // Compressed streams can't be saved, disable compression. - options_map["compress/mode"] = 0; - - REQUIRE(wav_importer->import(0, save_path, save_path, options_map, nullptr) == OK); - - String load_path = save_path + "." + wav_importer->get_save_extension(); - Ref loaded_stream = ResourceLoader::load(load_path, "AudioStreamWAV", ResourceFormatImporter::CACHE_MODE_IGNORE, &error); - REQUIRE(error == OK); + Dictionary options; + Ref loaded_stream = AudioStreamWAV::load_from_file(save_path, options); CHECK(loaded_stream->get_format() == stream->get_format()); CHECK(loaded_stream->get_loop_mode() == stream->get_loop_mode()); @@ -177,7 +155,6 @@ void run_test(String file_name, AudioStreamWAV::Format data_format, bool stereo, CHECK(loaded_stream->get_length() == stream->get_length()); CHECK(loaded_stream->is_monophonic() == stream->is_monophonic()); CHECK(loaded_stream->get_data() == stream->get_data()); -#endif } }