-
Notifications
You must be signed in to change notification settings - Fork 60
Fixes CI configuration and make tests passes #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
--markup-provider=redcarpet | ||
--markup=markdown |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,170 +1,163 @@ | ||
require 'spec_helper.rb' | ||
|
||
if Vips::at_least_libvips?(8, 9) | ||
RSpec.describe Vips::Source do | ||
it 'can create a source from a descriptor' do | ||
source = Vips::Source.new_from_descriptor(0) | ||
RSpec.describe Vips::Source, version: [8, 9] do | ||
it 'can create a source from a descriptor' do | ||
source = Vips::Source.new_from_descriptor(0) | ||
|
||
expect(source) | ||
end | ||
expect(source) | ||
end | ||
|
||
it 'can create a source from a filename' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
it 'can create a source from a filename' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
|
||
expect(source) | ||
end | ||
expect(source) | ||
end | ||
|
||
it 'can\'t create a source from a bad filename' do | ||
expect { | ||
Vips::Source.new_from_file simg('banana.jpg') | ||
}.to raise_exception(Vips::Error) | ||
end | ||
it 'can\'t create a source from a bad filename' do | ||
expect { | ||
Vips::Source.new_from_file simg('banana.jpg') | ||
}.to raise_exception(Vips::Error) | ||
end | ||
|
||
it 'can create a source from an area of memory' do | ||
str = File.open(simg('wagon.jpg'), 'rb').read | ||
source = Vips::Source.new_from_memory str | ||
it 'can create a source from an area of memory' do | ||
str = File.open(simg('wagon.jpg'), 'rb').read | ||
source = Vips::Source.new_from_memory str | ||
|
||
expect(source) | ||
end | ||
expect(source) | ||
end | ||
|
||
it 'sources have filenames and nicks' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
it 'sources have filenames and nicks' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
|
||
expect(source.filename).to eq(simg('wagon.jpg')) | ||
expect(source.nick) | ||
end | ||
expect(source.filename).to eq(simg('wagon.jpg')) | ||
expect(source.nick) | ||
end | ||
|
||
it 'can load an image from filename source' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
image = Vips::Image.new_from_source source, '' | ||
it 'can load an image from filename source' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
image = Vips::Image.new_from_source source, '' | ||
|
||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
|
||
end | ||
end | ||
end | ||
|
||
if Vips::at_least_libvips?(8, 9) | ||
RSpec.describe Vips::Target do | ||
it 'can create a target to a filename' do | ||
target = Vips::Target.new_to_file timg('x.jpg') | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can create a target to a descriptor' do | ||
target = Vips::Target.new_to_descriptor 1 | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can create a target to a memory area' do | ||
target = Vips::Target.new_to_memory | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can\'t create a target to a bad filename' do | ||
expect { | ||
Vips::Target.new_to_file '/banana/monkey' | ||
}.to raise_exception(Vips::Error) | ||
end | ||
|
||
it 'can save an image to a filename target' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
image = Vips::Image.new_from_source source, '' | ||
filename = timg('x4.png') | ||
target = Vips::Target.new_to_file filename | ||
image.write_to_target target, '.png' | ||
|
||
image = Vips::Image.new_from_file filename | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
it 'can save an image to a memory target' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
image = Vips::Image.new_from_source source, '' | ||
target = Vips::Target.new_to_memory | ||
image.write_to_target target, '.png' | ||
memory = target.get('blob') | ||
|
||
image = Vips::Image.new_from_buffer memory, '' | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
RSpec.describe Vips::Target, version: [8, 9] do | ||
it 'can create a target to a filename' do | ||
target = Vips::Target.new_to_file timg('x.jpg') | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can create a target to a descriptor' do | ||
target = Vips::Target.new_to_descriptor 1 | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can create a target to a memory area' do | ||
target = Vips::Target.new_to_memory | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can\'t create a target to a bad filename' do | ||
expect { | ||
Vips::Target.new_to_file '/banana/monkey' | ||
}.to raise_exception(Vips::Error) | ||
end | ||
|
||
it 'can save an image to a filename target' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
image = Vips::Image.new_from_source source, '' | ||
filename = timg('x4.png') | ||
target = Vips::Target.new_to_file filename | ||
image.write_to_target target, '.png' | ||
|
||
image = Vips::Image.new_from_file filename | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
it 'can save an image to a memory target' do | ||
source = Vips::Source.new_from_file simg('wagon.jpg') | ||
image = Vips::Image.new_from_source source, '' | ||
target = Vips::Target.new_to_memory | ||
image.write_to_target target, '.png' | ||
memory = target.get('blob') | ||
|
||
image = Vips::Image.new_from_buffer memory, '' | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
end | ||
|
||
if Vips::at_least_libvips?(8, 9) | ||
RSpec.describe Vips::SourceCustom do | ||
it 'can create a custom source' do | ||
source = Vips::SourceCustom.new | ||
|
||
expect(source) | ||
end | ||
|
||
it 'can load a custom source' do | ||
file = File.open simg('wagon.jpg'), "rb" | ||
source = Vips::SourceCustom.new | ||
source.on_read { |length| file.read length } | ||
source.on_seek { |offset, whence| file.seek(offset, whence) } | ||
image = Vips::Image.new_from_source source, "" | ||
|
||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
it 'on_seek is optional' do | ||
file = File.open simg('wagon.jpg'), "rb" | ||
source = Vips::SourceCustom.new | ||
source.on_read { |length| file.read length } | ||
image = Vips::Image.new_from_source source, "" | ||
|
||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
it 'can create a user output stream' do | ||
target = Vips::TargetCustom.new | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can write an image to a user output stream' do | ||
filename = timg('x5.png') | ||
file = File.open filename, "wb" | ||
target = Vips::TargetCustom.new | ||
target.on_write { |chunk| file.write(chunk) } | ||
target.on_finish { file.close } | ||
image = Vips::Image.new_from_file simg('wagon.jpg') | ||
image.write_to_target target, ".png" | ||
|
||
image = Vips::Image.new_from_file filename | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
RSpec.describe Vips::SourceCustom, version: [8, 9] do | ||
it 'can create a custom source' do | ||
source = Vips::SourceCustom.new | ||
|
||
expect(source) | ||
end | ||
|
||
it 'can load a custom source' do | ||
file = File.open simg('wagon.jpg'), "rb" | ||
source = Vips::SourceCustom.new | ||
source.on_read { |length| file.read length } | ||
source.on_seek { |offset, whence| file.seek(offset, whence) } | ||
image = Vips::Image.new_from_source source, "" | ||
|
||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
it 'on_seek is optional' do | ||
file = File.open simg('wagon.jpg'), "rb" | ||
source = Vips::SourceCustom.new | ||
source.on_read { |length| file.read length } | ||
image = Vips::Image.new_from_source source, "" | ||
|
||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
it 'can create a user output stream' do | ||
target = Vips::TargetCustom.new | ||
|
||
expect(target) | ||
end | ||
|
||
it 'can write an image to a user output stream' do | ||
filename = timg('x5.png') | ||
file = File.open filename, "wb" | ||
target = Vips::TargetCustom.new | ||
target.on_write { |chunk| file.write(chunk) } | ||
target.on_finish { file.close } | ||
image = Vips::Image.new_from_file simg('wagon.jpg') | ||
image.write_to_target target, ".png" | ||
|
||
image = Vips::Image.new_from_file filename | ||
expect(image) | ||
expect(image.width).to eq(685) | ||
expect(image.height).to eq(478) | ||
expect(image.bands).to eq(3) | ||
expect(image.avg).to be_within(0.001).of(109.789) | ||
end | ||
|
||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh nice, I didn't know about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just added ;)