test/test_io.rb in free-image-0.6.1 vs test/test_io.rb in free-image-0.6.2

- old
+ new

@@ -48,6 +48,28 @@ assert(File.exists?(tmp_file)) ensure tmp_file.close tmp_file.unlink end + + def test_corrupt + path = image_path('corrupt.jpg') + file = File.open(path) + io = FreeImage::IO.new(file) + + error = assert_raise(FreeImage::Error) do + io.open + end + assert_equal("Cannot load :unknown image format", error.message) + end + + def test_corrupt_wrong_format + path = image_path('corrupt.jpg') + file = File.open(path) + io = FreeImage::IO.new(file) + + error = assert_raise(FreeImage::Error) do + io.open(:png) + end + assert_equal("Could not load the image", error.message) + end end \ No newline at end of file