mirror of
https://github.com/zhigang1992/rmq.git
synced 2026-05-29 16:36:31 +08:00
Adds resource image test
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user