shoes-swt 4.0.0.pre6 → 4.0.0.pre7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Guardfile +1 -1
- data/lib/shoes/swt.rb +8 -0
- data/lib/shoes/swt/app.rb +5 -7
- data/lib/shoes/swt/arc.rb +3 -28
- data/lib/shoes/swt/arc_painter.rb +34 -0
- data/lib/shoes/swt/arrow.rb +35 -0
- data/lib/shoes/swt/arrow_painter.rb +59 -0
- data/lib/shoes/swt/background.rb +1 -0
- data/lib/shoes/swt/border.rb +1 -0
- data/lib/shoes/swt/check_button.rb +17 -17
- data/lib/shoes/swt/click_listener.rb +6 -6
- data/lib/shoes/swt/common/painter.rb +4 -2
- data/lib/shoes/swt/common/translate.rb +15 -0
- data/lib/shoes/swt/{generate-backend.rb → generate_backend.rb} +1 -3
- data/lib/shoes/swt/gradient.rb +3 -4
- data/lib/shoes/swt/key_listener.rb +9 -7
- data/lib/shoes/swt/line.rb +5 -13
- data/lib/shoes/swt/line_painter.rb +16 -0
- data/lib/shoes/swt/link.rb +4 -0
- data/lib/shoes/swt/link_segment.rb +1 -1
- data/lib/shoes/swt/oval.rb +2 -21
- data/lib/shoes/swt/oval_painter.rb +27 -0
- data/lib/shoes/swt/packager.rb +1 -1
- data/lib/shoes/swt/radio_group.rb +1 -1
- data/lib/shoes/swt/rect.rb +1 -0
- data/lib/shoes/swt/rect_painter.rb +27 -9
- data/lib/shoes/swt/redrawing_aspect.rb +30 -17
- data/lib/shoes/swt/shape.rb +13 -18
- data/lib/shoes/swt/shape_painter.rb +13 -0
- data/lib/shoes/swt/shoes_layout.rb +1 -1
- data/lib/shoes/swt/slot.rb +12 -1
- data/lib/shoes/swt/sound.rb +21 -23
- data/lib/shoes/swt/star.rb +2 -46
- data/lib/shoes/swt/star_painter.rb +51 -0
- data/lib/shoes/swt/text_block.rb +4 -3
- data/lib/shoes/swt/text_block/fitter.rb +3 -4
- data/lib/shoes/swt/text_block/text_font_factory.rb +1 -1
- data/lib/shoes/swt/text_block/text_segment.rb +8 -3
- data/lib/shoes/swt/text_block/text_segment_collection.rb +1 -1
- data/lib/shoes/swt/text_block/text_style_factory.rb +1 -3
- data/lib/shoes/swt/timer.rb +1 -3
- data/lib/shoes/swt/version.rb +3 -1
- data/shoes-swt.gemspec +1 -1
- data/spec/shoes/cli_spec.rb +2 -2
- data/spec/shoes/swt/animation_spec.rb +4 -3
- data/spec/shoes/swt/app_spec.rb +17 -17
- data/spec/shoes/swt/arc_painter_spec.rb +80 -0
- data/spec/shoes/swt/arc_spec.rb +7 -68
- data/spec/shoes/swt/arrow_painter_spec.rb +37 -0
- data/spec/shoes/swt/arrow_spec.rb +27 -0
- data/spec/shoes/swt/background_spec.rb +13 -11
- data/spec/shoes/swt/border_spec.rb +8 -5
- data/spec/shoes/swt/button_spec.rb +4 -4
- data/spec/shoes/swt/check_spec.rb +19 -8
- data/spec/shoes/swt/click_listener_spec.rb +1 -1
- data/spec/shoes/swt/common/painter_spec.rb +29 -14
- data/spec/shoes/swt/common/remove_spec.rb +2 -2
- data/spec/shoes/swt/dialog_spec.rb +1 -1
- data/spec/shoes/swt/flow_spec.rb +5 -3
- data/spec/shoes/swt/font_spec.rb +1 -1
- data/spec/shoes/swt/gradient_spec.rb +6 -3
- data/spec/shoes/swt/image_spec.rb +9 -9
- data/spec/shoes/swt/input_box_spec.rb +20 -15
- data/spec/shoes/swt/integration_spec.rb +1 -1
- data/spec/shoes/swt/key_listener_spec.rb +34 -33
- data/spec/shoes/swt/line_painter_spec.rb +26 -0
- data/spec/shoes/swt/line_spec.rb +2 -25
- data/spec/shoes/swt/link_segment_spec.rb +20 -18
- data/spec/shoes/swt/link_spec.rb +11 -8
- data/spec/shoes/swt/list_box_spec.rb +15 -11
- data/spec/shoes/swt/mouse_move_listener_spec.rb +55 -39
- data/spec/shoes/swt/oval_painter_spec.rb +40 -0
- data/spec/shoes/swt/oval_spec.rb +3 -34
- data/spec/shoes/swt/progress_spec.rb +2 -2
- data/spec/shoes/swt/radio_group_spec.rb +1 -1
- data/spec/shoes/swt/radio_spec.rb +7 -4
- data/spec/shoes/swt/rect_painter_spec.rb +13 -8
- data/spec/shoes/swt/rect_spec.rb +2 -4
- data/spec/shoes/swt/shape_painter_spec.rb +27 -0
- data/spec/shoes/swt/shape_spec.rb +7 -24
- data/spec/shoes/swt/shared_examples/clickable.rb +2 -2
- data/spec/shoes/swt/shared_examples/swt_app_context.rb +21 -12
- data/spec/shoes/swt/shell_control_listener_spec.rb +9 -9
- data/spec/shoes/swt/shoes_layout_spec.rb +18 -13
- data/spec/shoes/swt/slot_spec.rb +15 -4
- data/spec/shoes/swt/spec_helper.rb +1 -1
- data/spec/shoes/swt/star_painter_spec.rb +36 -0
- data/spec/shoes/swt/star_spec.rb +0 -25
- data/spec/shoes/swt/text_block/centered_text_segment_spec.rb +2 -2
- data/spec/shoes/swt/text_block/cursor_painter_spec.rb +17 -13
- data/spec/shoes/swt/text_block/fitter_spec.rb +25 -18
- data/spec/shoes/swt/text_block/painter_spec.rb +7 -4
- data/spec/shoes/swt/text_block/text_font_factory_spec.rb +3 -3
- data/spec/shoes/swt/text_block/text_segment_collection_spec.rb +22 -15
- data/spec/shoes/swt/text_block/text_segment_spec.rb +15 -12
- data/spec/shoes/swt/text_block_spec.rb +12 -10
- data/spec/spec_helper.rb +3 -1
- metadata +30 -8
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Shoes::Swt::ArrowPainter do
|
4
|
+
include_context "painter context"
|
5
|
+
|
6
|
+
let(:corners) { 0 }
|
7
|
+
let(:app) { double('app', real: container, add_paint_listener: true, dsl: dsl) }
|
8
|
+
let(:container) { double('container', disposed?: false) }
|
9
|
+
|
10
|
+
let(:dsl) do
|
11
|
+
double("dsl object", hidden: false, rotate: 0,
|
12
|
+
translate_left: 0, translate_top: 0,
|
13
|
+
left: left, top: top,
|
14
|
+
width: width, height: height,
|
15
|
+
style: {}, strokewidth: 1).as_null_object
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:left) { 55 }
|
19
|
+
let(:top) { 77 }
|
20
|
+
let(:width) { 222 }
|
21
|
+
let(:height) { 222 }
|
22
|
+
let(:shape) { Shoes::Swt::Arrow.new dsl, app }
|
23
|
+
subject { Shoes::Swt::ArrowPainter.new shape }
|
24
|
+
|
25
|
+
it_behaves_like "fill painter"
|
26
|
+
it_behaves_like "stroke painter"
|
27
|
+
|
28
|
+
it "draws on path" do
|
29
|
+
expect(gc).to receive(:draw_path).with(subject.path)
|
30
|
+
subject.paint_control(event)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "fills on path" do
|
34
|
+
expect(gc).to receive(:fill_path).with(subject.path)
|
35
|
+
subject.paint_control(event)
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Shoes::Swt::Arrow do
|
4
|
+
include_context "swt app"
|
5
|
+
|
6
|
+
let(:left) { 55 }
|
7
|
+
let(:top) { 77 }
|
8
|
+
let(:width) { 222 }
|
9
|
+
let(:height) { 222 }
|
10
|
+
let(:dsl) { ::Shoes::Arrow.new shoes_app, parent, left, top, width }
|
11
|
+
|
12
|
+
subject { Shoes::Swt::Arrow.new dsl, swt_app }
|
13
|
+
|
14
|
+
it_behaves_like "paintable"
|
15
|
+
it_behaves_like "updating visibility"
|
16
|
+
it_behaves_like 'clickable backend'
|
17
|
+
|
18
|
+
it "clears the path" do
|
19
|
+
expect(subject.painter).to receive(:clear_path)
|
20
|
+
subject.update_position
|
21
|
+
end
|
22
|
+
|
23
|
+
it "disposes of the painter" do
|
24
|
+
expect(subject.painter).to receive(:dispose)
|
25
|
+
subject.dispose
|
26
|
+
end
|
27
|
+
end
|
@@ -9,15 +9,17 @@ describe Shoes::Swt::Background do
|
|
9
9
|
let(:height) { 111 }
|
10
10
|
let(:corners) { 0 }
|
11
11
|
let(:fill) { Shoes::COLORS[:salmon] }
|
12
|
-
let(:dsl)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
12
|
+
let(:dsl) do
|
13
|
+
double("dsl object", app: shoes_app,
|
14
|
+
element_left: left, element_top: top,
|
15
|
+
element_width: width, element_height: height,
|
16
|
+
translate_left: 0, translate_top: 0,
|
17
|
+
style: { strokewidth: 1 }, strokewidth: 1,
|
18
|
+
curve: corners, fill: fill,
|
19
|
+
hidden: false).as_null_object
|
20
|
+
end
|
17
21
|
|
18
|
-
subject {
|
19
|
-
Shoes::Swt::Background.new dsl, swt_app
|
20
|
-
}
|
22
|
+
subject { Shoes::Swt::Background.new dsl, swt_app }
|
21
23
|
|
22
24
|
context "#initialize" do
|
23
25
|
it { is_expected.to be_an_instance_of(Shoes::Swt::Background) }
|
@@ -41,7 +43,7 @@ describe Shoes::Swt::Background do
|
|
41
43
|
include_context "painter context"
|
42
44
|
|
43
45
|
let(:corners) { 0 }
|
44
|
-
let(:shape) { Shoes::Swt::Background.new dsl, swt_app}
|
46
|
+
let(:shape) { Shoes::Swt::Background.new dsl, swt_app }
|
45
47
|
subject { Shoes::Swt::Background::Painter.new shape }
|
46
48
|
|
47
49
|
it_behaves_like "fill painter"
|
@@ -50,7 +52,7 @@ describe Shoes::Swt::Background do
|
|
50
52
|
let(:corners) { 0 }
|
51
53
|
|
52
54
|
it "fills rect" do
|
53
|
-
expect(gc).to receive(:fill_round_rectangle).with(left, top, width, height, corners*2, corners*2)
|
55
|
+
expect(gc).to receive(:fill_round_rectangle).with(left, top, width, height, corners * 2, corners * 2)
|
54
56
|
subject.paint_control(event)
|
55
57
|
end
|
56
58
|
end
|
@@ -59,7 +61,7 @@ describe Shoes::Swt::Background do
|
|
59
61
|
let(:corners) { 13 }
|
60
62
|
|
61
63
|
it "fills rect" do
|
62
|
-
expect(gc).to receive(:fill_round_rectangle).with(left, top, width, height, corners*2, corners*2)
|
64
|
+
expect(gc).to receive(:fill_round_rectangle).with(left + 1, top + 1, width - 2, height - 2, corners * 2, corners * 2)
|
63
65
|
subject.paint_control(event)
|
64
66
|
end
|
65
67
|
end
|
@@ -8,9 +8,12 @@ describe Shoes::Swt::Border do
|
|
8
8
|
let(:width) { 222 }
|
9
9
|
let(:height) { 111 }
|
10
10
|
let(:corners) { 0 }
|
11
|
-
let(:dsl)
|
12
|
-
|
13
|
-
|
11
|
+
let(:dsl) do
|
12
|
+
double("dsl object", element_width: width, element_height: height,
|
13
|
+
element_left: left, element_top: top, parent: parent,
|
14
|
+
translate_left: 0, translate_top: 0,
|
15
|
+
strokewidth: 1, curve: corners, hidden: false).as_null_object
|
16
|
+
end
|
14
17
|
|
15
18
|
subject { Shoes::Swt::Border.new dsl, swt_app }
|
16
19
|
|
@@ -35,7 +38,7 @@ describe Shoes::Swt::Border do
|
|
35
38
|
let(:corners) { 0 }
|
36
39
|
|
37
40
|
specify "draws rect" do
|
38
|
-
expect(gc).to receive(:draw_round_rectangle).with(left+sw/2, top+sw/2, width-sw, height-sw, corners*2, corners*2)
|
41
|
+
expect(gc).to receive(:draw_round_rectangle).with(left + sw / 2, top + sw / 2, width - sw, height - sw, corners * 2, corners * 2)
|
39
42
|
subject.paint_control(event)
|
40
43
|
end
|
41
44
|
end
|
@@ -44,7 +47,7 @@ describe Shoes::Swt::Border do
|
|
44
47
|
let(:corners) { 13 }
|
45
48
|
|
46
49
|
specify "draws rect" do
|
47
|
-
expect(gc).to receive(:draw_round_rectangle).with(left+sw/2, top+sw/2, width-sw, height-sw, corners*2, corners*2)
|
50
|
+
expect(gc).to receive(:draw_round_rectangle).with(left + sw / 2, top + sw / 2, width - sw, height - sw, corners * 2, corners * 2)
|
48
51
|
subject.paint_control(event)
|
49
52
|
end
|
50
53
|
end
|
@@ -28,10 +28,10 @@ describe Shoes::Swt::Button do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe 'size' do
|
31
|
-
let(:width) {50}
|
32
|
-
let(:height) {20}
|
33
|
-
let(:size) {double 'real size', x: width, y: height}
|
34
|
-
let(:real) {double('button real', size: size, pack: true).as_null_object}
|
31
|
+
let(:width) { 50 }
|
32
|
+
let(:height) { 20 }
|
33
|
+
let(:size) { double 'real size', x: width, y: height }
|
34
|
+
let(:real) { double('button real', size: size, pack: true).as_null_object }
|
35
35
|
|
36
36
|
before :each do
|
37
37
|
allow(::Swt::Widgets::Button).to receive(:new) { real }
|
@@ -4,14 +4,25 @@ describe Shoes::Swt::Check do
|
|
4
4
|
include_context "swt app"
|
5
5
|
|
6
6
|
let(:text) { "TEXT" }
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
|
8
|
+
let(:dsl) do
|
9
|
+
double('dsl', app: shoes_app,
|
10
|
+
gui: real,
|
11
|
+
visible?: true,
|
12
|
+
left: 42,
|
13
|
+
top: 66,
|
14
|
+
element_left: 42,
|
15
|
+
element_top: 66,
|
16
|
+
width: 100,
|
17
|
+
:width= => true,
|
18
|
+
element_width: 100,
|
19
|
+
element_height: 200,
|
20
|
+
height: 200,
|
21
|
+
:height= => true,
|
22
|
+
blk: block,
|
23
|
+
contents: [])
|
24
|
+
end
|
25
|
+
|
15
26
|
let(:block) { proc {} }
|
16
27
|
let(:real) { double('real').as_null_object }
|
17
28
|
|
@@ -8,7 +8,7 @@ describe Shoes::Swt::ClickListener do
|
|
8
8
|
let(:click_block) { double("click block", call: nil) }
|
9
9
|
let(:release_block) { double("release block", call: nil) }
|
10
10
|
|
11
|
-
subject
|
11
|
+
subject { Shoes::Swt::ClickListener.new(swt_app) }
|
12
12
|
|
13
13
|
before do
|
14
14
|
allow(swt_app).to receive(:add_listener)
|
@@ -1,20 +1,35 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Shoes::Swt::Common::Painter do
|
4
|
-
let(:object)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
let(:object) do
|
5
|
+
double 'object', dsl: dsl, transform: transform, apply_fill: nil,
|
6
|
+
apply_stroke: nil
|
7
|
+
end
|
8
|
+
|
9
|
+
let(:parent) do
|
10
|
+
double 'parent', absolute_left: 0, absolute_top: 0, width: 200, height: 100,
|
11
|
+
fixed_height?: true
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:dsl) do
|
15
|
+
double 'dsl', parent: parent, visible?: true, positioned?: true, style: {}
|
16
|
+
end
|
17
|
+
|
18
|
+
let(:event) { double 'paint event', gc: graphics_context }
|
19
|
+
|
20
|
+
let(:graphics_context) do
|
21
|
+
double 'graphics_context', dispose: nil,
|
22
|
+
clipping: nil,
|
23
|
+
set_clipping: nil,
|
24
|
+
set_antialias: nil,
|
25
|
+
set_line_cap: nil,
|
26
|
+
set_transform: nil,
|
27
|
+
setTransform: nil
|
28
|
+
end
|
29
|
+
|
16
30
|
let(:transform) { double 'transform', disposed?: false }
|
17
|
-
|
31
|
+
|
32
|
+
subject { Shoes::Swt::Common::Painter.new object }
|
18
33
|
|
19
34
|
before do
|
20
35
|
allow(::Swt::Transform).to receive(:new) { transform }
|
@@ -71,7 +86,7 @@ describe Shoes::Swt::Common::Painter do
|
|
71
86
|
expect_transform_for_rotate
|
72
87
|
|
73
88
|
subject.set_rotate graphics_context, 0, 0, 0 do
|
74
|
-
#no-op
|
89
|
+
# no-op
|
75
90
|
end
|
76
91
|
end
|
77
92
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Shoes::Swt::Common::Remove do
|
4
|
-
let(:clazz)
|
4
|
+
let(:clazz) do
|
5
5
|
Class.new do
|
6
6
|
include Shoes::Swt::Common::Remove
|
7
7
|
|
@@ -13,7 +13,7 @@ describe Shoes::Swt::Common::Remove do
|
|
13
13
|
@real = real
|
14
14
|
end
|
15
15
|
end
|
16
|
-
|
16
|
+
end
|
17
17
|
|
18
18
|
let(:app) { double("app", click_listener: click_listener) }
|
19
19
|
let(:dsl) { double("dsl") }
|
data/spec/shoes/swt/flow_spec.rb
CHANGED
@@ -3,8 +3,10 @@ require 'spec_helper'
|
|
3
3
|
describe Shoes::Swt::Flow do
|
4
4
|
include_context "swt app"
|
5
5
|
|
6
|
-
let(:dsl)
|
7
|
-
|
6
|
+
let(:dsl) do
|
7
|
+
double('dsl', app: shoes_app, pass_coordinates?: true).as_null_object
|
8
|
+
end
|
9
|
+
|
8
10
|
let(:real) { double('real', disposed?: false) }
|
9
11
|
let(:parent_real) { double('parent_real', get_layout: "ok") }
|
10
12
|
|
@@ -24,7 +26,7 @@ describe Shoes::Swt::Flow do
|
|
24
26
|
describe "#initialize" do
|
25
27
|
before do
|
26
28
|
allow(parent).to receive(:real) { parent_real }
|
27
|
-
allow(parent_real).to receive(:get_layout) {double(top_slot: true)}
|
29
|
+
allow(parent_real).to receive(:get_layout) { double(top_slot: true) }
|
28
30
|
end
|
29
31
|
|
30
32
|
it "sets readers" do
|
data/spec/shoes/swt/font_spec.rb
CHANGED
@@ -3,9 +3,12 @@ require 'spec_helper'
|
|
3
3
|
describe Shoes::Swt::Gradient do
|
4
4
|
let(:color1) { Shoes::Color.create(Shoes::COLORS[:honeydew]) }
|
5
5
|
let(:color2) { Shoes::Color.create(Shoes::COLORS[:salmon]) }
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
|
7
|
+
let(:applied_to) do
|
8
|
+
double("applied to", element_left: 0, element_top: 0, angle: 0,
|
9
|
+
element_width: 10, element_height: 10)
|
10
|
+
end
|
11
|
+
|
9
12
|
let(:dsl) { Shoes::Gradient.new(color1, color2) }
|
10
13
|
let(:gc) { double("gc", set_background_pattern: nil) }
|
11
14
|
|
@@ -7,19 +7,19 @@ describe Shoes::Swt::Image do
|
|
7
7
|
IMAGE_HEIGHT = 1
|
8
8
|
|
9
9
|
let(:blk) { double("block") }
|
10
|
-
let(:dsl) { Shoes::Image.new shoes_app, parent_dsl, image, opts}
|
11
|
-
let(:opts) {{left: left, top: top, width: width, height: height}}
|
10
|
+
let(:dsl) { Shoes::Image.new shoes_app, parent_dsl, image, opts }
|
11
|
+
let(:opts) { {left: left, top: top, width: width, height: height} }
|
12
12
|
let(:left) { 100 }
|
13
13
|
let(:top) { 200 }
|
14
14
|
let(:height) { nil }
|
15
|
-
let(:width) {nil}
|
15
|
+
let(:width) { nil }
|
16
16
|
let(:image_path) { File.dirname(__FILE__) + '/minimal.png' }
|
17
17
|
let(:image) { image_path }
|
18
18
|
|
19
|
-
subject
|
19
|
+
subject do
|
20
20
|
allow(dsl).to receive(:file_path) { image }
|
21
21
|
Shoes::Swt::Image.new(dsl, swt_app)
|
22
|
-
|
22
|
+
end
|
23
23
|
|
24
24
|
it_behaves_like "paintable"
|
25
25
|
it_behaves_like "removable"
|
@@ -71,14 +71,14 @@ describe Shoes::Swt::Image do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
describe 'with a given width' do
|
74
|
-
let(:width) {(IMAGE_WIDTH * 5.8).to_i}
|
74
|
+
let(:width) { (IMAGE_WIDTH * 5.8).to_i }
|
75
75
|
it 'scales the height' do
|
76
76
|
expect(subject.height).to eq((IMAGE_HEIGHT * 5.8).to_i)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
80
|
describe 'with a given height' do
|
81
|
-
let(:height) {IMAGE_HEIGHT * 4}
|
81
|
+
let(:height) { IMAGE_HEIGHT * 4 }
|
82
82
|
|
83
83
|
it 'scales the width' do
|
84
84
|
expect(subject.width).to eq(IMAGE_WIDTH * 4)
|
@@ -86,8 +86,8 @@ describe Shoes::Swt::Image do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
describe 'with a given width and height' do
|
89
|
-
let(:width) {1}
|
90
|
-
let(:height) {2}
|
89
|
+
let(:width) { 1 }
|
90
|
+
let(:height) { 2 }
|
91
91
|
it 'sets the given width' do
|
92
92
|
expect(subject.width).to eq(1)
|
93
93
|
end
|
@@ -3,15 +3,20 @@ require 'spec_helper'
|
|
3
3
|
describe Shoes::Swt::InputBox do
|
4
4
|
include_context "swt app"
|
5
5
|
|
6
|
-
let(:dsl)
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
let(:
|
13
|
-
|
14
|
-
|
6
|
+
let(:dsl) do
|
7
|
+
double('dsl', app: shoes_app, visible?: true, element_width: 80,
|
8
|
+
element_height: 22, initial_text: 'Jay',
|
9
|
+
secret?: secret, call_change_listeners: true).as_null_object
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:real) do
|
13
|
+
double('real', disposed?: false, text: text, add_modify_listener: true)
|
14
|
+
.as_null_object
|
15
|
+
end
|
16
|
+
|
17
|
+
let(:styles) { ::Swt::SWT::SINGLE | ::Swt::SWT::BORDER }
|
18
|
+
let(:secret) { false }
|
19
|
+
let(:text) { 'Some text...' }
|
15
20
|
|
16
21
|
subject { Shoes::Swt::InputBox.new dsl, swt_app, styles }
|
17
22
|
|
@@ -25,8 +30,8 @@ describe Shoes::Swt::InputBox do
|
|
25
30
|
it_behaves_like "updating visibility"
|
26
31
|
|
27
32
|
describe "#initialize" do
|
28
|
-
let(:event) {double 'Event', source: source}
|
29
|
-
let(:source) {double 'Source'}
|
33
|
+
let(:event) { double 'Event', source: source }
|
34
|
+
let(:source) { double 'Source' }
|
30
35
|
it "sets text on real element" do
|
31
36
|
subject.text = "some text"
|
32
37
|
expect(real).to have_received(:text=).with("some text")
|
@@ -57,9 +62,9 @@ describe Shoes::Swt::InputBox do
|
|
57
62
|
end
|
58
63
|
|
59
64
|
describe 'with the same text' do
|
60
|
-
let(:event) {double 'Bad Event', source: source}
|
61
|
-
let(:source) {double 'Our source', text: text}
|
62
|
-
let(:text) {'Double call'}
|
65
|
+
let(:event) { double 'Bad Event', source: source }
|
66
|
+
let(:source) { double 'Our source', text: text }
|
67
|
+
let(:text) { 'Double call' }
|
63
68
|
|
64
69
|
it 'does not call the change listeners' do
|
65
70
|
subject.text = text
|
@@ -90,7 +95,7 @@ describe Shoes::Swt::InputBox do
|
|
90
95
|
end
|
91
96
|
|
92
97
|
describe Shoes::Swt::EditLine do
|
93
|
-
subject {Shoes::Swt::EditLine.new dsl, swt_app}
|
98
|
+
subject { Shoes::Swt::EditLine.new dsl, swt_app }
|
94
99
|
describe ":secret option" do
|
95
100
|
context "when NOT set" do
|
96
101
|
it "does NOT set PASSWORD style" do
|