Sha256: e5a16641b38ea93b62865378798a13789474af595466545949811b93d3450f14

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

require 'spec_helper'

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

  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

1 entries across 1 versions & 1 rubygems

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