From 4392b1838ecc0e31c3a78e3c015be5a7310afa73 Mon Sep 17 00:00:00 2001 From: AudricV <74829229+AudricV@users.noreply.github.com> Date: Tue, 31 Jan 2023 19:26:43 +0100 Subject: [PATCH] [MediaCCC] Test audio language property extraction --- .../media_ccc/MediaCCCStreamExtractorTest.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java b/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java index 458946ba3e..feb0b7c723 100644 --- a/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java +++ b/extractor/src/test/java/org/schabi/newpipe/extractor/services/media_ccc/MediaCCCStreamExtractorTest.java @@ -7,16 +7,20 @@ import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.services.DefaultStreamExtractorTest; import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor; +import org.schabi.newpipe.extractor.stream.AudioStream; import org.schabi.newpipe.extractor.stream.StreamExtractor; import org.schabi.newpipe.extractor.stream.StreamType; +import org.schabi.newpipe.extractor.utils.LocaleCompat; import javax.annotation.Nullable; import java.util.Arrays; import java.util.List; import java.util.Locale; +import java.util.Objects; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.schabi.newpipe.extractor.ServiceList.MediaCCC; /** @@ -85,7 +89,11 @@ public void testVideoStreams() throws Exception { @Test public void testAudioStreams() throws Exception { super.testAudioStreams(); - assertEquals(2, extractor.getAudioStreams().size()); + final List audioStreams = extractor.getAudioStreams(); + assertEquals(2, audioStreams.size()); + final Locale expectedLocale = LocaleCompat.forLanguageTag("deu"); + assertTrue(audioStreams.stream().allMatch(audioStream -> + Objects.equals(audioStream.getAudioLocale(), expectedLocale))); } } @@ -155,7 +163,11 @@ public void testVideoStreams() throws Exception { @Test public void testAudioStreams() throws Exception { super.testAudioStreams(); - assertEquals(2, extractor.getAudioStreams().size()); + final List audioStreams = extractor.getAudioStreams(); + assertEquals(2, audioStreams.size()); + final Locale expectedLocale = LocaleCompat.forLanguageTag("eng"); + assertTrue(audioStreams.stream().allMatch(audioStream -> + Objects.equals(audioStream.getAudioLocale(), expectedLocale))); } @Override