Sha256: e98dddd3fda0f272d439cc3fcb2a6c886c1878a964330c42f2a4df34e60eb290

Contents?: true

Size: 1011 Bytes

Versions: 2

Compression:

Stored size: 1011 Bytes

Contents

require 'spec_helper'

describe Shoes::Swt::Gradient do
  let(:color1) { Shoes::Color.create(Shoes::COLORS[:honeydew]) }
  let(:color2) { Shoes::Color.create(Shoes::COLORS[:salmon]) }
  let(:applied_to) { double("applied to",
                            element_left: 0, element_top: 0, angle: 0,
                            element_width: 10, element_height: 10) }
  let(:dsl) { Shoes::Gradient.new(color1, color2) }
  let(:gc) { double("gc", set_background_pattern: nil) }

  subject { Shoes::Swt::Gradient.new(dsl) }

  it_behaves_like "an swt pattern"

  describe "#dispose" do
    it "lets subresources do" do
      # Prime the object's lazy colors
      subject.apply_as_fill(gc, applied_to)

      expect(subject.color1).to receive(:dispose)
      expect(subject.color2).to receive(:dispose)

      subject.dispose
    end
  end

  describe "#apply_as_fill" do
    it "sets background" do
      expect(gc).to receive(:set_background_pattern)
      subject.apply_as_fill(gc, applied_to)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre6 spec/shoes/swt/gradient_spec.rb
shoes-swt-4.0.0.pre5 spec/shoes/swt/gradient_spec.rb