8000 Slice in spec for JRuby · libvips/ruby-vips@fed73ec · GitHub
[go: up one dir, main page]

Skip to content

Commit fed73ec

Browse files
committed
Slice in spec for JRuby
1 parent 83139c0 commit fed73ec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spec/image_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ def has_jpeg?
6565
memory.put_array_of_uchar(0, Array.new(16 * 16, 128))
6666

6767
data = FFI::Pointer.new(memory)
68+
# JRuby's FFI implementation looses the size information
69+
data = data.slice(0, 16 * 16) if defined?(JRUBY_VERSION)
6870

6971
x = Vips::Image.new_from_memory data, 16, 16, 1, :uchar
7072

@@ -113,6 +115,9 @@ def has_jpeg?
113115
memory.put_array_of_uchar(0, Array.new(16 * 16, 128))
114116

115117
data = FFI::Pointer.new(memory)
118+
# JRuby's FFI implementation looses the size information
119+
data = data.slice(0, 16 * 16) if defined?(JRUBY_VERSION)
120+
116121
x = Vips::Image.new_from_memory_copy data, 16, 16, 1, :uchar
117122

118123
expect(x.width).to eq(16)

0 commit comments

Comments
 (0)
0