Sha256: bff3b87d89d783ab94249e02f578767f3ae574f3e3751074d1b26ac6e09f6095

Contents?: true

Size: 1.11 KB

Versions: 1

Compression:

Stored size: 1.11 KB

Contents

require 'shoes/swt/spec_helper'

describe Shoes::Swt::TextBlock::Painter do
  include_context "swt app"

  let(:dsl)   { double("dsl", app: shoes_app, gui: gui, hidden?: false) }
  let(:gui)   { double("gui", dispose: nil, segments: segment_collection) }
  let(:event) { double("event").as_null_object }
  let(:segment_collection) { double("segment collection", empty?: false) }

  subject { Shoes::Swt::TextBlock::Painter.new(dsl) }

  it "doesn't draw if hidden" do
    allow(dsl).to receive(:hidden?) { true }
    expect(segment_collection).to_not receive(:paint_control)

    subject.paintControl(event)
  end

  it "doesn't draw no segment collection" do
    allow(gui).to receive(:segments) { nil }
    expect(segment_collection).to_not receive(:paint_control)

    subject.paintControl(event)
  end

  it "doesn't draw segment collection is empty" do
    allow(segment_collection).to receive(:empty?) { true }
    expect(segment_collection).to_not receive(:paint_control)

    subject.paintControl(event)
  end

  it "paints" do
    expect(segment_collection).to receive(:paint_control)
    subject.paintControl(event)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shoes-swt-4.0.0.pre4 spec/shoes/swt/text_block/painter_spec.rb