spec/shoes/swt/shape_spec.rb in shoes-swt-4.0.0.pre6 vs spec/shoes/swt/shape_spec.rb in shoes-swt-4.0.0.pre7

- old
+ new

@@ -1,12 +1,16 @@ require 'spec_helper' describe Shoes::Swt::Shape do include_context "swt app" - let(:dsl) { instance_double("Shoes::Shape", hidden: false, - needs_rotate?: false,style: {}).as_null_object } + let(:dsl) do + double("Shoes::Shape", hidden: false, needs_rotate?: false, + translate_left: 0, translate_top: 0, + style: {}).as_null_object + end + subject { Shoes::Swt::Shape.new dsl, swt_app } shared_examples_for "Swt::Shape" do let(:ancestors) { subject.class.ancestors.map(&:name) } @@ -46,11 +50,11 @@ subject.line_to 20, 30 end it "delegates #arc_to" do expect(element).to receive(:add_arc).with(25, 45, 50, 20, 0.0, -90.0) - subject.arc_to 50, 55, 50, 20, 0, Shoes::PI/2 + subject.arc_to 50, 55, 50, 20, 0, Shoes::PI / 2 end end describe "moving" do let(:transform) { double("transform") } @@ -62,29 +66,8 @@ it "translates position to dsl's element_left and element_top" do allow(dsl).to receive(:element_left) { 20 } allow(dsl).to receive(:element_top) { 30 } expect(transform).to receive(:translate).with(20, 30) subject.update_position - end - end - - describe "painter" do - include_context "painter context" - - let(:shape) { Shoes::Swt::Shape.new(dsl, swt_app) } - subject { Shoes::Swt::Shape::Painter.new(shape) } - - it_behaves_like "stroke painter" - it_behaves_like "fill painter" - it_behaves_like "movable painter" - - it "fills path" do - expect(gc).to receive(:fill_path) - subject.paint_control(event) - end - - it "draws path" do - expect(gc).to receive(:draw_path) - subject.paint_control(event) end end end