Sha256: 39db9d0d3ee5cd9537b1043fafef82287ddd47898d013f91f9bc85b88c088026

Contents?: true

Size: 1.16 KB

Versions: 2

Compression:

Stored size: 1.16 KB

Contents

require 'shoes/swt/spec_helper'

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

  let(:container) { double('container', :disposed? => false).as_null_object }
  let(:dsl) { Shoes::Line.new shoes_app, parent, point_a, point_b }
  let(:point_a) { Shoes::Point.new(10, 100) }
  let(:point_b) { Shoes::Point.new(300, 10) }

  subject {
    Shoes::Swt::Line.new(dsl, swt_app)
  }

  context "#initialize" do
    it { is_expected.to be_instance_of(Shoes::Swt::Line) }
    its(:dsl) { is_expected.to be(dsl) }
  end

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

  it {is_expected.to respond_to :remove}

  describe "painter" do
    include_context "painter context"

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

    before(:each) do
      dsl.absolute_left = point_a.x
      dsl.absolute_top  = point_a.y
      allow(dsl).to receive_messages(positioned?: true)
    end

    it_behaves_like "stroke painter"

    specify "draws line" do
      expect(gc).to receive(:draw_line).with(10, 100, 300, 10)
      subject.paint_control(event)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre4 spec/shoes/swt/line_spec.rb
shoes-swt-4.0.0.pre3 spec/shoes/swt/line_spec.rb