diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/image_spec.rb | 6 | ||||
| -rw-r--r-- | test/music_spec.rb | 7 | ||||
| -rw-r--r-- | test/sound_spec.rb | 9 |
3 files changed, 21 insertions, 1 deletions
diff --git a/test/image_spec.rb b/test/image_spec.rb index 3abfd04..2654de5 100644 --- a/test/image_spec.rb +++ b/test/image_spec.rb @@ -3,6 +3,12 @@ require 'ruby2d' RSpec.describe Ruby2D::Image do describe "#new" do + it "creates images in various formats" do + Image.new('test/media/image.bmp') + Image.new('test/media/image.jpg') + Image.new('test/media/image.png') + end + it "raises exception if image file doesn't exist" do expect { Image.new('bad_image.png') }.to raise_error(Ruby2D::Error) end diff --git a/test/music_spec.rb b/test/music_spec.rb index 37fdc65..f7e9a95 100644 --- a/test/music_spec.rb +++ b/test/music_spec.rb @@ -14,6 +14,13 @@ RSpec.describe Ruby2D::Music do end unless ENV['CI'] + it "creates music in various formats" do + Music.new('test/media/music.wav') + Music.new('test/media/music.mp3') + Music.new('test/media/music.ogg') + Music.new('test/media/music.flac') + end + it "creates music with options" do mus = Music.new('test/media/music.mp3', loop: true) expect(mus.path).to eq('test/media/music.mp3') diff --git a/test/sound_spec.rb b/test/sound_spec.rb index 006e1f7..0aa44b9 100644 --- a/test/sound_spec.rb +++ b/test/sound_spec.rb @@ -8,7 +8,14 @@ RSpec.describe Ruby2D::Sound do end unless ENV['CI'] # audio cannot be opened on CI; see `music_spec.rb` - it "creates sound" do + it "creates sound in various formats" do + Sound.new('test/media/music.wav') + Sound.new('test/media/music.mp3') + Sound.new('test/media/music.ogg') + Sound.new('test/media/music.flac') + end + + it "creates sound and sets the media path" do snd = Sound.new('test/media/sound.wav') expect(snd.path).to eq('test/media/sound.wav') end |
