Sha256: 3e59f25ced08858ef3f5a0635f5bb5fbcbb03d916e3f8b69461b0df1839f804b

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

require 'shoes/swt/spec_helper'

describe Shoes::Swt::Font do

  subject {Shoes::Swt::Font}

  describe 'Shoes::FONTS' do
    it 'has the FONTS array initially populared' do
      expect(Shoes::FONTS).not_to be_empty
    end

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

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

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

    it 'calls the Display#load_font method' do
      font_path = Shoes::FONT_DIR + 'Coolvetica.ttf'
      expect(::Swt.display).to 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-swt-4.0.0.pre4 spec/shoes/swt/font_spec.rb