[YouTube] Test language and descriptive audio in YoutubeDashManifestCreatorsTest

This commit is contained in:
AudricV 2022-12-16 18:46:50 +01:00
parent 05e8cb39f7
commit 034f82dae7
No known key found for this signature in database
GPG Key ID: DA92EC7905614198
1 changed files with 13 additions and 3 deletions

View File

@ -20,6 +20,7 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.StringReader; import java.io.StringReader;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Random; import java.util.Random;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -191,7 +192,7 @@ class YoutubeDashManifestCreatorsTest {
() -> assertMpdElement(document), () -> assertMpdElement(document),
() -> assertPeriodElement(document), () -> assertPeriodElement(document),
() -> assertAdaptationSetElement(document, itagItem), () -> assertAdaptationSetElement(document, itagItem),
() -> assertRoleElement(document), () -> assertRoleElement(document, itagItem),
() -> assertRepresentationElement(document, itagItem), () -> assertRepresentationElement(document, itagItem),
() -> { () -> {
if (itagItem.itagType.equals(ItagItem.ItagType.AUDIO)) { if (itagItem.itagType.equals(ItagItem.ItagType.AUDIO)) {
@ -220,10 +221,19 @@ class YoutubeDashManifestCreatorsTest {
@Nonnull final ItagItem itagItem) { @Nonnull final ItagItem itagItem) {
final Element element = assertGetElement(document, ADAPTATION_SET, PERIOD); final Element element = assertGetElement(document, ADAPTATION_SET, PERIOD);
assertAttrEquals(itagItem.getMediaFormat().getMimeType(), element, "mimeType"); assertAttrEquals(itagItem.getMediaFormat().getMimeType(), element, "mimeType");
if (itagItem.itagType == ItagItem.ItagType.AUDIO) {
final Locale itagAudioLocale = itagItem.getAudioLocale();
if (itagAudioLocale != null) {
assertAttrEquals(itagAudioLocale.getLanguage(), element, "lang");
}
}
} }
private void assertRoleElement(@Nonnull final Document document) { private void assertRoleElement(@Nonnull final Document document,
assertGetElement(document, ROLE, ADAPTATION_SET); @Nonnull final ItagItem itagItem) {
final Element element = assertGetElement(document, ROLE, ADAPTATION_SET);
assertAttrEquals(itagItem.isDescriptiveAudio() ? "alternate" : "main", element, "value");
} }
private void assertRepresentationElement(@Nonnull final Document document, private void assertRepresentationElement(@Nonnull final Document document,