Sha256: 2bb9453b51cd66d19882e3990ddb831824bceb75d2c56893237a3d57ab0378d5

Contents?: true

Size: 821 Bytes

Versions: 2

Compression:

Stored size: 821 Bytes

Contents

require '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.pre6 spec/shoes/swt/text_block/text_font_factory_spec.rb
shoes-swt-4.0.0.pre5 spec/shoes/swt/text_block/text_font_factory_spec.rb