[YouTube] Edit YoutubeStreamExtractorDefaultTest.AudioTrackLanguage to test audio locale property
The Hindi audio track language presence test has been changed from audio track label to audio locale.
This commit is contained in:
parent
034f82dae7
commit
7f0269c4c7
|
@ -49,6 +49,7 @@ import org.schabi.newpipe.extractor.stream.Description;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
import org.schabi.newpipe.extractor.stream.StreamExtractor;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamSegment;
|
import org.schabi.newpipe.extractor.stream.StreamSegment;
|
||||||
import org.schabi.newpipe.extractor.stream.StreamType;
|
import org.schabi.newpipe.extractor.stream.StreamType;
|
||||||
|
import org.schabi.newpipe.extractor.utils.LocaleCompat;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
@ -56,6 +57,8 @@ import java.net.URL;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
@ -547,19 +550,20 @@ public class YoutubeStreamExtractorDefaultTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testCheckAudioStreams() throws Exception {
|
void testCheckAudioStreams() throws Exception {
|
||||||
assertFalse(extractor.getAudioStreams().isEmpty());
|
final List<AudioStream> audioStreams = extractor.getAudioStreams();
|
||||||
|
assertFalse(audioStreams.isEmpty());
|
||||||
|
|
||||||
for (final AudioStream audioStream : extractor.getAudioStreams()) {
|
for (final AudioStream stream : audioStreams) {
|
||||||
assertNotNull(audioStream.getAudioTrackName());
|
assertNotNull(stream.getAudioTrackName());
|
||||||
}
|
}
|
||||||
|
|
||||||
assertTrue(extractor.getAudioStreams()
|
assertTrue(audioStreams.stream()
|
||||||
.stream()
|
|
||||||
.anyMatch(audioStream -> "English".equals(audioStream.getAudioTrackName())));
|
.anyMatch(audioStream -> "English".equals(audioStream.getAudioTrackName())));
|
||||||
|
|
||||||
assertTrue(extractor.getAudioStreams()
|
final Locale hindiLocale = LocaleCompat.forLanguageTag("hi");
|
||||||
.stream()
|
assertTrue(audioStreams.stream()
|
||||||
.anyMatch(audioStream -> "Hindi".equals(audioStream.getAudioTrackName())));
|
.anyMatch(audioStream ->
|
||||||
|
Objects.equals(audioStream.getAudioLocale(), hindiLocale)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue