Sha256: 4b414f6355bd46e866a0e17ad2758bd44e5129919d495a48b28cb6853ae3c120

Contents?: true

Size: 844 Bytes

Versions: 2

Compression:

Stored size: 844 Bytes

Contents

require 'shoes/swt/spec_helper'

describe Shoes::Swt::TextFontFactory do
  let(:font_details) {
    {
      :name   => "Helvetica",
      :size   => 16,
      :styles => [::Swt::SWT::BOLD]
    }
  }

  subject { Shoes::Swt::TextFontFactory.new() }

  it "creates a font" do
    font = subject.create_font(font_details)
    expect(font).not_to be(nil)
  end

  it "disposes of fonts" do
    font = subject.create_font(font_details)
    expect(font).to receive(:dispose)

    subject.dispose
  end

  it "doesn't dispose already disposed fonts" do
    font = subject.create_font(font_details)
    font.dispose

    expect(font).not_to receive(:dispose)
    subject.dispose
  end

  it "reuses font instances" do
    font1 = subject.create_font(font_details)
    font2 = subject.create_font(font_details)

    expect(font1).to be(font2)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre4 spec/shoes/swt/text_block/text_font_factory_spec.rb
shoes-swt-4.0.0.pre3 spec/shoes/swt/text_block/text_font_factory_spec.rb