| 11 | namespace TestResourceExport { |
| 12 | |
| 13 | Error test_export_sample(const String &version) { |
| 14 | String test_dir = get_test_resources_path().path_join(version).path_join("sample"); |
| 15 | Vector<String> files = gdre::get_recursive_dir_list(test_dir, { "*.sample" }); |
| 16 | String output_dir = get_tmp_path().path_join(version).path_join("sample"); |
| 17 | for (const String &file : files) { |
| 18 | // original file |
| 19 | String original_file = file.rsplit("-", true, 1)[0]; |
| 20 | String output_file = output_dir.path_join(original_file.get_file()); |
| 21 | Error err = Exporter::export_file(output_file, file); |
| 22 | CHECK(err == OK); |
| 23 | // load the sample file, not the wav |
| 24 | Ref<AudioStreamWAV> original_sample = ResourceCompatLoader::non_global_load(file); |
| 25 | CHECK(original_sample.is_valid()); |
| 26 | Ref<AudioStreamWAV> exported_sample = AudioStreamWAV::load_from_file(output_file, {}); |
| 27 | CHECK(exported_sample.is_valid()); |
| 28 | CHECK(original_sample->get_data() == exported_sample->get_data()); |
| 29 | } |
| 30 | return OK; |
| 31 | } |
| 32 | |
| 33 | Error test_export_oggvorbisstr(const String &version) { |
| 34 | String test_dir = get_test_resources_path().path_join(version).path_join("ogg"); |
no test coverage detected