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 PATH
remote: . remote: .
specs: specs:
compass (0.12.0.alpha.0.38cf0e5) compass (0.12.0.alpha.0.7a18375)
chunky_png (~> 1.2) chunky_png (~> 1.2)
fssm (>= 0.2.7) fssm (>= 0.2.7)
sass (~> 3.1) sass (~> 3.1)

View File

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

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 FileUtils.rm base.filename
end 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 end