sprite test_unit

This commit is contained in:
Scott Davis 2011-04-28 02:50:14 -04:00
parent 1c8804386a
commit 5a2967fe51
4 changed files with 11 additions and 6 deletions

View File

@ -7,7 +7,7 @@ GIT
PATH
remote: .
specs:
compass (0.11.1.f4f9d7b)
compass (0.11.1.8e2292b)
chunky_png (~> 1.1)
fssm (>= 0.2.7)
sass (~> 3.1)

View File

@ -12,7 +12,7 @@ module Compass
sprites = sprite_map.files.map do |sprite|
sprite.gsub(Compass.configuration.images_path+"/", "")
end
new(sprites, sprite_map.path, sprite_map.name, context, kwargs)
new(sprites, sprite_map, context, kwargs)
end
# Loads the sprite engine
@ -24,17 +24,18 @@ module Compass
# We should do so only when the packing algorithm changes
SPRITE_VERSION = "1"
attr_accessor :image_names, :path, :name, :options
attr_accessor :image_names, :path, :name, :options, :map
attr_accessor :images, :width, :height
def initialize(image_names, path, name, context, options)
def initialize(image_names, map, context, options)
require_engine!
@image_names, @path, @name, @options = image_names, path, name, options
@image_names, @path, @name, @options = image_names, map.path, map.name, options
@images = nil
@width = nil
@height = nil
@evaluation_context = context
@map = map
validate!
compute_image_metadata!
end

View File

@ -20,6 +20,10 @@ module Compass
module ClassMethods
def let(method, &block)
define_method method, &block
end
def it(name, &block)
test(name, &block)
end

View File

@ -12,7 +12,7 @@ class SpritesBaseTest < Test::Unit::TestCase
Compass.configure_sass_plugin!
options = Compass.sass_engine_options.extend Compass::SassExtensions::Functions::Sprites::VariableReader
@map = Compass::SpriteMap.new("selectors/*.png", options)
@base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map.path, 'selectors', @map.sass_engine, @map.options)
@base = Compass::SassExtensions::Sprites::Base.new(@map.sprite_names.map{|n| "selectors/#{n}.png"}, @map, @map.sass_engine, @map.options)
end
def teardown