Sha256: fe0ab9574e674058f3b6cd279daa61a5fcff095591cd40abecddeed0f7d7439c

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

require 'swt_shoes/spec_helper'

describe Shoes::Swt::Background do
  include_context "swt app"

  let(:left) { 55 }
  let(:top) { 77 }
  let(:width) { 222 }
  let(:height) { 111 }
  let(:corners) { 0 }
  let(:dsl) { double("dsl object", app: shoes_app,
                     element_left: left, element_top: top,
                     element_width: width, element_height: height,
                     strokewidth: 1, corners: corners,
                     hidden: false).as_null_object }

  subject {
    Shoes::Swt::Background.new dsl, swt_app
  }

  context "#initialize" do
    it { should be_an_instance_of(Shoes::Swt::Background) }
    its(:dsl) { should be(dsl) }
  end

  it_behaves_like "paintable"
  it_behaves_like "togglable"

  describe "painter" do
    include_context "painter context"

    let(:corners) { 0 }
    let(:shape) { Shoes::Swt::Background.new dsl, swt_app}
    subject { Shoes::Swt::Background::Painter.new shape }

    it_behaves_like "fill painter"

    describe "square corners" do
      let(:corners) { 0 }

      it "fills rect" do
        gc.should_receive(:fill_round_rectangle).with(left, top, width, height, corners*2, corners*2)
        subject.paint_control(event)
      end
    end

    describe "round corners" do
      let(:corners) { 13 }

      it "fills rect" do
        gc.should_receive(:fill_round_rectangle).with(left, top, width, height, corners*2, corners*2)
        subject.paint_control(event)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-4.0.0.pre1 spec/swt_shoes/background_spec.rb