passing tests for new vertical layout based on file size

This commit is contained in:
Scott Davis 2011-07-26 02:03:38 -04:00
parent 7a183754b7
commit b581d2e1a7
6 changed files with 717 additions and 710 deletions

View File

@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
compass (0.12.0.alpha.0.38cf0e5)
compass (0.12.0.alpha.0.7a18375)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)

View File

@ -16,6 +16,7 @@ module Compass
calculate_horizontal_positions
calculate_width
else
@images.sort! {|a,b| File.size(b.file) <=> File.size(a.file)} #put small images first
calculate_width
calulate_vertical_postions
calculate_height

View File

@ -80,7 +80,7 @@ module Compass
end
end
# Returns the sass _options for this sprite
# Returns the sass_options for this sprite
def self.sass_options(name, importer, options)
options.merge!(:filename => name, :syntax => :scss, :importer => importer)
end

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

View File

@ -115,5 +115,11 @@ class SpriteMapTest < Test::Unit::TestCase
FileUtils.rm base.filename
end
it "should generate vertical sprites in decending order" do
sizes = @base.images.map{|image| File.size(image.file) }
assert_equal sizes.min, File.size(@base.images.first.file)
assert_equal sizes.max, File.size(@base.images.last.file)
end
end