Merge pull request #560 from johnbintz/rbx-sort-fix

Rubinius/JRuby sort fix
This commit is contained in:
Chris Eppstein 2011-09-19 12:31:39 -07:00
commit 6b3b71ab37
2 changed files with 8 additions and 2 deletions

View File

@ -10,7 +10,13 @@ module Compass
def_delegators :rows, :[] def_delegators :rows, :[]
def initialize(images) def initialize(images)
@images = images.sort {|a,b| a.height <=> b.height } @images = images.sort do |a,b|
if a.height == b.height
b.width <=> a.width
else
a.height <=> b.height
end
end
@rows = [] @rows = []
end end

View File

@ -113,7 +113,7 @@ class SpriteMapTest < Test::Unit::TestCase
base.generate base.generate
assert_equal 400, base.width assert_equal 400, base.width
assert_equal 60, base.height assert_equal 60, base.height
assert_equal [[0, 0], [20, 120], [20, 20], [20, 0], [20, 160]], base.images.map {|i| [i.top, i.left]} assert_equal [[0, 0], [20, 120], [20, 0], [20, 100], [20, 160]], base.images.map {|i| [i.top, i.left]}
assert File.exists?(base.filename) assert File.exists?(base.filename)
FileUtils.rm base.filename FileUtils.rm base.filename
end end