Skip to content

Commit 42e70b2

Browse files
committed
test: add multi-value TXXX test cases
Tests cover: two values, three values, empty slot skipping, and existing single-value regression (covered by pre-existing tests). Signed-off-by: Rouzax <GitHub@mgdn.nl>
1 parent f723e42 commit 42e70b2

1 file changed

Lines changed: 34 additions & 1 deletion

File tree

t/mp3.t

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use strict;
33
use Digest::MD5 qw(md5_hex);
44
use File::Spec::Functions;
55
use FindBin ();
6-
use Test::More tests => 401;
6+
use Test::More tests => 413;
77
use Test::Warn;
88

99
use Audio::Scan;
@@ -1374,6 +1374,39 @@ eval {
13741374
is( $tags->{MP3GAIN_MINMAX}, '123,203', 'bad APE tag MP3GAIN_MINMAX ok' );
13751375
}
13761376

1377+
# Multi-value TXXX frames (ID3v2.4 null-separated values)
1378+
{
1379+
my $s = Audio::Scan->scan( _f('v2.4-txxx-multivalue.mp3') );
1380+
my $tags = $s->{tags};
1381+
1382+
is( ref $tags->{ALBUMARTISTS}, 'ARRAY', 'ID3v2.4 multi-value TXXX returns arrayref' );
1383+
is( $tags->{ALBUMARTISTS}->[0], 'Artist1', 'ID3v2.4 multi-value TXXX value 1 ok' );
1384+
is( $tags->{ALBUMARTISTS}->[1], 'Artist2', 'ID3v2.4 multi-value TXXX value 2 ok' );
1385+
is( ref $tags->{ARTISTS}, 'ARRAY', 'ID3v2.4 multi-value TXXX ARTISTS returns arrayref' );
1386+
is( $tags->{ARTISTS}->[0], 'TrackArtist1', 'ID3v2.4 multi-value TXXX ARTISTS value 1 ok' );
1387+
is( $tags->{ARTISTS}->[1], 'TrackArtist2', 'ID3v2.4 multi-value TXXX ARTISTS value 2 ok' );
1388+
}
1389+
1390+
# Multi-value TXXX with 3 values
1391+
{
1392+
my $s = Audio::Scan->scan( _f('v2.4-txxx-multivalue-3.mp3') );
1393+
my $tags = $s->{tags};
1394+
1395+
is( ref $tags->{ALBUMARTISTS}, 'ARRAY', 'ID3v2.4 3-value TXXX returns arrayref' );
1396+
is( scalar @{$tags->{ALBUMARTISTS}}, 3, 'ID3v2.4 3-value TXXX has 3 elements' );
1397+
is( $tags->{ALBUMARTISTS}->[2], 'Artist3', 'ID3v2.4 3-value TXXX value 3 ok' );
1398+
}
1399+
1400+
# Multi-value TXXX with empty slot (tagger bug)
1401+
{
1402+
my $s = Audio::Scan->scan( _f('v2.4-txxx-multivalue-empty.mp3') );
1403+
my $tags = $s->{tags};
1404+
1405+
is( ref $tags->{ALBUMARTISTS}, 'ARRAY', 'ID3v2.4 TXXX with empty slot returns arrayref' );
1406+
is( scalar @{$tags->{ALBUMARTISTS}}, 2, 'ID3v2.4 TXXX empty slot is skipped' );
1407+
is( $tags->{ALBUMARTISTS}->[1], 'Artist3', 'ID3v2.4 TXXX value after empty slot ok' );
1408+
}
1409+
13771410
sub _f {
13781411
return catfile( $FindBin::Bin, 'mp3', shift );
13791412
}

0 commit comments

Comments
 (0)