Sha256: 163430a246d6a1fcd370e4e508d8baffccd7cf07625bca79153149ed64d7e90d
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
require 'shoes/swt/spec_helper' describe Shoes::Swt::ColorFactory do let(:blue) { Shoes::COLORS[:blue] } let(:gradient) { Shoes::Gradient.new(blue, blue) } subject(:factory) { Shoes::Swt::ColorFactory.new } it "turns Shoes::Color's into Shoes::Swt::Color's" do expect(factory.create(blue)).to_not be_nil end it "hands back nil for nil" do expect(factory.create(nil)).to be_nil end it "caches colors" do first = factory.create(blue) second = factory.create(blue) expect(first).to eql(second) end it "disposes of colors" do color = factory.create(blue) expect(color).to receive(:dispose) factory.dispose end it "doesn't cache colors across dispose" do color = factory.create(blue) factory.dispose new_color = factory.create(blue) expect(color).to_not eql(new_color) end it "allows gradients through" do expect(factory.create(gradient)).to_not be_nil end it "safely disposes of non-disposable elements" do factory.create(gradient) expect(gradient).to receive(:dispose).never factory.dispose end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shoes-swt-4.0.0.pre4 | spec/shoes/swt/color_factory_spec.rb |
shoes-swt-4.0.0.pre3 | spec/shoes/swt/color_factory_spec.rb |