Sha256: 5b4cc4f9325a71d9b1030e37a72f4fdd9bdeaae0a05776558df13874b41c9458

Contents?: true

Size: 995 Bytes

Versions: 13

Compression:

Stored size: 995 Bytes

Contents

require 'helper'

describe FontStyle do
  inject_mocks :resource_manager
  let(:font) { mock }
  
  before do
    @resource_manager.expects(:load_font).with("FooFace", 24).returns font
    subject.configure "FooFace", 24, :aquamarine, 1, 1
  end
  
  it 'constructs a font from style specifications' do
    subject.name.should == "FooFace"
    subject.size.should == 24
    subject.color.should == :aquamarine
    subject.x_scale.should == 1
    subject.y_scale.should == 1
  end
  
  it 'calculates the width of the given text' do
    font.expects(:text_width).with("Blah").returns 56
    
    subject.calc_width("Blah").should == 56
  end
  
  it 'has a height' do
    font.expects(:height).returns 42
    subject.height.should == 42
  end
  
  it 'updates the font when the face or size change' do
    subject.name = "Bob"
    subject.size = 21
    @resource_manager.expects(:load_font).with("Bob", 21).returns :newfont
    
    subject.reload
    subject.font.should == :newfont
  end
end


Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gamebox-0.5.5 spec/core/font_style_spec.rb
gamebox-0.5.4 spec/core/font_style_spec.rb
gamebox-0.5.2 spec/core/font_style_spec.rb
gamebox-0.5.1 spec/core/font_style_spec.rb
gamebox-0.5.0 spec/core/font_style_spec.rb
gamebox-0.4.1 spec/core/font_style_spec.rb
gamebox-0.4.0 spec/core/font_style_spec.rb
gamebox-0.4.0.rc11 spec/core/font_style_spec.rb
gamebox-0.4.0.rc5 spec/core/font_style_spec.rb
gamebox-0.4.0.rc4 spec/core/font_style_spec.rb
gamebox-0.4.0.rc3 spec/core/font_style_spec.rb
gamebox-0.4.0.rc2 spec/core/font_style_spec.rb
gamebox-0.4.0.rc1 spec/core/font_style_spec.rb