free-image 0.7.1 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b80f09322715f18c6adf980159eb13c0db8deb0b
4
- data.tar.gz: 50509e7fc8fd8f17e0e0a87ec8ab7523ebd35433
3
+ metadata.gz: b3b86080d9ecef3964e1f148d0b5517d9cfc9e36
4
+ data.tar.gz: 86ba6e1536e31528ae94bb0430fef9071b38c692
5
5
  SHA512:
6
- metadata.gz: 9a34fde0edddd9ac02e995f9d8d9ea5b15811085fa5a1b99d327642edd00062c1b4e008216e604e4de1c8f02a9e460ea818d0a643f029c41e12b70d698575a7d
7
- data.tar.gz: ec442eeee1c6c90935b545a14ea04452537daffb7851e072aa44baf451ccbf72df0fe8948080183000aea6528d78ac96ce21bec881adf07238b16bce0412c7eb
6
+ metadata.gz: c498cd00028fdc2611a9a6e5131a66345c7105e8883822fbbda0e16efef0707df4f1d5d95623d0da2237aeeeba4f9f541622bf197bfb46f9f85663f44e45c03d
7
+ data.tar.gz: a74bfae40be0c7ed74d39274a6770c6529410230ffba9428a7a0db5d21140c78ab3c41e6e7245e7a639ca58494852d693a57a3eaa97382097056b1456b82c23e
data/HISTORY CHANGED
@@ -1,5 +1,13 @@
1
1
  = Release History
2
2
 
3
+ == 0.8.0 / 2016-5-31
4
+ * Return correct bytes from memory pointer (Charlie Savage)
5
+ * Return correct image type from memory pointer (Charlie Savage)
6
+ * Wrap new functions - FreeImage_GetMemorySize, FreeImage_WriteMemory (Charlie Savage)
7
+ * Port to minitest from unit test (Charlie Savage)
8
+ * Support msys2 naming scheme on Windows (Charlie Savage)
9
+ * Add support for reading images from StringIO and Tempfiles (Tom Wardrop)
10
+
3
11
  == 0.7.1 / 2015-12-02
4
12
  * Don't crash if FreeImage_HasRGBMasks does not exist
5
13
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'free-image'
5
- spec.version = '0.7.1'
5
+ spec.version = '0.8.0'
6
6
  spec.summary = 'Ruby Bindings for the Free Image Library'
7
7
  spec.description = <<-EOS
8
8
  FreeImage is an Open Source library project for developers who would like to support
@@ -37,7 +37,7 @@ module FreeImage
37
37
 
38
38
  def self.free_image_library_paths
39
39
  @free_image_library_paths ||= begin
40
- libs = %w{libfreeimage libfreeimage.3 FreeImage}
40
+ libs = %w{libfreeimage libfreeimage.3 libfreeimage-3 FreeImage}
41
41
 
42
42
  libs.map do |lib|
43
43
  find_lib(lib)
@@ -166,7 +166,7 @@ module FreeImage
166
166
  case source
167
167
  when AbstractSource
168
168
  source
169
- when ::IO
169
+ when ::IO, (StringIO if defined? StringIO), (Tempfile if defined? Tempfile)
170
170
  IO.new(source)
171
171
  when String
172
172
  File.new(source)
@@ -175,4 +175,4 @@ module FreeImage
175
175
  end
176
176
  end
177
177
  end
178
- end
178
+ end
@@ -23,6 +23,9 @@ module FreeImage
23
23
  #DLL_API unsigned DLL_CALLCONV FreeImage_GetDIBSize(FIBITMAP *dib);
24
24
  attach_function('FreeImage_GetDIBSize', [:pointer], :ulong)
25
25
 
26
+ #FreeImage_GetMemorySize DLL_API unsigned DLL_CALLCONV FreeImage_GetMemorySize(FIBITMAP *dib);
27
+ attach_function('FreeImage_GetMemorySize', [:pointer], :ulong)
28
+
26
29
  #DLL_API unsigned DLL_CALLCONV FreeImage_GetDotsPerMeterX(FIBITMAP *dib);
27
30
  attach_function('FreeImage_GetDotsPerMeterX', [:pointer], :ulong)
28
31
 
@@ -140,6 +143,12 @@ module FreeImage
140
143
  result
141
144
  end
142
145
 
146
+ def memory_size
147
+ result = FreeImage.FreeImage_GetMemorySize(self)
148
+ FreeImage.check_last_error
149
+ result
150
+ end
151
+
143
152
  # Returns the horizontal resolution, in pixels-per-meter,
144
153
  # of the target device for the bitmap.
145
154
  def dots_per_meter_x
@@ -19,6 +19,9 @@ module FreeImage
19
19
  #DLL_API unsigned DLL_CALLCONV FreeImage_ReadMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
20
20
  attach_function('FreeImage_ReadMemory', [:pointer, :ulong, :ulong, :memory], :ulong)
21
21
 
22
+ #DLL_API unsigned DLL_CALLCONV FreeImage_WriteMemory(void *buffer, unsigned size, unsigned count, FIMEMORY *stream);
23
+ attach_function('FreeImage_WriteMemory', [:pointer, :ulong, :ulong, :memory], :ulong)
24
+
22
25
  # DLL_API long DLL_CALLCONV FreeImage_TellMemory(FIMEMORY *stream);
23
26
  attach_function('FreeImage_TellMemory', [:memory], :long)
24
27
 
@@ -57,36 +60,43 @@ module FreeImage
57
60
  super(ptr)
58
61
  end
59
62
 
63
+ def position
64
+ result = FreeImage.FreeImage_TellMemory(self)
65
+ FreeImage.check_last_error
66
+ result
67
+ end
68
+
69
+ def seek(amount, whence=IO::SEEK_SET)
70
+ FreeImage.FreeImage_SeekMemory(self, amount, whence)
71
+ FreeImage.check_last_error
72
+ end
73
+
60
74
  # Returns the size of the memory stream.
61
75
  def count
62
- # Store current position
63
- pos = FreeImage.FreeImage_TellMemory(self)
64
- FreeImage.check_last_error
76
+ last_position = self.position
65
77
 
66
78
  # Go to end of stream to get length
67
- FreeImage.FreeImage_SeekMemory(self, 0, ::IO::SEEK_END)
68
- FreeImage.check_last_error
79
+ self.seek(0, ::IO::SEEK_END)
69
80
  count = FreeImage.FreeImage_TellMemory(self)
70
81
 
71
82
  # Restore position
72
- FreeImage.FreeImage_SeekMemory(self, pos, ::IO::SEEK_SET)
73
- FreeImage.check_last_error
83
+ self.seek(last_position, ::IO::SEEK_SET)
74
84
 
75
85
  count
76
86
  end
77
87
 
78
88
  # Returns the bytes of the memory stream.
79
89
  def bytes
80
- size = FFI::Type::CHAR.size
81
-
82
90
  # Reset memory to start
83
- FreeImage.FreeImage_SeekMemory(self, 0, ::IO::SEEK_SET)
84
- FreeImage.check_last_error
91
+ self.seek(0, ::IO::SEEK_SET)
85
92
 
86
- buffer = FFI::MemoryPointer.new(FFI::Type::CHAR, size * count)
93
+ # Create a buffer to store the memory
94
+ buffer = FFI::MemoryPointer.new(FFI::Type::CHAR.size, self.count)
87
95
  FreeImage.check_last_error
88
- size = FreeImage.FreeImage_ReadMemory(buffer, size, count, self)
89
- buffer.null? ? nil : buffer.read_string
96
+ written = FreeImage.FreeImage_ReadMemory(buffer, FFI::Type::CHAR.size, self.count, self)
97
+
98
+ # Return a string
99
+ buffer.get_bytes(0, FFI::Type::CHAR.size * count)
90
100
  end
91
101
  end
92
102
 
@@ -148,7 +158,10 @@ module FreeImage
148
158
  # Returns the image format for a memory stream. If the image format cannot be determined
149
159
  # the :unknown will be returned.
150
160
  def format
151
- result = FreeImage.FreeImage_GetFileTypeFromMemory(@memory, 0)
161
+ # Reset memory to start
162
+ self.memory.seek(0, ::IO::SEEK_SET)
163
+
164
+ result = FreeImage.FreeImage_GetFileTypeFromMemory(self.memory, 0)
152
165
  FreeImage.check_last_error
153
166
  result
154
167
  end
@@ -173,7 +186,7 @@ module FreeImage
173
186
  # dst.bytes
174
187
  #
175
188
  def save(bitmap, format, flags = 0)
176
- result = FreeImage.FreeImage_SaveToMemory(format, bitmap, @memory, flags)
189
+ result = FreeImage.FreeImage_SaveToMemory(format, bitmap, self.memory, flags)
177
190
  FreeImage.check_last_error
178
191
  result
179
192
  end
@@ -181,7 +194,7 @@ module FreeImage
181
194
  private
182
195
 
183
196
  def load(format, flags)
184
- ptr = FreeImage.FreeImage_LoadFromMemory(format, @memory, flags)
197
+ ptr = FreeImage.FreeImage_LoadFromMemory(format, self.memory, flags)
185
198
  FreeImage.check_last_error
186
199
  ptr
187
200
  end
@@ -1,6 +1,5 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
4
  def set_to_red(color)
6
5
  color[:red] = 255
@@ -0,0 +1,13 @@
1
+ # encoding: UTF-8
2
+ require File.join(File.dirname(__FILE__),'test_helper')
3
+
4
+ memory = FreeImage::Memory.new
5
+ image = FreeImage::Bitmap.open('C:/users/cfis/Pictures/Poses/prinzzess_sahara_14.jpg')
6
+
7
+ image = FreeImage::Bitmap.open('C:/users/cfis/Pictures/Poses/PixMix683-img023.jpg')
8
+
9
+ memory.save(image, :jpeg)
10
+
11
+ puts memory.memory.count
12
+ puts memory.format
13
+
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class BitmapTest < Test::Unit::TestCase
4
+ class BitmapTest < Minitest::Test
6
5
  def test_bits
7
6
  bytes = sample_image.bits
8
7
  assert_equal(6466, bytes.size)
@@ -25,7 +24,7 @@ class BitmapTest < Test::Unit::TestCase
25
24
  end
26
25
 
27
26
  def test_open_yield_error
28
- assert_raise(ArgumentError) do
27
+ assert_raises(ArgumentError) do
29
28
  FreeImage::Bitmap.open(image_path('lena.png')) do |bitmap|
30
29
  raise(ArgumentError, "Let's mess things up")
31
30
  end
@@ -34,7 +33,7 @@ class BitmapTest < Test::Unit::TestCase
34
33
 
35
34
  def test_new_from_nil
36
35
  ptr = FFI::Pointer::NULL
37
- error = assert_raise(FreeImage::Error) do
36
+ error = assert_raises(FreeImage::Error) do
38
37
  FreeImage::Bitmap.new(ptr)
39
38
  end
40
39
  assert_equal("Cannot create a bitmap from a null pointer", error.message)
@@ -48,7 +47,7 @@ class BitmapTest < Test::Unit::TestCase
48
47
 
49
48
  def test_clone_block
50
49
  lena_image.clone do |image|
51
- assert_not_nil(image)
50
+ refute_nil(image)
52
51
  end
53
52
  end
54
53
 
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class ConverstionsTest < Test::Unit::TestCase
4
+ class ConverstionsTest < Minitest::Test
6
5
  def test_convert_to_4bits
7
6
  bitmap = sample_image.convert_to_4bits
8
7
  assert_kind_of(FreeImage::Bitmap, bitmap)
@@ -70,14 +69,14 @@ class ConverstionsTest < Test::Unit::TestCase
70
69
  end
71
70
 
72
71
  def test_threshold_low
73
- error = assert_raise(RangeError) do
72
+ error = assert_raises(RangeError) do
74
73
  sample_image.threshold(-1)
75
74
  end
76
75
  assert_equal("Value is out of range 0..255. Value: -1", error.message)
77
76
  end
78
77
 
79
78
  def test_threshold_hight
80
- error = assert_raise(RangeError) do
79
+ error = assert_raises(RangeError) do
81
80
  sample_image.threshold(5555)
82
81
  end
83
82
  assert_equal("Value is out of range 0..255. Value: 5555", error.message)
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class FIFileTest < Test::Unit::TestCase
4
+ class FIFileTest < Minitest::Test
6
5
  def file(image = 'sample.png')
7
6
  path = image_path(image)
8
7
  FreeImage::File.new(path)
@@ -22,14 +21,14 @@ class FIFileTest < Test::Unit::TestCase
22
21
  end
23
22
 
24
23
  def test_load_format
25
- error = assert_raise(FreeImage::Error) do
24
+ error = assert_raises(FreeImage::Error) do
26
25
  file('not_an_image.txt').open
27
26
  end
28
27
  assert_equal('Cannot load :unknown image format', error.to_s)
29
28
  end
30
29
 
31
30
  def test_load_wrong_format
32
- error = assert_raise(FreeImage::Error) do
31
+ error = assert_raises(FreeImage::Error) do
33
32
  file.open(:jpeg)
34
33
  end
35
34
  assert_equal("Not a JPEG file: starts with 0x89 0x50", error.to_s)
@@ -51,7 +50,7 @@ class FIFileTest < Test::Unit::TestCase
51
50
  def test_corrupt
52
51
  path = image_path('corrupt.jpg')
53
52
  file = FreeImage::File.new(path)
54
- error = assert_raise(FreeImage::Error) do
53
+ error = assert_raises(FreeImage::Error) do
55
54
  file.open
56
55
  end
57
56
  assert_equal("Not a JPEG file: starts with 0xaa 0xc0", error.message)
@@ -60,7 +59,7 @@ class FIFileTest < Test::Unit::TestCase
60
59
  def test_corrupt_wrong_format
61
60
  path = image_path('corrupt.jpg')
62
61
  file = FreeImage::File.new(path)
63
- error = assert_raise(FreeImage::Error) do
62
+ error = assert_raises(FreeImage::Error) do
64
63
  # Be sneaky - say png!
65
64
  file.open(:png)
66
65
  end
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class FreeImageTest < Test::Unit::TestCase
4
+ class FreeImageTest < Minitest::Test
6
5
  def test_copyright
7
6
  assert_equal("This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details",
8
7
  FreeImage.copyright)
@@ -10,6 +10,8 @@ $LOAD_PATH << LIB_DIR
10
10
  require 'rubygems'
11
11
  require 'free-image'
12
12
  require 'tempfile'
13
+ require 'minitest/autorun'
14
+
13
15
 
14
16
  def image_path(image)
15
17
  File.join(ROOT_DIR, 'test', 'images', image)
@@ -1,9 +1,7 @@
1
1
  # encoding: UTF-8
2
-
3
2
  require File.join(File.dirname(__FILE__),'test_helper')
4
- require 'test/unit'
5
3
 
6
- class InformationTest < Test::Unit::TestCase
4
+ class InformationTest < Minitest::Test
7
5
  def test_background_color_16bit
8
6
  background_color = bit16_bmp.background_color
9
7
  assert_kind_of(FreeImage::RGBQuad, background_color)
@@ -47,6 +45,10 @@ class InformationTest < Test::Unit::TestCase
47
45
  assert_equal(52664, sample_image.dib_size)
48
46
  end
49
47
 
48
+ def test_memory_size
49
+ assert_equal(54737, sample_image.memory_size)
50
+ end
51
+
50
52
  def test_dots_per_meter_x
51
53
  assert_equal(2835, sample_image.dots_per_meter_x)
52
54
  end
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class IoTest < Test::Unit::TestCase
4
+ class IoTest < Minitest::Test
6
5
  def io(image = 'sample.png')
7
6
  path = image_path(image)
8
7
  file = File.open(path)
@@ -23,7 +22,7 @@ class IoTest < Test::Unit::TestCase
23
22
  end
24
23
 
25
24
  def test_load_unknown
26
- error = assert_raise(FreeImage::Error) do
25
+ error = assert_raises(FreeImage::Error) do
27
26
  io('not_an_image.txt').open
28
27
  end
29
28
  assert_equal("Cannot load :unknown image format",
@@ -31,7 +30,7 @@ class IoTest < Test::Unit::TestCase
31
30
  end
32
31
 
33
32
  def test_load_wrong_format
34
- error = assert_raise(FreeImage::Error) do
33
+ error = assert_raises(FreeImage::Error) do
35
34
  io.open(:jpeg)
36
35
  end
37
36
  assert_equal("Not a JPEG file: starts with 0x89 0x50", error.to_s)
@@ -55,7 +54,7 @@ class IoTest < Test::Unit::TestCase
55
54
  file = File.open(path)
56
55
  io = FreeImage::IO.new(file)
57
56
 
58
- error = assert_raise(FreeImage::Error) do
57
+ error = assert_raises(FreeImage::Error) do
59
58
  io.open
60
59
  end
61
60
  assert_equal("Cannot load :unknown image format", error.message)
@@ -66,7 +65,7 @@ class IoTest < Test::Unit::TestCase
66
65
  file = File.open(path)
67
66
  io = FreeImage::IO.new(file)
68
67
 
69
- error = assert_raise(FreeImage::Error) do
68
+ error = assert_raises(FreeImage::Error) do
70
69
  io.open(:png)
71
70
  end
72
71
  assert_equal("Could not load the image", error.message)
@@ -1,15 +1,14 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class MemoryTest < Test::Unit::TestCase
4
+ class MemoryTest < Minitest::Test
6
5
  def memory(image = 'sample.png')
7
6
  data = image_data(image)
8
7
  FreeImage::Memory.new(data)
9
8
  end
10
9
 
11
10
  def test_wrap
12
- assert_not_nil(memory)
11
+ refute_nil(memory)
13
12
  end
14
13
 
15
14
  def test_format
@@ -26,7 +25,7 @@ class MemoryTest < Test::Unit::TestCase
26
25
  end
27
26
 
28
27
  def test_load_unknown
29
- error = assert_raise(FreeImage::Error) do
28
+ error = assert_raises(FreeImage::Error) do
30
29
  memory('not_an_image.txt').open
31
30
  end
32
31
  assert_equal("Cannot load :unknown image format",
@@ -34,7 +33,7 @@ class MemoryTest < Test::Unit::TestCase
34
33
  end
35
34
 
36
35
  def test_load_wrong_format
37
- error = assert_raise(FreeImage::Error) do
36
+ error = assert_raises(FreeImage::Error) do
38
37
  memory.open(:jpeg, 0)
39
38
  end
40
39
  assert_equal("Not a JPEG file: starts with 0x89 0x50", error.to_s)
@@ -50,23 +49,26 @@ class MemoryTest < Test::Unit::TestCase
50
49
  end
51
50
 
52
51
  def test_save
53
- dst = FreeImage::Memory.new
52
+ dest = FreeImage::Memory.new
54
53
 
55
54
  bitmap = memory.open
56
- result = bitmap.save(dst, :png)
55
+ result = bitmap.save(dest, :png)
56
+ assert(result)
57
+ assert_equal(37115, dest.memory.count)
58
+ refute_nil(dest.memory.bytes)
59
+ assert_equal(37115, dest.memory.bytes.length)
57
60
 
58
61
  assert(result)
59
- assert_not_nil(dst.memory.bytes)
60
62
  if defined?(Encoding)
61
- assert_equal(dst.memory.bytes.encoding, Encoding::BINARY)
63
+ assert_equal(dest.memory.bytes.encoding, Encoding::BINARY)
62
64
  end
63
65
  end
64
66
 
65
67
  def test_corrupt
66
68
  data = image_data('corrupt.jpg')
67
69
  memory = FreeImage::Memory.new(data)
68
-
69
- error = assert_raise(FreeImage::Error) do
70
+
71
+ error = assert_raises(FreeImage::Error) do
70
72
  memory.open
71
73
  end
72
74
  assert_equal("Cannot load :unknown image format", error.message)
@@ -76,7 +78,7 @@ class MemoryTest < Test::Unit::TestCase
76
78
  data = image_data('corrupt.jpg')
77
79
  memory = FreeImage::Memory.new(data)
78
80
 
79
- error = assert_raise(FreeImage::Error) do
81
+ error = assert_raises(FreeImage::Error) do
80
82
  memory.open(:png)
81
83
  end
82
84
  assert_equal("Could not load the image", error.message)
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class ModifyTest < Test::Unit::TestCase
4
+ class ModifyTest < Minitest::Test
6
5
  def test_copy
7
6
  bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
8
7
  bitmap2 = bitmap1.copy(0, 0, 50, 60)
@@ -1,11 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class PaletteTest < Test::Unit::TestCase
4
+ class PaletteTest < Minitest::Test
6
5
  def test_palette
7
6
  palette = sample_image.palette
8
- assert_not_nil(palette)
7
+ refute_nil(palette)
9
8
  assert_kind_of(FreeImage::Palette, palette)
10
9
  end
11
10
 
@@ -27,7 +26,7 @@ class PaletteTest < Test::Unit::TestCase
27
26
  def test_index_too_small
28
27
  palette = sample_image.palette
29
28
 
30
- error = assert_raise(RangeError) do
29
+ error = assert_raises(RangeError) do
31
30
  palette[-1]
32
31
  end
33
32
  assert_equal("Value is out of range 0..256. Value: -1", error.message)
@@ -36,7 +35,7 @@ class PaletteTest < Test::Unit::TestCase
36
35
  def test_index_too_large
37
36
  palette = sample_image.palette
38
37
 
39
- error = assert_raise(RangeError) do
38
+ error = assert_raises(RangeError) do
40
39
  palette[300]
41
40
  end
42
41
  assert_equal("Value is out of range 0..256. Value: 300", error.message)
@@ -1,11 +1,10 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class PixelTest < Test::Unit::TestCase
4
+ class PixelTest < Minitest::Test
6
5
  def test_bits
7
6
  bytes = sample_image.bits
8
- assert_not_nil(bytes)
7
+ refute_nil(bytes)
9
8
  end
10
9
 
11
10
  def test_pixel_index
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class RGBQuadTest < Test::Unit::TestCase
4
+ class RGBQuadTest < Minitest::Test
6
5
  def test_create
7
6
  color = FreeImage::RGBQuad.create(1,2,3,4)
8
7
  assert_equal(color[:red], 1)
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class ScanlineTest < Test::Unit::TestCase
4
+ class ScanlineTest < Minitest::Test
6
5
  def scanline(index = 0)
7
6
  image = lena_image
8
7
  image.scanline(index)
@@ -39,24 +38,24 @@ class ScanlineTest < Test::Unit::TestCase
39
38
  end
40
39
 
41
40
  def test_invalid_y
42
- error = assert_raise(RangeError) do
41
+ error = assert_raises(RangeError) do
43
42
  lena_image.scanline(-1)
44
43
  end
45
44
  assert_equal("Index must be between 0 and 511", error.to_s)
46
45
 
47
- error = assert_raise(RangeError) do
46
+ error = assert_raises(RangeError) do
48
47
  lena_image.scanline(1000)
49
48
  end
50
49
  assert_equal("Index must be between 0 and 511", error.to_s)
51
50
  end
52
51
 
53
52
  def test_invalid_x
54
- error = assert_raise(RangeError) do
53
+ error = assert_raises(RangeError) do
55
54
  scanline[-1]
56
55
  end
57
56
  assert_equal("Index must be between 0 and 511", error.to_s)
58
57
 
59
- error = assert_raise(RangeError) do
58
+ error = assert_raises(RangeError) do
60
59
  scanline[1000]
61
60
  end
62
61
  assert_equal("Index must be between 0 and 511", error.to_s)
@@ -1,14 +1,14 @@
1
1
  # encoding: UTF-8
2
2
 
3
- require './test/test_bitmap'
4
- require './test/test_conversions'
5
- require './test/test_file'
6
- require './test/test_free_image'
7
- require './test/test_information'
8
- require './test/test_io'
9
- require './test/test_memory'
10
- require './test/test_modify'
11
- require './test/test_palette'
12
- require './test/test_pixels'
13
- require './test/test_rgb_quad'
14
- require './test/test_transforms'
3
+ require_relative 'test_bitmap'
4
+ require_relative 'test_conversions'
5
+ require_relative 'test_file'
6
+ require_relative 'test_free_image'
7
+ require_relative 'test_information'
8
+ require_relative 'test_io'
9
+ require_relative 'test_memory'
10
+ require_relative 'test_modify'
11
+ require_relative 'test_palette'
12
+ require_relative 'test_pixels'
13
+ require_relative 'test_rgb_quad'
14
+ require_relative 'test_transforms'
@@ -1,8 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  require File.join(File.dirname(__FILE__),'test_helper')
3
- require 'test/unit'
4
3
 
5
- class TrasformsTest < Test::Unit::TestCase
4
+ class TrasformsTest < Minitest::Test
6
5
  def test_rotate
7
6
  bitmap1 = FreeImage::Bitmap.open(image_path('sample.png'))
8
7
  bitmap2 = bitmap1.rotate(45)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: free-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charlie Savage
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -141,6 +141,7 @@ files:
141
141
  - test/images/test16.bmp
142
142
  - test/images/test16bf555.bmp
143
143
  - test/images/test16bf565.bmp
144
+ - test/test.rb
144
145
  - test/test_bitmap.rb
145
146
  - test/test_conversions.rb
146
147
  - test/test_file.rb
@@ -175,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
176
  version: '0'
176
177
  requirements: []
177
178
  rubyforge_project:
178
- rubygems_version: 2.4.5.1
179
+ rubygems_version: 2.5.1
179
180
  signing_key:
180
181
  specification_version: 4
181
182
  summary: Ruby Bindings for the Free Image Library