Browse Source

Fix for latest dep changes

dev
Andy Meneely 9 years ago
parent
commit
d94a3e676b
  1. 2
      lib/squib/graphics/image.rb
  2. 22
      spec/args/paragraph_spec.rb

2
lib/squib/graphics/image.rb

@ -67,7 +67,7 @@ module Squib
Squib.logger.warn 'Both an SVG file and SVG data were specified' unless file.to_s.empty? || svg_args.data.to_s.empty? Squib.logger.warn 'Both an SVG file and SVG data were specified' unless file.to_s.empty? || svg_args.data.to_s.empty?
return if (file.nil? or file.eql? '') and svg_args.data.nil? # nothing specified TODO Move this out to arg validator return if (file.nil? or file.eql? '') and svg_args.data.nil? # nothing specified TODO Move this out to arg validator
svg_args.data = File.read(file) if svg_args.data.to_s.empty? svg_args.data = File.read(file) if svg_args.data.to_s.empty?
svg = RSVG::Handle.new_from_data(svg_args.data) svg = Rsvg::Handle.new_from_data(svg_args.data)
box.width = svg.width if box.width == :native box.width = svg.width if box.width == :native
box.height = svg.height if box.height == :native box.height = svg.height if box.height == :native
box.width = svg.width.to_f * box.height.to_f / svg.height.to_f if box.width == :scale box.width = svg.width.to_f * box.height.to_f / svg.height.to_f if box.width == :scale

22
spec/args/paragraph_spec.rb

@ -33,17 +33,17 @@ describe Squib::Args::Paragraph do
context 'align validator' do context 'align validator' do
it 'converts to pango left' do it 'converts to pango left' do
para.load!({ align: :left }) para.load!({ align: :left })
expect(para.align).to eq [Pango::ALIGN_LEFT] expect(para.align).to eq [Pango::Alignment::LEFT]
end end
it 'converts to pango right' do it 'converts to pango right' do
para.load!({ align: :RIGHT }) para.load!({ align: :RIGHT })
expect(para.align).to eq [Pango::ALIGN_RIGHT] expect(para.align).to eq [Pango::Alignment::RIGHT]
end end
it 'converts to pango center' do it 'converts to pango center' do
para.load!({ align: 'center' }) para.load!({ align: 'center' })
expect(para.align).to eq [Pango::ALIGN_CENTER] expect(para.align).to eq [Pango::Alignment::CENTER]
end end
it 'raises an exception on anything else' do it 'raises an exception on anything else' do
@ -54,22 +54,22 @@ describe Squib::Args::Paragraph do
context 'wrap validator' do context 'wrap validator' do
it 'converts to pango wrap word' do it 'converts to pango wrap word' do
para.load!({ wrap: 'word' }) para.load!({ wrap: 'word' })
expect(para.wrap).to eq [Pango::WRAP_WORD] expect(para.wrap).to eq [Pango::WrapMode::WORD]
end end
it 'converts to pango wrap char' do it 'converts to pango wrap char' do
para.load!({ wrap: 'WORD_ChAr' }) para.load!({ wrap: 'WORD_ChAr' })
expect(para.wrap).to eq [Pango::WRAP_WORD_CHAR] expect(para.wrap).to eq [Pango::WrapMode::WORD_CHAR]
end end
it 'converts to pango wrap char on true' do it 'converts to pango wrap char on true' do
para.load!({ wrap: true }) para.load!({ wrap: true })
expect(para.wrap).to eq [Pango::WRAP_WORD_CHAR] expect(para.wrap).to eq [Pango::WrapMode::WORD_CHAR]
end end
it 'converts to pango wrap char with false' do it 'converts to pango wrap char with false' do
para.load!({ wrap: false }) para.load!({ wrap: false })
expect(para.wrap).to eq [Pango::WRAP_CHAR] expect(para.wrap).to eq [Pango::WrapMode::CHAR]
end end
it 'raises an exception on anything else' do it 'raises an exception on anything else' do
@ -80,22 +80,22 @@ describe Squib::Args::Paragraph do
context 'ellipsize validator' do context 'ellipsize validator' do
it 'converts to pango on none and false' do it 'converts to pango on none and false' do
para.load!({ ellipsize: 'none' }) para.load!({ ellipsize: 'none' })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_NONE] expect(para.ellipsize).to eq [Pango::EllipsizeMode::NONE]
end end
it 'converts to pango with start' do it 'converts to pango with start' do
para.load!({ ellipsize: :StArt }) para.load!({ ellipsize: :StArt })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_START] expect(para.ellipsize).to eq [Pango::EllipsizeMode::START]
end end
it 'converts to pango middle' do it 'converts to pango middle' do
para.load!({ ellipsize: 'middle' }) para.load!({ ellipsize: 'middle' })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_MIDDLE] expect(para.ellipsize).to eq [Pango::EllipsizeMode::MIDDLE]
end end
it 'converts to pango end' do it 'converts to pango end' do
para.load!({ ellipsize: 'END' }) para.load!({ ellipsize: 'END' })
expect(para.ellipsize).to eq [Pango::Layout::ELLIPSIZE_END] expect(para.ellipsize).to eq [Pango::EllipsizeMode::END]
end end
it 'raises an exception on anything else' do it 'raises an exception on anything else' do

Loading…
Cancel
Save