Sha256: 9f01ce13d04264d3332a605552c63e721a3faed6c2c9006ac8992642003eb9e2

Contents?: true

Size: 861 Bytes

Versions: 2

Compression:

Stored size: 861 Bytes

Contents

require '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

2 entries across 2 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre6 spec/shoes/swt/font_spec.rb
shoes-swt-4.0.0.pre5 spec/shoes/swt/font_spec.rb