taglib-ruby 0.7.1 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +7 -0
  3. data/README.md +25 -10
  4. data/Rakefile +11 -1
  5. data/docs/taglib/aiff.rb +35 -3
  6. data/docs/taglib/base.rb +8 -1
  7. data/docs/taglib/flac.rb +60 -4
  8. data/docs/taglib/id3v1.rb +29 -0
  9. data/docs/taglib/id3v2.rb +1 -1
  10. data/docs/taglib/mp4.rb +124 -13
  11. data/docs/taglib/mpeg.rb +30 -1
  12. data/docs/taglib/ogg.rb +47 -5
  13. data/docs/taglib/vorbis.rb +1 -1
  14. data/docs/taglib/wav.rb +56 -3
  15. data/ext/extconf_common.rb +9 -2
  16. data/ext/taglib_aiff/taglib_aiff.i +16 -0
  17. data/ext/taglib_aiff/taglib_aiff_wrap.cxx +228 -58
  18. data/ext/taglib_base/includes.i +4 -4
  19. data/ext/taglib_base/taglib_base.i +24 -2
  20. data/ext/taglib_base/taglib_base_wrap.cxx +76 -51
  21. data/ext/taglib_flac/taglib_flac.i +14 -18
  22. data/ext/taglib_flac/taglib_flac_wrap.cxx +341 -799
  23. data/ext/taglib_flac_picture/extconf.rb +4 -0
  24. data/ext/taglib_flac_picture/includes.i +15 -0
  25. data/ext/taglib_flac_picture/taglib_flac_picture.i +15 -0
  26. data/ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx +3087 -0
  27. data/ext/taglib_id3v1/taglib_id3v1.i +19 -0
  28. data/ext/taglib_id3v1/taglib_id3v1_wrap.cxx +241 -58
  29. data/ext/taglib_id3v2/taglib_id3v2.i +52 -1
  30. data/ext/taglib_id3v2/taglib_id3v2_wrap.cxx +152 -155
  31. data/ext/taglib_mp4/taglib_mp4.i +100 -19
  32. data/ext/taglib_mp4/taglib_mp4_wrap.cxx +939 -148
  33. data/ext/taglib_mpeg/taglib_mpeg.i +11 -16
  34. data/ext/taglib_mpeg/taglib_mpeg_wrap.cxx +522 -208
  35. data/ext/taglib_ogg/taglib_ogg.i +11 -0
  36. data/ext/taglib_ogg/taglib_ogg_wrap.cxx +328 -57
  37. data/ext/taglib_vorbis/taglib_vorbis.i +8 -0
  38. data/ext/taglib_vorbis/taglib_vorbis_wrap.cxx +53 -22
  39. data/ext/taglib_wav/taglib_wav.i +24 -0
  40. data/ext/taglib_wav/taglib_wav_wrap.cxx +543 -198
  41. data/lib/taglib/mp4.rb +2 -1
  42. data/lib/taglib/version.rb +3 -3
  43. data/lib/taglib/wav.rb +4 -0
  44. data/taglib-ruby.gemspec +15 -9
  45. data/tasks/ext.rake +36 -15
  46. data/tasks/swig.rake +26 -2
  47. data/test/aiff_examples_test.rb +1 -1
  48. data/test/aiff_file_test.rb +12 -3
  49. data/test/data/vorbis-create.cpp +20 -1
  50. data/test/data/vorbis.oga +0 -0
  51. data/test/fileref_properties_test.rb +1 -1
  52. data/test/flac_file_test.rb +45 -30
  53. data/test/id3v1_genres_test.rb +23 -0
  54. data/test/id3v1_tag_test.rb +1 -0
  55. data/test/id3v2_tag_test.rb +6 -6
  56. data/test/id3v2_write_test.rb +10 -13
  57. data/test/mp4_file_test.rb +33 -4
  58. data/test/mp4_file_write_test.rb +5 -5
  59. data/test/mp4_items_test.rb +83 -29
  60. data/test/mpeg_file_test.rb +120 -7
  61. data/test/vorbis_file_test.rb +2 -2
  62. data/test/vorbis_tag_test.rb +61 -7
  63. data/test/wav_examples_test.rb +1 -1
  64. data/test/wav_file_test.rb +53 -41
  65. data/test/wav_file_write_test.rb +25 -0
  66. metadata +19 -9
data/lib/taglib/mp4.rb CHANGED
@@ -22,10 +22,11 @@ module TagLib::MP4
22
22
  end
23
23
  end
24
24
 
25
- class ItemListMap
25
+ class ItemMap
26
26
  alias :clear :_clear
27
27
  alias :insert :_insert
28
28
  alias :[] :fetch
29
+ alias :[]= :insert
29
30
  remove_method :_clear
30
31
  remove_method :_insert
31
32
 
@@ -1,8 +1,8 @@
1
1
  module TagLib
2
2
  module Version
3
- MAJOR = 0
4
- MINOR = 7
5
- PATCH = 1
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ PATCH = 0
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
data/lib/taglib/wav.rb CHANGED
@@ -1,6 +1,10 @@
1
1
  require 'taglib_wav'
2
2
 
3
3
  module TagLib::RIFF::WAV
4
+
5
+ FORMAT_UNKNOWN = 0x0000
6
+ FORMAT_PCM = 0x0001
7
+
4
8
  class File
5
9
  extend ::TagLib::FileOpenable
6
10
  end
data/taglib-ruby.gemspec CHANGED
@@ -23,10 +23,10 @@ DESC
23
23
  s.require_paths = ["lib"]
24
24
  s.requirements = ["taglib (libtag1-dev in Debian/Ubuntu, taglib-devel in Fedora/RHEL)"]
25
25
 
26
- s.add_development_dependency 'bundler', '~> 1.2'
26
+ s.add_development_dependency 'bundler', '>= 1.2', '< 3'
27
27
  s.add_development_dependency 'rake-compiler', '~> 0.9'
28
28
  s.add_development_dependency 'shoulda-context', '~> 1.0'
29
- s.add_development_dependency 'yard', '~> 0.7'
29
+ s.add_development_dependency 'yard', '~> 0.9.12'
30
30
  s.add_development_dependency 'kramdown', '~> 1.0'
31
31
  s.add_development_dependency 'test-unit', '~> 3.1'
32
32
 
@@ -38,6 +38,7 @@ DESC
38
38
  "ext/taglib_ogg/extconf.rb",
39
39
  "ext/taglib_vorbis/extconf.rb",
40
40
  "ext/taglib_flac/extconf.rb",
41
+ "ext/taglib_flac_picture/extconf.rb",
41
42
  "ext/taglib_mp4/extconf.rb",
42
43
  "ext/taglib_aiff/extconf.rb",
43
44
  "ext/taglib_wav/extconf.rb",
@@ -78,6 +79,10 @@ DESC
78
79
  "ext/taglib_flac/extconf.rb",
79
80
  "ext/taglib_flac/taglib_flac.i",
80
81
  "ext/taglib_flac/taglib_flac_wrap.cxx",
82
+ "ext/taglib_flac_picture/extconf.rb",
83
+ "ext/taglib_flac_picture/includes.i",
84
+ "ext/taglib_flac_picture/taglib_flac_picture.i",
85
+ "ext/taglib_flac_picture/taglib_flac_picture_wrap.cxx",
81
86
  "ext/taglib_id3v1/extconf.rb",
82
87
  "ext/taglib_id3v1/taglib_id3v1.i",
83
88
  "ext/taglib_id3v1/taglib_id3v1_wrap.cxx",
@@ -119,10 +124,13 @@ DESC
119
124
  "tasks/ext.rake",
120
125
  "tasks/gemspec_check.rake",
121
126
  "tasks/swig.rake",
127
+ "test/aiff_examples_test.rb",
128
+ "test/aiff_file_test.rb",
129
+ "test/aiff_file_write_test.rb",
122
130
  "test/base_test.rb",
123
131
  "test/data/Makefile",
124
- "test/data/aiff-sample.aiff",
125
132
  "test/data/add-relative-volume.cpp",
133
+ "test/data/aiff-sample.aiff",
126
134
  "test/data/crash.mp3",
127
135
  "test/data/flac-create.cpp",
128
136
  "test/data/flac.flac",
@@ -141,16 +149,14 @@ DESC
141
149
  "test/data/wav-create.cpp",
142
150
  "test/data/wav-dump.cpp",
143
151
  "test/data/wav-sample.wav",
144
- "test/aiff_examples_test.rb",
145
- "test/aiff_file_test.rb",
146
- "test/aiff_file_write_test.rb",
147
- "test/helper.rb",
152
+ "test/file_test.rb",
148
153
  "test/fileref_open_test.rb",
149
154
  "test/fileref_properties_test.rb",
150
155
  "test/fileref_write_test.rb",
151
- "test/file_test.rb",
152
156
  "test/flac_file_test.rb",
153
157
  "test/flac_file_write_test.rb",
158
+ "test/helper.rb",
159
+ "test/id3v1_genres_test.rb",
154
160
  "test/id3v1_tag_test.rb",
155
161
  "test/id3v2_frames_test.rb",
156
162
  "test/id3v2_header_test.rb",
@@ -170,6 +176,6 @@ DESC
170
176
  "test/vorbis_tag_test.rb",
171
177
  "test/wav_examples_test.rb",
172
178
  "test/wav_file_test.rb",
173
- "test/wav_file_write_test.rb",
179
+ "test/wav_file_write_test.rb"
174
180
  ]
175
181
  end
data/tasks/ext.rake CHANGED
@@ -1,19 +1,28 @@
1
1
  # Extension tasks and cross-compiling
2
2
 
3
3
  host = 'i686-w64-mingw32'
4
- $plat = 'i386-mingw32'
4
+ $plat = ENV['PLATFORM'] || 'i386-mingw32'
5
5
 
6
- tmp = "#{Dir.pwd}/tmp/#{$plat}"
6
+
7
+ taglib_version = ENV['TAGLIB_VERSION'] || '1.9.1'
8
+ taglib = "taglib-#{taglib_version}"
9
+
10
+ tmp = "#{Dir.pwd}/tmp"
11
+ tmp_arch = "#{tmp}/#{$plat}"
7
12
  toolchain_file = "#{Dir.pwd}/ext/win.cmake"
8
- install_dir = "#{tmp}/install"
13
+ install_dir = "#{tmp_arch}/#{taglib}"
9
14
  install_dll = "#{install_dir}/bin/libtag.dll"
15
+ install_so = "#{install_dir}/lib/libtag.so"
10
16
  $cross_config_options = ["--with-opt-dir=#{install_dir}"]
11
17
 
12
- taglib_version = '1.9.1'
13
- taglib = "taglib-#{taglib_version}"
14
- taglib_url = "https://github.com/taglib/taglib/releases/download/v#{taglib_version}/#{taglib}.tar.gz"
15
- # WITH_MP4, WITH_ASF only needed with taglib 1.7, will be default in 1.8
16
- taglib_options = "-DCMAKE_BUILD_TYPE=Release -DWITH_MP4=ON -DWITH_ASF=ON"
18
+ taglib_url = "https://github.com/taglib/taglib/archive/v#{taglib_version}.tar.gz"
19
+ taglib_options = [ "-DCMAKE_BUILD_TYPE=Release",
20
+ "-DBUILD_EXAMPLES=OFF",
21
+ "-DBUILD_TESTS=OFF",
22
+ "-DBUILD_BINDINGS=OFF", # 1.11 builds bindings by default
23
+ "-DBUILD_SHARED_LIBS=ON", # 1.11 builds static by default
24
+ "-DWITH_MP4=ON",# WITH_MP4, WITH_ASF only needed with taglib 1.7, will be default in 1.8
25
+ "-DWITH_ASF=ON"].join(' ')
17
26
 
18
27
  def configure_cross_compile(ext)
19
28
  ext.cross_compile = true
@@ -43,6 +52,9 @@ end
43
52
  Rake::ExtensionTask.new("taglib_vorbis", $gemspec) do |ext|
44
53
  configure_cross_compile(ext)
45
54
  end
55
+ Rake::ExtensionTask.new("taglib_flac_picture", $gemspec) do |ext|
56
+ configure_cross_compile(ext)
57
+ end
46
58
  Rake::ExtensionTask.new("taglib_flac", $gemspec) do |ext|
47
59
  configure_cross_compile(ext)
48
60
  end
@@ -62,7 +74,7 @@ task :cross do
62
74
  ENV["CXX"] = "#{host}-g++"
63
75
  end
64
76
 
65
- file "tmp/#{$plat}/stage/lib/libtag.dll" => [install_dll] do |f|
77
+ file "#{tmp_arch}/stage/lib/libtag.dll" => [install_dll] do |f|
66
78
  install install_dll, f
67
79
  end
68
80
 
@@ -74,6 +86,18 @@ file install_dll => ["#{tmp}/#{taglib}"] do
74
86
  end
75
87
  end
76
88
 
89
+ task :vendor => [install_so]
90
+
91
+ file install_so => ["#{tmp_arch}/#{taglib}", "#{tmp_arch}/#{taglib}-build", "#{tmp}/#{taglib}"] do
92
+ chdir "#{tmp_arch}/#{taglib}-build" do
93
+ sh %(cmake -DCMAKE_INSTALL_PREFIX=#{install_dir} #{taglib_options} #{tmp}/#{taglib})
94
+ sh "make install VERBOSE=1"
95
+ end
96
+ end
97
+
98
+ directory "#{tmp_arch}/#{taglib}"
99
+ directory "#{tmp_arch}/#{taglib}-build"
100
+
77
101
  file "#{tmp}/#{taglib}" => ["#{tmp}/#{taglib}.tar.gz"] do
78
102
  chdir tmp do
79
103
  sh "tar xzf #{taglib}.tar.gz"
@@ -83,12 +107,9 @@ end
83
107
  file "#{tmp}/#{taglib}.tar.gz" => [tmp] do |t|
84
108
  require 'open-uri'
85
109
  puts "Downloading #{taglib_url}"
86
- data = open(taglib_url).read()
87
- break if data == nil
88
- chdir tmp do
89
- open(File.basename(t.name), 'wb') do |f|
90
- f.write(data)
91
- end
110
+
111
+ File.open(t.name, 'wb') do |f|
112
+ IO.copy_stream(open(taglib_url), f)
92
113
  end
93
114
  end
94
115
 
data/tasks/swig.rake CHANGED
@@ -1,11 +1,30 @@
1
1
  # Tasks for generating SWIG wrappers in ext
2
2
 
3
+ # Execute SWIG for the specified extension.
4
+ # Arguments:
5
+ # mod:: The name of the SWIG wrapper to process.
6
+ #
7
+ # If the TAGLIB_DIR environment variable points to a directory,
8
+ # $TAGLIB_DIR/include will be searched first for taglib headers.
3
9
  def run_swig(mod)
4
10
  swig = `which swig`.chomp
5
11
  if swig.empty?
6
12
  swig = `which swig2.0`.chomp
7
13
  end
8
- sh "cd ext/#{mod} && #{swig} -c++ -ruby -autorename -initname #{mod} -I/usr/local/include -I/usr/include #{mod}.i"
14
+
15
+ # Standard search location for headers
16
+ include_args = %w{-I/usr/local/include -I/usr/include}
17
+
18
+ if ENV.has_key?('TAGLIB_DIR')
19
+ unless File.directory?(ENV['TAGLIB_DIR'])
20
+ abort "When defined, the TAGLIB_DIR environment variable must point to a valid directory."
21
+ end
22
+
23
+ # Push it in front to get it searched first.
24
+ include_args.unshift('-I' + ENV['TAGLIB_DIR'] + '/include')
25
+ end
26
+
27
+ sh "cd ext/#{mod} && #{swig} -c++ -ruby -autorename -initname #{mod} #{include_args.join(' ')} #{mod}.i"
9
28
  end
10
29
 
11
30
  task :swig =>
@@ -15,6 +34,7 @@ task :swig =>
15
34
  'ext/taglib_id3v2/taglib_id3v2_wrap.cxx',
16
35
  'ext/taglib_ogg/taglib_ogg_wrap.cxx',
17
36
  'ext/taglib_vorbis/taglib_vorbis_wrap.cxx',
37
+ 'ext/taglib_flac/taglib_flac_picture_wrap.cxx',
18
38
  'ext/taglib_flac/taglib_flac_wrap.cxx',
19
39
  'ext/taglib_mp4/taglib_mp4_wrap.cxx',
20
40
  'ext/taglib_aiff/taglib_aiff_wrap.cxx',
@@ -47,7 +67,11 @@ file 'ext/taglib_vorbis/taglib_vorbis_wrap.cxx' => ['ext/taglib_vorbis/taglib_vo
47
67
  run_swig('taglib_vorbis')
48
68
  end
49
69
 
50
- file 'ext/taglib_flac/taglib_flac_wrap.cxx' => ['ext/taglib_flac/taglib_flac.i'] + base_dependencies do
70
+ file 'ext/taglib_flac/taglib_flac_picture_wrap.cxx' => ['ext/taglib_flac_picture/taglib_flac_picture.i'] + base_dependencies do
71
+ run_swig('taglib_flac_picture')
72
+ end
73
+
74
+ file 'ext/taglib_flac/taglib_flac_wrap.cxx' => ['ext/taglib_flac/taglib_flac.i', 'ext/taglib_flac_picture/taglib_flac_picture.i'] + base_dependencies do
51
75
  run_swig('taglib_flac')
52
76
  end
53
77
 
@@ -16,7 +16,7 @@ class AIFFExamples < Test::Unit::TestCase
16
16
 
17
17
  # @example Reading AIFF-specific audio properties
18
18
  TagLib::RIFF::AIFF::File.open("#{DATA_FILE_PREFIX}sample.aiff") do |file|
19
- file.audio_properties.sample_width #=> 16
19
+ file.audio_properties.bits_per_sample #=> 16
20
20
  end
21
21
 
22
22
  # @example Saving ID3v2 cover-art to disk
@@ -15,7 +15,8 @@ class AIFFFileTest < Test::Unit::TestCase
15
15
  end
16
16
 
17
17
  should "have an ID3v2 tag" do
18
- assert_not_nil @tag
18
+ assert @file.id3v2_tag?
19
+ refute_nil @tag
19
20
  assert_equal TagLib::ID3v2::Tag, @tag.class
20
21
  end
21
22
 
@@ -64,14 +65,22 @@ class AIFFFileTest < Test::Unit::TestCase
64
65
  end
65
66
 
66
67
  should "contain basic information" do
67
- assert_equal 2, @properties.length
68
+ assert_equal 2, @properties.length_in_seconds
69
+ assert_equal 2937, @properties.length_in_milliseconds
68
70
  assert_equal 256, @properties.bitrate
69
71
  assert_equal 8000, @properties.sample_rate
70
72
  assert_equal 2, @properties.channels
71
73
  end
72
74
 
73
75
  should "contain AIFF-specific information" do
74
- assert_equal 16, @properties.sample_width
76
+ assert_equal 16, @properties.bits_per_sample
77
+ assert_equal 23493, @properties.sample_frames
78
+ end
79
+
80
+ should "do not contain AIFF-C information" do
81
+ refute @properties.aiff_c?
82
+ assert_equal "", @properties.compression_type
83
+ assert_equal "", @properties.compression_name
75
84
  end
76
85
  end
77
86
 
@@ -4,11 +4,13 @@
4
4
  #include <taglib/taglib.h>
5
5
  #include <taglib/vorbisfile.h>
6
6
 
7
+ #include "get_picture_data.cpp"
8
+
7
9
  using namespace TagLib;
8
10
 
9
11
  int main(int argc, char **argv) {
10
12
  if (argc != 2) {
11
- std::cout << "usage: " << argv[0] << " file.mp3" << std::endl;
13
+ std::cout << "usage: " << argv[0] << " file.oga" << std::endl;
12
14
  exit(1);
13
15
  }
14
16
  char *filename = argv[1];
@@ -16,6 +18,9 @@ int main(int argc, char **argv) {
16
18
  Vorbis::File file(filename);
17
19
  Ogg::XiphComment *tag = file.tag();
18
20
 
21
+ tag->removeAllFields();
22
+ tag->removeAllPictures();
23
+
19
24
  tag->setTitle("Title");
20
25
  tag->setArtist("Artist");
21
26
  tag->setAlbum("Album");
@@ -36,6 +41,20 @@ int main(int argc, char **argv) {
36
41
  tag->addField("MULTIPLE", "A");
37
42
  tag->addField("MULTIPLE", "B", false);
38
43
 
44
+ ByteVector pictureData = getPictureData("globe_east_90.jpg");
45
+
46
+ FLAC::Picture picture;
47
+ picture.setType(FLAC::Picture::FrontCover);
48
+ picture.setMimeType("image/jpeg");
49
+ picture.setDescription("Globe");
50
+ picture.setWidth(90);
51
+ picture.setHeight(90);
52
+ picture.setColorDepth(24);
53
+ picture.setNumColors(0);
54
+ picture.setData(pictureData);
55
+
56
+ tag->addField("METADATA_BLOCK_PICTURE", picture.render().toBase64());
57
+
39
58
  file.save();
40
59
  }
41
60
 
data/test/data/vorbis.oga CHANGED
Binary file
@@ -12,7 +12,7 @@ class TestFileRefProperties < Test::Unit::TestCase
12
12
  end
13
13
 
14
14
  should "contain basic information" do
15
- assert_equal 2, @properties.length
15
+ assert_equal 2, @properties.length_in_seconds
16
16
  assert_equal 157, @properties.bitrate
17
17
  assert_equal 44100, @properties.sample_rate
18
18
  assert_equal 2, @properties.channels
@@ -13,19 +13,27 @@ class FlacFileTest < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  should "have XiphComment" do
16
+ assert @file.xiph_comment?
16
17
  tag = @file.xiph_comment
17
18
  assert_not_nil tag
18
19
  assert_equal TagLib::Ogg::XiphComment, tag.class
19
20
  end
20
21
 
21
22
  should "have method for ID3v1 tag" do
23
+ refute @file.id3v1_tag?
22
24
  assert_nil @file.id3v1_tag
23
25
  end
24
26
 
25
27
  should "have method for ID3v2 tag" do
28
+ refute @file.id3v2_tag?
26
29
  assert_nil @file.id3v2_tag
27
30
  end
28
31
 
32
+ should "support stripping tags by type" do
33
+ @file.strip(TagLib::FLAC::File::XiphComment)
34
+ assert @file.xiph_comment?
35
+ end
36
+
29
37
  context "audio properties" do
30
38
  setup do
31
39
  @properties = @file.audio_properties
@@ -36,54 +44,61 @@ class FlacFileTest < Test::Unit::TestCase
36
44
  end
37
45
 
38
46
  should "contain basic information" do
39
- assert_equal 1, @properties.length
40
- assert_equal 212, @properties.bitrate
47
+ assert_equal 1, @properties.length_in_seconds
48
+ assert_equal 1017, @properties.length_in_milliseconds
49
+ assert_equal 209, @properties.bitrate
41
50
  assert_equal 44100, @properties.sample_rate
42
51
  assert_equal 1, @properties.channels
43
52
  end
44
53
 
45
54
  should "contain flac-specific information" do
46
- assert_equal 16, @properties.sample_width
55
+ assert_equal 16, @properties.bits_per_sample
47
56
  s = ["78d19b86df2cd488b35957e6bd884968"].pack('H*')
48
57
  assert_equal s, @properties.signature
49
58
  end
50
59
  end
51
60
 
52
- context "picture_list" do
61
+ should "have pictures" do
62
+ refute_empty @file.picture_list
63
+ end
64
+
65
+ context "first picture" do
53
66
  setup do
54
- @pictures = @file.picture_list
67
+ @picture = @file.picture_list.first
68
+ end
69
+
70
+ should "be a TagLib::FLAC::Picture," do
71
+ assert_equal TagLib::FLAC::Picture, @picture.class
55
72
  end
56
73
 
57
- should "have a picture" do
58
- assert_equal 1, @pictures.size
74
+ should "have meta-data" do
75
+ assert_equal TagLib::FLAC::Picture::FrontCover, @picture.type
76
+ assert_equal "image/jpeg", @picture.mime_type
77
+ assert_equal "Globe", @picture.description
78
+ assert_equal 90, @picture.width
79
+ assert_equal 90, @picture.height
80
+ assert_equal 8, @picture.color_depth
81
+ assert_equal 0, @picture.num_colors
59
82
  end
60
83
 
61
- context "first element" do
62
- setup do
63
- @picture = @pictures.first
64
- end
65
-
66
- should "be a TagLib::FLAC::Picture," do
67
- assert_equal TagLib::FLAC::Picture, @picture.class
68
- end
69
-
70
- should "have meta-data" do
71
- assert_equal TagLib::FLAC::Picture::FrontCover, @picture.type
72
- assert_equal "image/jpeg", @picture.mime_type
73
- assert_equal "Globe", @picture.description
74
- assert_equal 90, @picture.width
75
- assert_equal 90, @picture.height
76
- assert_equal 8, @picture.color_depth
77
- assert_equal 0, @picture.num_colors
78
- end
79
-
80
- should "have data" do
81
- picture_data = File.open("test/data/globe_east_90.jpg", 'rb'){ |f| f.read }
82
- assert_equal picture_data, @picture.data
83
- end
84
+ should "have data" do
85
+ picture_data = File.open("test/data/globe_east_90.jpg", 'rb'){ |f| f.read }
86
+ assert_equal picture_data, @picture.data
84
87
  end
85
88
  end
86
89
 
90
+ should "support removing a picture" do
91
+ refute_empty @file.picture_list
92
+ @file.remove_picture(@file.picture_list.first)
93
+ assert_empty @file.picture_list
94
+ end
95
+
96
+ should "support removing all pictures" do
97
+ refute_empty @file.picture_list
98
+ @file.remove_pictures()
99
+ assert_empty @file.picture_list
100
+ end
101
+
87
102
  teardown do
88
103
  @file.close
89
104
  @file = nil