Sha256: c3a764d5f4aee8667f2cf5f652f6831c1b685ef4b41c0e8c26c0af16f93e4432

Contents?: true

Size: 863 Bytes

Versions: 1

Compression:

Stored size: 863 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

1 entries across 1 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre7 spec/shoes/swt/font_spec.rb