mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-10-09 00:02:49 -04:00
Should work for readed ios
This commit is contained in:
parent
929b4b76c5
commit
11ca295071
@ -332,6 +332,7 @@ class FastImage
|
|||||||
end
|
end
|
||||||
|
|
||||||
def fetch_using_read(readable)
|
def fetch_using_read(readable)
|
||||||
|
readable.rewind if readable.respond_to?(:rewind)
|
||||||
# Pathnames respond to read, but always return the first
|
# Pathnames respond to read, but always return the first
|
||||||
# chunk of the file unlike an IO (even though the
|
# chunk of the file unlike an IO (even though the
|
||||||
# docuementation for it refers to IO). Need to supply
|
# docuementation for it refers to IO). Need to supply
|
||||||
|
18
test/test.rb
18
test/test.rb
@ -178,6 +178,24 @@ class FastImageTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_should_report_type_correctly_for_ios_that_have_been_read
|
||||||
|
GoodFixtures.each do |fn, info|
|
||||||
|
File.open(File.join(FixturePath, fn), "r") do |io|
|
||||||
|
io.read
|
||||||
|
assert_equal info[0], FastImage.type(io)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_should_report_size_correctly_for_ios_that_have_been_read
|
||||||
|
GoodFixtures.each do |fn, info|
|
||||||
|
File.open(File.join(FixturePath, fn), "r") do |io|
|
||||||
|
io.read
|
||||||
|
assert_equal info[1], FastImage.size(io)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_should_report_size_correctly_on_io_object_twice
|
def test_should_report_size_correctly_on_io_object_twice
|
||||||
GoodFixtures.each do |fn, info|
|
GoodFixtures.each do |fn, info|
|
||||||
File.open(File.join(FixturePath, fn), "r") do |io|
|
File.open(File.join(FixturePath, fn), "r") do |io|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user