taglib-ruby 0.6.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +1 -1
  3. data/{CHANGES.md → CHANGELOG.md} +46 -11
  4. data/README.md +61 -17
  5. data/Rakefile +12 -3
  6. data/docs/taglib/aiff.rb +95 -0
  7. data/docs/taglib/base.rb +30 -2
  8. data/docs/taglib/flac.rb +60 -4
  9. data/docs/taglib/id3v1.rb +29 -0
  10. data/docs/taglib/id3v2.rb +22 -3
  11. data/docs/taglib/mp4.rb +124 -13
  12. data/docs/taglib/mpeg.rb +30 -1
  13. data/docs/taglib/ogg.rb +47 -5
  14. data/docs/taglib/riff.rb +3 -0
  15. data/docs/taglib/vorbis.rb +1 -1
  16. data/docs/taglib/wav.rb +116 -0
  17. data/ext/extconf_common.rb +24 -3
  18. data/ext/taglib_aiff/extconf.rb +4 -0
  19. data/ext/taglib_aiff/taglib_aiff.i +84 -0
  20. data/ext/taglib_aiff/taglib_aiff_wrap.cxx +3111 -0
  21. data/ext/taglib_base/includes.i +34 -5
  22. data/ext/taglib_base/taglib_base.i +42 -2
  23. data/ext/taglib_base/taglib_base_wrap.cxx +226 -186
  24. data/ext/taglib_flac/taglib_flac.i +21 -18
  25. data/ext/taglib_flac/taglib_flac_wrap.cxx +519 -955
  26. data/ext/taglib_flac_picture/extconf.rb +4 -0
  27. data/ext/taglib_flac_picture/includes.i +15 -0
  28. data/ext/taglib_flac_picture/taglib_flac_picture.i +15 -0
  29. data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +3087 -0
  30. data/ext/taglib_id3v1/taglib_id3v1.i +19 -0
  31. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +391 -193
  32. data/ext/taglib_id3v2/relativevolumeframe.i +4 -17
  33. data/ext/taglib_id3v2/taglib_id3v2.i +72 -2
  34. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +3051 -1113
  35. data/ext/taglib_mp4/taglib_mp4.i +101 -20
  36. data/ext/taglib_mp4/taglib_mp4_wrap.cxx +1088 -282
  37. data/ext/taglib_mpeg/taglib_mpeg.i +11 -16
  38. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +646 -317
  39. data/ext/taglib_ogg/taglib_ogg.i +11 -0
  40. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +478 -192
  41. data/ext/taglib_vorbis/taglib_vorbis.i +8 -0
  42. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +202 -156
  43. data/ext/taglib_wav/extconf.rb +4 -0
  44. data/ext/taglib_wav/taglib_wav.i +90 -0
  45. data/ext/taglib_wav/taglib_wav_wrap.cxx +3423 -0
  46. data/lib/taglib.rb +2 -0
  47. data/lib/taglib/aiff.rb +7 -0
  48. data/lib/taglib/mp4.rb +2 -1
  49. data/lib/taglib/version.rb +2 -2
  50. data/lib/taglib/wav.rb +11 -0
  51. data/taglib-ruby.gemspec +42 -8
  52. data/tasks/ext.rake +48 -20
  53. data/tasks/gemspec_check.rake +1 -1
  54. data/tasks/swig.rake +36 -2
  55. data/test/aiff_examples_test.rb +39 -0
  56. data/test/aiff_file_test.rb +103 -0
  57. data/test/aiff_file_write_test.rb +88 -0
  58. data/test/data/Makefile +8 -2
  59. data/test/data/aiff-sample.aiff +0 -0
  60. data/test/data/flac_nopic.flac +0 -0
  61. data/test/data/vorbis-create.cpp +20 -1
  62. data/test/data/vorbis.oga +0 -0
  63. data/test/data/wav-create.cpp +55 -0
  64. data/test/data/wav-dump.cpp +74 -0
  65. data/test/data/wav-sample.wav +0 -0
  66. data/test/file_test.rb +21 -0
  67. data/test/fileref_properties_test.rb +1 -1
  68. data/test/flac_file_test.rb +45 -30
  69. data/test/flac_picture_memory_test.rb +43 -0
  70. data/test/id3v1_genres_test.rb +23 -0
  71. data/test/id3v1_tag_test.rb +1 -0
  72. data/test/id3v2_frames_test.rb +64 -0
  73. data/test/id3v2_tag_test.rb +6 -6
  74. data/test/id3v2_unknown_frames_test.rb +30 -0
  75. data/test/id3v2_write_test.rb +10 -13
  76. data/test/mp4_file_test.rb +33 -4
  77. data/test/mp4_file_write_test.rb +5 -5
  78. data/test/mp4_items_test.rb +83 -29
  79. data/test/mpeg_file_test.rb +120 -7
  80. data/test/vorbis_file_test.rb +2 -2
  81. data/test/vorbis_tag_test.rb +61 -7
  82. data/test/wav_examples_test.rb +42 -0
  83. data/test/wav_file_test.rb +108 -0
  84. data/test/wav_file_write_test.rb +113 -0
  85. metadata +86 -56
@@ -0,0 +1,23 @@
1
+ require File.join(File.dirname(__FILE__), 'helper')
2
+
3
+ class TestVorbisTag < Test::Unit::TestCase
4
+ context "TagLib::ID3v1" do
5
+ should "list genres" do
6
+ assert_equal "Jazz", TagLib::ID3v1::genre_list[8]
7
+ end
8
+
9
+ should "map genres to their index" do
10
+ assert_equal 8, TagLib::ID3v1::genre_map["Jazz"]
11
+ end
12
+
13
+ should "support to query the value of a genre" do
14
+ assert_equal "Jazz", TagLib::ID3v1::genre(8)
15
+ assert_equal "", TagLib::ID3v1::genre(255)
16
+ end
17
+
18
+ should "support to query the index of a genre" do
19
+ assert_equal 8, TagLib::ID3v1::genre_index("Jazz")
20
+ assert_equal 255, TagLib::ID3v1::genre_index("Unknown")
21
+ end
22
+ end
23
+ end
@@ -22,6 +22,7 @@ class TestID3v1Tag < Test::Unit::TestCase
22
22
  assert_equal 'Album', @tag.album
23
23
  assert_equal 'Comment', @tag.comment
24
24
  assert_equal 'Pop', @tag.genre
25
+ assert_equal 13, @tag.genre_number
25
26
  assert_equal 2011, @tag.year
26
27
  assert_equal 7, @tag.track
27
28
  assert_equal false, @tag.empty?
@@ -92,6 +92,70 @@ class TestID3v2Frames < Test::Unit::TestCase
92
92
  end
93
93
  end
94
94
 
95
+ context 'CTOC and CHAP frames' do
96
+ setup do
97
+ @chapters = [
98
+ { id: 'CH1', start_time: 100, end_time: 200 },
99
+ { id: 'CH2', start_time: 201, end_time: 300 },
100
+ { id: 'CH3', start_time: 301, end_time: 400 }
101
+ ]
102
+
103
+ @default_ctoc = TagLib::ID3v2::TableOfContentsFrame.new('Test')
104
+ @default_chap = TagLib::ID3v2::ChapterFrame.new('Test', 0, 1, 0xFFFFFFFF, 0xFFFFFFFF)
105
+ end
106
+
107
+ should 'not have a CTOC frame' do
108
+ assert_equal [], @tag.frame_list('CTOC')
109
+ end
110
+
111
+ should 'not have a CHAP frame' do
112
+ assert_equal [], @tag.frame_list('CHAP')
113
+ end
114
+
115
+ should 'have one CTOC frame (only one Table of Contents)' do
116
+ toc = TagLib::ID3v2::TableOfContentsFrame.new('TOC')
117
+ toc.is_top_level = true
118
+ toc.is_ordered = true
119
+
120
+ @chapters.each do |chapter|
121
+ toc.add_child_element(chapter[:id])
122
+ end
123
+
124
+ @tag.add_frame(toc)
125
+
126
+ ctoc_frame_list = @tag.frame_list('CTOC')
127
+ assert_equal @default_ctoc.class, ctoc_frame_list.first.class
128
+ assert_equal 1, ctoc_frame_list.size
129
+ assert_equal 'TOC', ctoc_frame_list.first.element_id
130
+ assert_equal 3, ctoc_frame_list.first.child_elements.size
131
+ assert_equal %w[CH1 CH2 CH3], ctoc_frame_list.first.child_elements
132
+ end
133
+
134
+ should 'have CHAP frames (multiple chapters)' do
135
+ start_offset = 0xFFFFFFFF
136
+ end_offset = 0xFFFFFFFF
137
+
138
+ @chapters.each do |chapter|
139
+ chapter_frame = TagLib::ID3v2::ChapterFrame.new(
140
+ chapter[:id],
141
+ chapter[:start_time].to_i,
142
+ chapter[:end_time].to_i,
143
+ start_offset,
144
+ end_offset
145
+ )
146
+
147
+ @tag.add_frame(chapter_frame)
148
+ end
149
+
150
+ chap_frame_list = @tag.frame_list('CHAP')
151
+ assert_equal @default_chap.class, chap_frame_list.first.class
152
+ assert_equal 3, chap_frame_list.size
153
+ assert_equal 'CH1', chap_frame_list[0].element_id
154
+ assert_equal 'CH2', chap_frame_list[1].element_id
155
+ assert_equal 'CH3', chap_frame_list[2].element_id
156
+ end
157
+ end
158
+
95
159
  context "TXXX frame" do
96
160
  setup do
97
161
  @txxx_frame = @tag.frame_list('TXXX').first
@@ -43,12 +43,12 @@ class TestID3v2Tag < Test::Unit::TestCase
43
43
  assert @tag.empty?
44
44
  end
45
45
 
46
- should "have nil for string attributes" do
47
- assert_nil @tag.title
48
- assert_nil @tag.artist
49
- assert_nil @tag.album
50
- assert_nil @tag.comment
51
- assert_nil @tag.genre
46
+ should "have empty string attributes" do
47
+ assert_equal "", @tag.title
48
+ assert_equal "", @tag.artist
49
+ assert_equal "", @tag.album
50
+ assert_equal "", @tag.comment
51
+ assert_equal "", @tag.genre
52
52
  end
53
53
 
54
54
  should "have 0 for numeric attributes" do
@@ -0,0 +1,30 @@
1
+ require File.join(File.dirname(__FILE__), 'helper')
2
+
3
+ class TestID3v2UnknownFrames < Test::Unit::TestCase
4
+ context "UnknownFrame" do
5
+ setup do
6
+ read_properties = false
7
+ @file = TagLib::MPEG::File.new("test/data/sample.mp3", read_properties)
8
+ @tag = @file.id3v2_tag
9
+ end
10
+
11
+ should "should be returned with correct class" do
12
+ f = TagLib::ID3v2::UnknownFrame.new("TDAT")
13
+ assert_not_nil f
14
+ @tag.add_frame(f)
15
+ frames = @tag.frame_list("TDAT")
16
+ tdat = frames.first
17
+ assert_not_nil tdat
18
+ # By looking at ID alone, it would have returned a
19
+ # TextIdentificationFrame. So make sure the correct
20
+ # class is returned here, because it would result in
21
+ # segfaults when calling methods on it.
22
+ assert_equal TagLib::ID3v2::UnknownFrame, tdat.class
23
+ end
24
+
25
+ teardown do
26
+ @file.close
27
+ @file = nil
28
+ end
29
+ end
30
+ end
@@ -54,21 +54,18 @@ class TestID3v2Write < Test::Unit::TestCase
54
54
  end
55
55
  end
56
56
 
57
- should "be able to save ID3v2.3 when compiled against TagLib >= 1.8" do
58
- if TagLib::TAGLIB_MAJOR_VERSION > 1 ||
59
- (TagLib::TAGLIB_MAJOR_VERSION == 1 && TagLib::TAGLIB_MINOR_VERSION >= 8)
60
- success = @file.save(TagLib::MPEG::File::ID3v2, true, 3)
61
- assert_equal true, success
62
- @file.close
63
- @file = nil
57
+ should "be able to save ID3v2.3" do
58
+ success = @file.save(TagLib::MPEG::File::ID3v2, true, 3)
59
+ assert_equal true, success
60
+ @file.close
61
+ @file = nil
64
62
 
65
- header = File.open(OUTPUT_FILE, 'rb') do |f|
66
- f.read(5)
67
- end
68
- # 3 stands for v2.3
69
- s = "ID3" + 3.chr + 0.chr
70
- assert_equal s, header
63
+ header = File.open(OUTPUT_FILE, 'rb') do |f|
64
+ f.read(5)
71
65
  end
66
+ # 3 stands for v2.3
67
+ s = "ID3" + 3.chr + 0.chr
68
+ assert_equal s, header
72
69
  end
73
70
 
74
71
  should "be able to set fields to nil" do
@@ -7,6 +7,11 @@ class MP4FileTest < Test::Unit::TestCase
7
7
  @tag = @file.tag
8
8
  end
9
9
 
10
+ should "have an MP4 tag" do
11
+ assert @file.mp4_tag?
12
+ refute_nil @tag
13
+ end
14
+
10
15
  should "contain basic tag information" do
11
16
  assert_equal "Title", @tag.title
12
17
  assert_equal "Artist", @tag.artist
@@ -15,9 +20,33 @@ class MP4FileTest < Test::Unit::TestCase
15
20
  assert_equal "Pop", @tag.genre
16
21
  assert_equal 2011, @tag.year
17
22
  assert_equal 7, @tag.track
23
+
18
24
  assert_equal false, @tag.empty?
19
25
  end
20
26
 
27
+ should "support testing for the presence of items" do
28
+ refute @tag.contains "unknown"
29
+ assert @tag.contains "trkn"
30
+ end
31
+
32
+ should "support accessing items" do
33
+ refute @tag["unkn"].valid?
34
+
35
+ assert @tag["trkn"].valid?
36
+ assert_equal 7, @tag.track
37
+ end
38
+
39
+ should "support editing items" do
40
+ @tag["trkn"] = TagLib::MP4::Item.from_int(1)
41
+ assert_equal 1, @tag.track
42
+ end
43
+
44
+ should "support removing items" do
45
+ assert @tag.contains "trkn"
46
+ @tag.remove_item("trkn")
47
+ refute @tag.contains "trkn"
48
+ end
49
+
21
50
  context "audio properties" do
22
51
  setup do
23
52
  @properties = @file.audio_properties
@@ -28,8 +57,8 @@ class MP4FileTest < Test::Unit::TestCase
28
57
  end
29
58
 
30
59
  should "contain basic information" do
31
- assert_equal 1, @properties.length
32
- assert_equal 54, @properties.bitrate
60
+ assert_equal 1, @properties.length_in_seconds
61
+ assert_equal 55, @properties.bitrate
33
62
  assert_equal 44100, @properties.sample_rate
34
63
  # The test file is mono, this appears to be a TagLib bug
35
64
  assert_equal 2, @properties.channels
@@ -37,8 +66,8 @@ class MP4FileTest < Test::Unit::TestCase
37
66
 
38
67
  should "contain mp4-specific information" do
39
68
  assert_equal 16, @properties.bits_per_sample
40
- # Properties#encrypted? raises a NoMethodError
41
- # assert_equal false, @properties.encrypted?
69
+ assert_equal false, @properties.encrypted?
70
+ assert_equal TagLib::MP4::Properties::AAC, @properties.codec
42
71
  end
43
72
  end
44
73
 
@@ -34,22 +34,22 @@ class MP4FileWriteTest < Test::Unit::TestCase
34
34
  end
35
35
 
36
36
  should "be able to add and save new cover art" do
37
- item_list_map = @file.tag.item_list_map
38
- cover_art_list = item_list_map['covr'].to_cover_art_list
37
+ item_map = @file.tag.item_map
38
+ cover_art_list = item_map['covr'].to_cover_art_list
39
39
  assert_equal 1, cover_art_list.size
40
40
 
41
41
  data = File.open(PICTURE_FILE, 'rb') { |f| f.read }
42
42
  new_cover_art = TagLib::MP4::CoverArt.new(TagLib::MP4::CoverArt::JPEG, data)
43
43
 
44
44
  cover_art_list << new_cover_art
45
- item_list_map.insert('covr', TagLib::MP4::Item.from_cover_art_list(cover_art_list))
46
- assert_equal 2, item_list_map['covr'].to_cover_art_list.size
45
+ item_map.insert('covr', TagLib::MP4::Item.from_cover_art_list(cover_art_list))
46
+ assert_equal 2, item_map['covr'].to_cover_art_list.size
47
47
 
48
48
  success = @file.save
49
49
  assert success
50
50
 
51
51
  reloaded do |file|
52
- written_cover_art = file.tag.item_list_map['covr'].to_cover_art_list.last
52
+ written_cover_art = file.tag.item_map['covr'].to_cover_art_list.last
53
53
  assert_equal TagLib::MP4::CoverArt::JPEG, written_cover_art.format
54
54
  assert_equal data, written_cover_art.data
55
55
  end
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require File.join(File.dirname(__FILE__), 'helper')
3
+ require 'set'
3
4
 
4
5
  class MP4ItemsTest < Test::Unit::TestCase
5
6
  ITUNES_LEADER = "\xC2\xA9"
@@ -8,44 +9,44 @@ class MP4ItemsTest < Test::Unit::TestCase
8
9
  setup do
9
10
  @file = TagLib::MP4::File.new("test/data/mp4.m4a")
10
11
  @tag = @file.tag
11
- @item_list_map = @file.tag.item_list_map
12
+ @item_map = @file.tag.item_map
12
13
  @item_keys = [
13
- "cover", "#{ITUNES_LEADER}nam", "#{ITUNES_LEADER}ART", "#{ITUNES_LEADER}alb",
14
+ "covr", "#{ITUNES_LEADER}nam", "#{ITUNES_LEADER}ART", "#{ITUNES_LEADER}alb",
14
15
  "#{ITUNES_LEADER}cmt", "#{ITUNES_LEADER}gen", "#{ITUNES_LEADER}day",
15
16
  "trkn", "#{ITUNES_LEADER}too", "#{ITUNES_LEADER}cpy"
16
17
  ]
17
18
  end
18
19
 
19
- context "item_list_map" do
20
+ context "item_map" do
20
21
  should "exist" do
21
- assert_not_nil @item_list_map
22
+ assert_not_nil @item_map
22
23
  end
23
24
 
24
25
  should "not be empty" do
25
- assert_equal false, @item_list_map.empty?
26
+ assert_equal false, @item_map.empty?
26
27
  end
27
28
 
28
29
  should "contain 10 items" do
29
- assert_equal @item_keys.count, @item_list_map.size
30
+ assert_equal @item_keys.count, @item_map.size
30
31
  end
31
32
 
32
33
  should "have keys" do
33
- assert_equal true, @item_list_map.contains("trkn")
34
- assert_equal true, @item_list_map.has_key?("#{ITUNES_LEADER}too")
35
- assert_equal true, @item_list_map.include?("#{ITUNES_LEADER}cpy")
36
- assert_equal false, @item_list_map.include?("none such key")
34
+ assert_equal true, @item_map.contains("trkn")
35
+ assert_equal true, @item_map.has_key?("#{ITUNES_LEADER}too")
36
+ assert_equal true, @item_map.include?("#{ITUNES_LEADER}cpy")
37
+ assert_equal false, @item_map.include?("none such key")
37
38
  end
38
39
 
39
40
  should "look up keys" do
40
- assert_nil @item_list_map["none such key"]
41
- assert_equal ["Title"], @item_list_map["#{ITUNES_LEADER}nam"].to_string_list
41
+ assert_nil @item_map["none such key"]
42
+ assert_equal ["Title"], @item_map["#{ITUNES_LEADER}nam"].to_string_list
42
43
  end
43
44
 
44
45
  should "be clearable" do
45
- assert_equal 10, @item_list_map.size
46
- comment = @item_list_map["#{ITUNES_LEADER}cmt"]
47
- @item_list_map.clear
48
- assert_equal true, @item_list_map.empty?
46
+ assert_equal 10, @item_map.size
47
+ comment = @item_map["#{ITUNES_LEADER}cmt"]
48
+ @item_map.clear
49
+ assert_equal true, @item_map.empty?
49
50
  begin
50
51
  comment.to_string_list
51
52
  flunk("Should have raised ObjectPreviouslyDeleted.")
@@ -54,23 +55,29 @@ class MP4ItemsTest < Test::Unit::TestCase
54
55
  end
55
56
  end
56
57
 
57
- should "be convertable to an array" do
58
- array = @item_list_map.to_a
58
+ should "be convertible to an array" do
59
+ array = @item_map.to_a
59
60
  assert_equal 10, array.count
60
61
  array.each do |object|
61
62
  assert_equal Array, object.class
62
63
  assert_equal 2, object.count
63
64
  assert_equal String, object.first.class
64
65
  assert_equal TagLib::MP4::Item, object.last.class
66
+ assert_includes @item_keys, object.first
65
67
  end
66
68
  end
69
+
70
+ should "be convertible to a hash" do
71
+ hsh = @item_map.to_h
72
+ assert_equal Set.new(hsh.keys), Set.new(@item_keys)
73
+ end
67
74
  end
68
75
 
69
76
  should "be removable" do
70
- assert_equal 10, @item_list_map.size
71
- title = @item_list_map["#{ITUNES_LEADER}nam"]
72
- @item_list_map.erase("#{ITUNES_LEADER}nam")
73
- assert_equal 9, @item_list_map.size
77
+ assert_equal 10, @item_map.size
78
+ title = @item_map["#{ITUNES_LEADER}nam"]
79
+ @item_map.erase("#{ITUNES_LEADER}nam")
80
+ assert_equal 9, @item_map.size
74
81
  begin
75
82
  title.to_string_list
76
83
  flunk("Should have raised ObjectPreviouslyDeleted.")
@@ -79,18 +86,47 @@ class MP4ItemsTest < Test::Unit::TestCase
79
86
  end
80
87
  end
81
88
 
89
+ should "reflect edition of items from the tag" do
90
+ assert @tag.contains "trkn"
91
+ track = @item_map["trkn"]
92
+
93
+ @tag["trkn"] = TagLib::MP4::Item.from_int(1)
94
+
95
+ begin
96
+ track.to_int_pair[0]
97
+ flunk("Should have raised ObjectPreviouslyDeleted.")
98
+ rescue => e
99
+ assert_equal "ObjectPreviouslyDeleted", e.class.to_s
100
+ end
101
+ end
102
+
103
+ should "reflect removal of items from the tag" do
104
+ assert @tag.contains "trkn"
105
+ track = @item_map["trkn"]
106
+
107
+ @tag.remove_item("trkn")
108
+ refute @item_map.contains "trkn"
109
+
110
+ begin
111
+ track.to_int_pair[0]
112
+ flunk("Should have raised ObjectPreviouslyDeleted.")
113
+ rescue => e
114
+ assert_equal "ObjectPreviouslyDeleted", e.class.to_s
115
+ end
116
+ end
117
+
82
118
  context "inserting items" do
83
119
  should "insert a new item" do
84
120
  new_title = TagLib::MP4::Item.from_string_list(['new title'])
85
- @item_list_map.insert("#{ITUNES_LEADER}nam", new_title)
121
+ @item_map.insert("#{ITUNES_LEADER}nam", new_title)
86
122
  new_title = nil
87
123
  GC.start
88
- assert_equal ['new title'], @item_list_map["#{ITUNES_LEADER}nam"].to_string_list
124
+ assert_equal ['new title'], @item_map["#{ITUNES_LEADER}nam"].to_string_list
89
125
  end
90
126
 
91
127
  should "unlink items that get replaced" do
92
- title = @item_list_map["#{ITUNES_LEADER}nam"]
93
- @item_list_map.insert("#{ITUNES_LEADER}nam", TagLib::MP4::Item.from_int(1))
128
+ title = @item_map["#{ITUNES_LEADER}nam"]
129
+ @item_map.insert("#{ITUNES_LEADER}nam", TagLib::MP4::Item.from_int(1))
94
130
  begin
95
131
  title.to_string_list
96
132
  flunk("Should have raised ObjectPreviouslyDeleted.")
@@ -101,16 +137,34 @@ class MP4ItemsTest < Test::Unit::TestCase
101
137
  end
102
138
 
103
139
  context "TagLib::MP4::Item" do
140
+ should "be creatable from a boolean" do
141
+ item = TagLib::MP4::Item.from_bool(false)
142
+ assert_equal TagLib::MP4::Item, item.class
143
+ assert_equal false, item.to_bool
144
+ end
145
+
146
+ should "be creatable from a byte" do
147
+ item = TagLib::MP4::Item.from_byte(123)
148
+ assert_equal TagLib::MP4::Item, item.class
149
+ assert_equal 123, item.to_byte
150
+ end
151
+
152
+ should "be creatable from an unsigned int" do
153
+ item = TagLib::MP4::Item.from_int(12346)
154
+ assert_equal TagLib::MP4::Item, item.class
155
+ assert_equal 12346, item.to_uint
156
+ end
157
+
104
158
  should "be creatable from an int" do
105
159
  item = TagLib::MP4::Item.from_int(-42)
106
160
  assert_equal TagLib::MP4::Item, item.class
107
161
  assert_equal -42, item.to_int
108
162
  end
109
163
 
110
- should "be creatable from a boolean" do
111
- item = TagLib::MP4::Item.from_bool(false)
164
+ should "be creatable from a long long" do
165
+ item = TagLib::MP4::Item.from_long_long(1234567890)
112
166
  assert_equal TagLib::MP4::Item, item.class
113
- assert_equal false, item.to_bool
167
+ assert_equal 1234567890, item.to_long_long
114
168
  end
115
169
 
116
170
  context ".from_int_pair" do