Adds resource image test

This commit is contained in:
David Larrabee
2014-11-03 08:25:39 -05:00
parent d99937a258
commit ad6aa7a963
2 changed files with 15 additions and 2 deletions

View File

@@ -27,7 +27,7 @@ module RubyMotionQuery
cached = true if cached.nil?
if cached
UIImage.imageNamed("#{file_base_name}.#{ext}")
UIImage.imageNamed("#{file_base_name}.#{ext}")
else
file_base_name << '@2x' if RMQ.device.retina?
file = NSBundle.mainBundle.pathForResource(file_base_name, ofType: ext)

View File

@@ -63,5 +63,18 @@ describe 'image' do
image.capInsets.should == UIEdgeInsetsMake(1.0, 1.0, 1.0, 1.0)
end
end
# TODO test resource with and without caching
describe "resource" do
it "should return the image when cached" do
image = @rmq.image.resource('logo')
image.is_a?(UIImage).should.be.true
end
it "should return the image when cached is false" do
image = @rmq.image.resource('logo', {cache: false})
image.is_a?(UIImage).should.be.true
end
end
end