mirror of
https://github.com/samsonjs/media.git
synced 2026-04-19 13:35:47 +00:00
Add ID3v2 multi-value tests
Add tests for ID3v2 multi-value text frames.
This commit is contained in:
parent
4510210ad7
commit
c96b55029d
1 changed files with 24 additions and 0 deletions
|
|
@ -69,6 +69,21 @@ public final class Id3DecoderTest {
|
|||
assertThat(textInformationFrame.description).isEqualTo("Hello World");
|
||||
assertThat(textInformationFrame.values).isEmpty();
|
||||
|
||||
// Test multiple values.
|
||||
rawId3 = buildSingleFrameTag(
|
||||
"TXXX",
|
||||
new byte[] {
|
||||
1, 0, 72, 0, 101, 0, 108, 0, 108, 0, 111, 0, 32, 0, 87, 0, 111, 0, 114, 0, 108, 0,
|
||||
100, 0, 0, 0, 70, 0, 111, 0, 111, 0, 0, 0, 66, 0, 97, 0, 114, 0, 0
|
||||
});
|
||||
metadata = decoder.decode(rawId3, rawId3.length);
|
||||
assertThat(metadata.length()).isEqualTo(1);
|
||||
textInformationFrame = (TextInformationFrame) metadata.get(0);
|
||||
assertThat(textInformationFrame.description).isEqualTo("Hello World");
|
||||
assertThat(textInformationFrame.values.length).isEqualTo(2);
|
||||
assertThat(textInformationFrame.values[0]).isEqualTo("Foo");
|
||||
assertThat(textInformationFrame.values[1]).isEqualTo("Bar");
|
||||
|
||||
// Test empty.
|
||||
rawId3 = buildSingleFrameTag("TXXX", new byte[0]);
|
||||
metadata = decoder.decode(rawId3, rawId3.length);
|
||||
|
|
@ -98,6 +113,15 @@ public final class Id3DecoderTest {
|
|||
assertThat(textInformationFrame.values.length).isEqualTo(1);
|
||||
assertThat(textInformationFrame.values[0]).isEqualTo("Hello World");
|
||||
|
||||
// Test multiple values.
|
||||
rawId3 = buildSingleFrameTag("TIT2", new byte[] {3, 70, 111, 111, 0, 66, 97, 114, 0});
|
||||
metadata = decoder.decode(rawId3, rawId3.length);
|
||||
assertThat(metadata.length()).isEqualTo(1);
|
||||
textInformationFrame = (TextInformationFrame) metadata.get(0);
|
||||
assertThat(textInformationFrame.values.length).isEqualTo(2);
|
||||
assertThat(textInformationFrame.values[0]).isEqualTo("Foo");
|
||||
assertThat(textInformationFrame.values[1]).isEqualTo("Bar");
|
||||
|
||||
// Test empty.
|
||||
rawId3 = buildSingleFrameTag("TIT2", new byte[0]);
|
||||
metadata = decoder.decode(rawId3, rawId3.length);
|
||||
|
|
|
|||
Loading…
Reference in a new issue