Sha256: 7007f51ac6e461e1e26b819e25d606de50db6d2d7b588abf77c063e9717668aa

Contents?: true

Size: 854 Bytes

Versions: 1

Compression:

Stored size: 854 Bytes

Contents

require 'swt_shoes/spec_helper'

describe Shoes::Swt::Font do

  subject {Shoes::Swt::Font}

  describe 'Shoes::FONTS' do
    it 'has the FONTS array initially populared' do
      Shoes::FONTS.should_not be_empty
    end

    it 'loads the 2 shoes specific fonts' do
      Shoes::FONTS.should include("Coolvetica", "Lacuna")
    end
  end

  describe '.add_font' do
    it 'returns nil if no font was found' do
      subject.add_font('/non/existent/font.ttf').should be_nil
    end

    it 'returns the font name when the font file is present' do
      subject.add_font(Shoes::FONT_DIR + 'Coolvetica.ttf').should eq 'Coolvetica'
    end

    it 'calls the Display#load_font method' do
      font_path = Shoes::FONT_DIR + 'Coolvetica.ttf'
      ::Swt.display.should_receive(:load_font).with(font_path)
      subject.add_font font_path
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 spec/swt_shoes/font_spec.rb