Sha256: 84b2431269af06a015edd82f8dbca3f983f2549b8d3abfa3eeafaf63b7ec5aad

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 KB

Contents

describe Joybox::UI::MenuImage do
  
  describe "Initialization" do
    it "should initialize with image & selected image" do
      menu_image = MenuImage.new image_file_name: 'sprite.png'

      texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')

      menu_image.should.not == nil
      menu_image.sprite.texture.should == texture
    end

    it "should initialize with image & selected image" do
      menu_image = MenuImage.new image_file_name: 'sprite.png', 
                                 selected_image_file_name: 'sprite_inverted.png'

      texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')
      selected_texture = CCTextureCache.sharedTextureCache.addImage('sprite_inverted.png')

      menu_image.should.not == nil
      menu_image.sprite.texture.should == texture
      menu_image.selected_sprite.texture.should == selected_texture
    end

    it "should initialize with image, selected image & disabled image" do
      menu_image = MenuImage.new image_file_name: 'sprite.png', 
                                 selected_image_file_name: 'sprite_inverted.png',
                                 disabled_image_file_name: 'sprite_inverted.png'

      texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')
      selected_texture = CCTextureCache.sharedTextureCache.addImage('sprite_inverted.png')
      disabled_texture = CCTextureCache.sharedTextureCache.addImage('sprite_inverted.png')

      menu_image.should.not == nil
      menu_image.sprite.texture.should == texture
      menu_image.selected_sprite.texture.should == selected_texture
      menu_image.disabled_sprite.texture.should == disabled_texture
    end
  end

  it "should notify touch" do
    menu_image = MenuImage.new image_file_name: 'sprite.png' do |menu_item|
      texture = CCTextureCache.sharedTextureCache.addImage('sprite.png')

      menu_item.should.not == nil
      menu_image.sprite.texture.should == texture
    end

    menu_image.activate
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
joybox-1.1.1 spec/motion/joybox/ui/menu_image_spec.rb
joybox-1.1.0 spec/motion/joybox/ui/menu_image_spec.rb