Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add CD-Text test case

  • Loading branch information...
commit 9f2cf53f02261d99ec6917e2db44cadb305b5f84 1 parent 1ce18f4
R. Bernstein authored
Showing with 61 additions and 12 deletions.
  1. +3 −0  MANIFEST
  2. +10 −12 t/10.cdtext.t
  3. +48 −0 t/cdtext.toc
View
3  MANIFEST
@@ -14,6 +14,7 @@ examples/.gitignore
examples/audio.pl
examples/cd-read.pl
examples/cdchange.pl
+examples/cdtext.pl
examples/checkcd.pl
examples/device.pl
examples/drives.pl
@@ -66,7 +67,9 @@ t/07.iso1.t
t/07.iso2.t
t/07.iso3.t
t/10.cdda.t
+t/10.cdtext.t
t/10.read.t
t/11.dev.t
+t/cdtext.toc
THANKS
META.json
View
22 t/10.cdtext.t
@@ -1,8 +1,6 @@
#!/usr/bin/env perl
# Unit test for cdtext.
-use Test::More;
-
-plan skip_all => "CD-Text not finished yet";
+use Test::More 'no_plan';
use strict;
use warnings;
@@ -23,7 +21,7 @@ if ($perlcdio::VERSION_NUM <= 83) {
}
# Test getting CD-Text
-my $tocpath = File::Spect->catfile(dirname(__FILE__), 'cdtext.toc');
+my $tocpath = File::Spec->catfile(dirname(__FILE__), 'cdtext.toc');
my $device = Device::Cdio::Device->new($tocpath, $perlcdio::DRIVER_CDRDAO);
if ($perlcdio::VERSION_NUM <= 83) {
@@ -36,14 +34,14 @@ if ($perlcdio::VERSION_NUM <= 83) {
is($track1text->get_cdtext($perlcdio::CDTEXT_PERFORMER), 'Performer');
is($track1text->get_cdtext($perlcdio::CDTEXT_TITLE), 'Track Title');
} else {
- my $text = $device->get_cdtext();
- is($text->get_cdtext($perlcdio::CDTEXT_FIELD_PERFORMER, 0), 'Performer');
- is($text->get_cdtext($perlcdio::CDTEXT_FIELD_TITLE, 0), 'CD Title');
- # is($text->get_cdtext($perlcdio::CDTEXT_FIELD_DISCID, 0), 'XY12345');
-
- print $text->get_cdtext($perlcdio::CDTEXT_FIELD_PERFORMER, 0);
- is($text->get_cdtext($perlcdio::CDTEXT_FIELD_PERFORMER, 1), 'Performer');
- is($text->get_cdtext($perlcdio::CDTEXT_FIELD_TITLE, 1), 'Track Title');
+ my $text = $device->get_track_cdtext(0);
+ is($text->{PERFORMER}, 'Performer');
+ is($text->{TITLE}, 'CD Title');
+ # is($text->get_cdtext($perlcdio::CDTEXT_FIELD_DISCID), 'XY12345');
+
+ $text = $device->get_track_cdtext(1);
+ is($text->{PERFORMER}, 'Performer');
+ is($text->{TITLE}, 'Track Title');
}
View
48 t/cdtext.toc
@@ -0,0 +1,48 @@
+CD_DA
+
+// global CD-TEXT data
+
+CD_TEXT {
+
+ // Mapping from language number (0..7) used in 'LANGUAGE' statements
+ // to language code.
+/// LANGUAGE_MAP {
+/// 0 : EN // 9 is the code for ENGLISH,
+/// // I don't know any other language code, yet
+/// }
+
+ // Language number should always start with 0
+ LANGUAGE 0 {
+ // Required fields - at least all CD-TEXT CDs I've seen so far have them.
+ TITLE "CD Title"
+ PERFORMER "Performer"
+ DISC_ID "XY12345"
+ UPC_EAN "" // usually empty
+
+ // Further possible items, all of them are optional
+ ARRANGER ""
+ SONGWRITER ""
+ MESSAGE ""
+ GENRE "" // I'm not sure if this should be really ascii data
+ }
+}
+
+
+TRACK AUDIO
+// track specific CD-TEXT data
+CD_TEXT {
+ LANGUAGE 0 {
+ // if an item is defined for one track it should be defined for all tracks
+ TITLE "Track Title"
+
+ PERFORMER "Performer"
+ ISRC "US-XX1-98-01234"
+
+ ARRANGER ""
+ SONGWRITER ""
+ MESSAGE ""
+ }
+}
+
+SILENCE 1:0:0
+
Please sign in to comment.
Something went wrong with that request. Please try again.