[MediaCCC] Test audio language property extraction

This commit is contained in:
AudricV 2023-01-31 19:26:43 +01:00
parent 30a0f8c510
commit 95b3f5e391
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
1 changed files with 14 additions and 2 deletions

View File

@ -7,16 +7,20 @@ import org.schabi.newpipe.extractor.NewPipe;
import org.schabi.newpipe.extractor.StreamingService; import org.schabi.newpipe.extractor.StreamingService;
import org.schabi.newpipe.extractor.services.DefaultStreamExtractorTest; import org.schabi.newpipe.extractor.services.DefaultStreamExtractorTest;
import org.schabi.newpipe.extractor.services.media_ccc.extractors.MediaCCCStreamExtractor; 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.StreamExtractor;
import org.schabi.newpipe.extractor.stream.StreamType; import org.schabi.newpipe.extractor.stream.StreamType;
import org.schabi.newpipe.extractor.utils.LocaleCompat;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Objects;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.schabi.newpipe.extractor.ServiceList.MediaCCC; import static org.schabi.newpipe.extractor.ServiceList.MediaCCC;
/** /**
@ -85,7 +89,11 @@ public class MediaCCCStreamExtractorTest {
@Test @Test
public void testAudioStreams() throws Exception { public void testAudioStreams() throws Exception {
super.testAudioStreams(); super.testAudioStreams();
assertEquals(2, extractor.getAudioStreams().size()); final List<AudioStream> 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 class MediaCCCStreamExtractorTest {
@Test @Test
public void testAudioStreams() throws Exception { public void testAudioStreams() throws Exception {
super.testAudioStreams(); super.testAudioStreams();
assertEquals(2, extractor.getAudioStreams().size()); final List<AudioStream> audioStreams = extractor.getAudioStreams();
assertEquals(2, audioStreams.size());
final Locale expectedLocale = LocaleCompat.forLanguageTag("eng");
assertTrue(audioStreams.stream().allMatch(audioStream ->
Objects.equals(audioStream.getAudioLocale(), expectedLocale)));
} }
@Override @Override