Sha256: 2c3253d82fd6e04dba8724e1b2683c0fe8fdeedc521b74ae1cb197b9d90efa05

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

require 'spec_helper'

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

  let(:left) { 55 }
  let(:top) { 77 }
  let(:points) { 7 }
  let(:outer) { 100 }
  let(:inner) { 20 }
  let(:dsl) { Shoes::Star.new shoes_app, parent, left, top, points, outer, inner }

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

  context "#initialize" do
    its(:dsl) { is_expected.to be(dsl) }
  end

  it_behaves_like "paintable"
  it_behaves_like "updating visibility"
  it_behaves_like 'clickable backend'

  describe "painter" do
    include_context "painter context"

    let(:corners) { 0 }
    let(:dsl) { double("dsl object", hidden: false, points: points, outer: outer,
                                     inner: inner, element_width: outer * 2.0,
                                     element_height: outer * 2.0, element_left: left,
                                     element_top: top).as_null_object }
    let(:shape) { Shoes::Swt::Star.new dsl, swt_app }
    subject { Shoes::Swt::Star::Painter.new shape }

    it_behaves_like "fill painter"
    it_behaves_like "stroke painter"

    it "fills star" do
      expect(gc).to receive(:fillPolygon)
      subject.paint_control(event)
    end

    it "draws star" do
      expect(gc).to receive(:drawPolygon)
      subject.paint_control(event)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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