shoes-core 4.0.0.pre7 → 4.0.0.pre8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/shoes/arc.rb +10 -13
- data/lib/shoes/arrow.rb +1 -11
- data/lib/shoes/background.rb +0 -3
- data/lib/shoes/border.rb +0 -3
- data/lib/shoes/button.rb +4 -1
- data/lib/shoes/check_button.rb +0 -1
- data/lib/shoes/common/art_element.rb +21 -0
- data/lib/shoes/common/background_element.rb +10 -0
- data/lib/shoes/common/clickable.rb +2 -0
- data/lib/shoes/common/rotate.rb +1 -2
- data/lib/shoes/common/ui_element.rb +10 -1
- data/lib/shoes/core/version.rb +1 -1
- data/lib/shoes/download.rb +47 -29
- data/lib/shoes/dsl.rb +99 -40
- data/lib/shoes/font.rb +0 -4
- data/lib/shoes/http_request.rb +91 -0
- data/lib/shoes/image.rb +0 -1
- data/lib/shoes/input_box.rb +0 -1
- data/lib/shoes/internal_app.rb +1 -1
- data/lib/shoes/line.rb +25 -11
- data/lib/shoes/link.rb +10 -4
- data/lib/shoes/list_box.rb +0 -1
- data/lib/shoes/mock/app.rb +6 -0
- data/lib/shoes/mock/clickable.rb +3 -0
- data/lib/shoes/mock/font.rb +0 -4
- data/lib/shoes/oval.rb +3 -13
- data/lib/shoes/progress.rb +0 -1
- data/lib/shoes/rect.rb +1 -11
- data/lib/shoes/shape.rb +16 -8
- data/lib/shoes/slot.rb +2 -1
- data/lib/shoes/star.rb +8 -11
- data/lib/shoes/text_block.rb +0 -1
- data/lib/shoes/ui/picker.rb +29 -8
- data/lib/shoes/version.rb +1 -1
- metadata +8 -231
- data/Guardfile +0 -5
- data/Rakefile +0 -1
- data/bin/shoes-stub +0 -62
- data/ext/install/Rakefile +0 -39
- data/ext/install/shoes.bat +0 -17
- data/lib/rubygems_plugin.rb +0 -24
- data/shoes-core.gemspec +0 -22
- data/spec/shoes/animation_spec.rb +0 -71
- data/spec/shoes/app_spec.rb +0 -454
- data/spec/shoes/arc_spec.rb +0 -52
- data/spec/shoes/arrow_spec.rb +0 -28
- data/spec/shoes/background_spec.rb +0 -47
- data/spec/shoes/border_spec.rb +0 -46
- data/spec/shoes/builtin_methods_spec.rb +0 -122
- data/spec/shoes/button_spec.rb +0 -55
- data/spec/shoes/check_spec.rb +0 -36
- data/spec/shoes/color_spec.rb +0 -429
- data/spec/shoes/common/attachable_spec.rb +0 -32
- data/spec/shoes/common/inspect_spec.rb +0 -26
- data/spec/shoes/common/remove_spec.rb +0 -37
- data/spec/shoes/common/rotate_spec.rb +0 -13
- data/spec/shoes/common/style_normalizer_spec.rb +0 -28
- data/spec/shoes/common/style_spec.rb +0 -197
- data/spec/shoes/common/translate_spec.rb +0 -27
- data/spec/shoes/configuration_spec.rb +0 -51
- data/spec/shoes/constants_spec.rb +0 -39
- data/spec/shoes/dialog_spec.rb +0 -169
- data/spec/shoes/dimension_spec.rb +0 -451
- data/spec/shoes/dimensions_spec.rb +0 -868
- data/spec/shoes/download_spec.rb +0 -198
- data/spec/shoes/flow_spec.rb +0 -132
- data/spec/shoes/font_spec.rb +0 -36
- data/spec/shoes/framework_learning_spec.rb +0 -31
- data/spec/shoes/gradient_spec.rb +0 -31
- data/spec/shoes/helpers/fake_absolute_element.rb +0 -31
- data/spec/shoes/helpers/fake_element.rb +0 -25
- data/spec/shoes/helpers/inspect_helpers.rb +0 -5
- data/spec/shoes/helpers/sample17_helper.rb +0 -65
- data/spec/shoes/image_spec.rb +0 -69
- data/spec/shoes/images/shoe.jpg +0 -0
- data/spec/shoes/input_box_spec.rb +0 -80
- data/spec/shoes/integration_spec.rb +0 -19
- data/spec/shoes/internal_app_spec.rb +0 -148
- data/spec/shoes/keypress_spec.rb +0 -11
- data/spec/shoes/keyrelease_spec.rb +0 -11
- data/spec/shoes/line_spec.rb +0 -120
- data/spec/shoes/link_spec.rb +0 -149
- data/spec/shoes/list_box_spec.rb +0 -87
- data/spec/shoes/logger/ruby_spec.rb +0 -8
- data/spec/shoes/logger_spec.rb +0 -45
- data/spec/shoes/oval_spec.rb +0 -25
- data/spec/shoes/packager_spec.rb +0 -25
- data/spec/shoes/point_spec.rb +0 -99
- data/spec/shoes/progress_spec.rb +0 -54
- data/spec/shoes/radio_spec.rb +0 -32
- data/spec/shoes/rect_spec.rb +0 -40
- data/spec/shoes/renamed_delegate_spec.rb +0 -69
- data/spec/shoes/shape_spec.rb +0 -119
- data/spec/shoes/shared_examples/button.rb +0 -6
- data/spec/shoes/shared_examples/changeable.rb +0 -26
- data/spec/shoes/shared_examples/clickable.rb +0 -5
- data/spec/shoes/shared_examples/common_methods.rb +0 -35
- data/spec/shoes/shared_examples/dimensions.rb +0 -32
- data/spec/shoes/shared_examples/dsl.rb +0 -44
- data/spec/shoes/shared_examples/dsl/animate.rb +0 -29
- data/spec/shoes/shared_examples/dsl/arc.rb +0 -45
- data/spec/shoes/shared_examples/dsl/background.rb +0 -26
- data/spec/shoes/shared_examples/dsl/border.rb +0 -10
- data/spec/shoes/shared_examples/dsl/button.rb +0 -5
- data/spec/shoes/shared_examples/dsl/cap.rb +0 -6
- data/spec/shoes/shared_examples/dsl/check.rb +0 -11
- data/spec/shoes/shared_examples/dsl/edit_box.rb +0 -8
- data/spec/shoes/shared_examples/dsl/edit_line.rb +0 -8
- data/spec/shoes/shared_examples/dsl/editable_element.rb +0 -29
- data/spec/shoes/shared_examples/dsl/fill.rb +0 -27
- data/spec/shoes/shared_examples/dsl/flow.rb +0 -15
- data/spec/shoes/shared_examples/dsl/gradient.rb +0 -62
- data/spec/shoes/shared_examples/dsl/image.rb +0 -21
- data/spec/shoes/shared_examples/dsl/line.rb +0 -9
- data/spec/shoes/shared_examples/dsl/nofill.rb +0 -6
- data/spec/shoes/shared_examples/dsl/nostroke.rb +0 -6
- data/spec/shoes/shared_examples/dsl/oval.rb +0 -88
- data/spec/shoes/shared_examples/dsl/pattern.rb +0 -34
- data/spec/shoes/shared_examples/dsl/progress.rb +0 -7
- data/spec/shoes/shared_examples/dsl/rect.rb +0 -92
- data/spec/shoes/shared_examples/dsl/rgb.rb +0 -28
- data/spec/shoes/shared_examples/dsl/shape.rb +0 -61
- data/spec/shoes/shared_examples/dsl/star.rb +0 -110
- data/spec/shoes/shared_examples/dsl/stroke.rb +0 -30
- data/spec/shoes/shared_examples/dsl/strokewidth.rb +0 -19
- data/spec/shoes/shared_examples/dsl/style.rb +0 -32
- data/spec/shoes/shared_examples/dsl/text_elements.rb +0 -84
- data/spec/shoes/shared_examples/dsl/video.rb +0 -5
- data/spec/shoes/shared_examples/dsl_app_context.rb +0 -11
- data/spec/shoes/shared_examples/hover.rb +0 -78
- data/spec/shoes/shared_examples/parent.rb +0 -6
- data/spec/shoes/shared_examples/scroll.rb +0 -41
- data/spec/shoes/shared_examples/shared_element_method.rb +0 -60
- data/spec/shoes/shared_examples/slot.rb +0 -441
- data/spec/shoes/shared_examples/state.rb +0 -26
- data/spec/shoes/shared_examples/style.rb +0 -77
- data/spec/shoes/slot_spec.rb +0 -176
- data/spec/shoes/sound_spec.rb +0 -16
- data/spec/shoes/span_spec.rb +0 -112
- data/spec/shoes/spec_helper.rb +0 -24
- data/spec/shoes/stack_spec.rb +0 -79
- data/spec/shoes/star_spec.rb +0 -49
- data/spec/shoes/text_block_dimensions_spec.rb +0 -77
- data/spec/shoes/text_block_spec.rb +0 -314
- data/spec/shoes/text_spec.rb +0 -22
- data/spec/shoes/ui/picker_spec.rb +0 -69
- data/spec/shoes/url_spec.rb +0 -67
- data/spec/shoes/widget_spec.rb +0 -78
- data/spec/shoes_spec.rb +0 -41
- data/spec/spec_helper.rb +0 -27
data/spec/shoes/line_spec.rb
DELETED
@@ -1,120 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoes::Line do
|
4
|
-
include_context "dsl app"
|
5
|
-
|
6
|
-
describe "basic" do
|
7
|
-
let(:left) { 20 }
|
8
|
-
let(:top) { 23 }
|
9
|
-
let(:width) { 280 }
|
10
|
-
let(:height) { 407 }
|
11
|
-
|
12
|
-
subject { Shoes::Line.new(app, parent, Shoes::Point.new(left, top), Shoes::Point.new(300, 430), input_opts) }
|
13
|
-
it_behaves_like "movable object"
|
14
|
-
it_behaves_like "object with style" do
|
15
|
-
let(:subject_without_style) { Shoes::Line.new(app, parent, Shoes::Point.new(left, top), Shoes::Point.new(300, 430)) }
|
16
|
-
let(:subject_with_style) { Shoes::Line.new(app, parent, Shoes::Point.new(left, top), Shoes::Point.new(300, 430), arg_styles) }
|
17
|
-
end
|
18
|
-
it_behaves_like "object with dimensions"
|
19
|
-
it_behaves_like "object with parent"
|
20
|
-
it_behaves_like "object with hover"
|
21
|
-
end
|
22
|
-
|
23
|
-
describe "line with point a at leftmost, topmost" do
|
24
|
-
subject { Shoes::Line.new(app, app, Shoes::Point.new(10, 15), Shoes::Point.new(100, 60), input_opts) }
|
25
|
-
its(:left) { should eq(10) }
|
26
|
-
its(:top) { should eq(15) }
|
27
|
-
its(:right) { should eq(100) }
|
28
|
-
its(:bottom) { should eq(60) }
|
29
|
-
its(:width) { should eq(90) }
|
30
|
-
its(:height) { should eq(45) }
|
31
|
-
end
|
32
|
-
|
33
|
-
describe "specified right-to-left, top-to-bottom" do
|
34
|
-
subject { Shoes::Line.new(app, app, Shoes::Point.new(100, 60), Shoes::Point.new(10, 15), input_opts) }
|
35
|
-
its(:left) { should eq(100) }
|
36
|
-
its(:top) { should eq(60) }
|
37
|
-
its(:right) { should eq(10) }
|
38
|
-
its(:bottom) { should eq(15) }
|
39
|
-
its(:width) { should eq(-90) }
|
40
|
-
its(:height) { should eq(-45) }
|
41
|
-
end
|
42
|
-
|
43
|
-
describe "setting dimensions" do
|
44
|
-
subject { Shoes::Line.new(app, app, Shoes::Point.new(100, 100), Shoes::Point.new(200, 200), input_opts) }
|
45
|
-
|
46
|
-
it "moves point a with left and top" do
|
47
|
-
subject.left -= 100
|
48
|
-
subject.top -= 100
|
49
|
-
expect(subject.point_a).to eq(Shoes::Point.new(0, 0))
|
50
|
-
end
|
51
|
-
|
52
|
-
it "moves point a even when it's not leftmost or topmost" do
|
53
|
-
2.times do
|
54
|
-
subject.left += 100
|
55
|
-
subject.top += 100
|
56
|
-
end
|
57
|
-
|
58
|
-
expect(subject.point_a).to eq(Shoes::Point.new(300, 300))
|
59
|
-
end
|
60
|
-
|
61
|
-
it "moves point a with right and bottom" do
|
62
|
-
subject.right += 100
|
63
|
-
subject.bottom += 100
|
64
|
-
expect(subject.point_b).to eq(Shoes::Point.new(300, 300))
|
65
|
-
end
|
66
|
-
|
67
|
-
it "moves point b even when it's not rightmost or bottommost" do
|
68
|
-
2.times do
|
69
|
-
subject.right -= 100
|
70
|
-
subject.bottom -= 100
|
71
|
-
end
|
72
|
-
|
73
|
-
expect(subject.point_b).to eq(Shoes::Point.new(0, 0))
|
74
|
-
end
|
75
|
-
|
76
|
-
it "can move point a" do
|
77
|
-
subject.move(10, 10)
|
78
|
-
expect(subject.point_a).to eq(Shoes::Point.new(10, 10))
|
79
|
-
expect(subject.point_b).to eq(Shoes::Point.new(200, 200))
|
80
|
-
end
|
81
|
-
|
82
|
-
it "can move all points" do
|
83
|
-
subject.move(10, 10, 20, 20)
|
84
|
-
expect(subject.point_a).to eq(Shoes::Point.new(10, 10))
|
85
|
-
expect(subject.point_b).to eq(Shoes::Point.new(20, 20))
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
describe "#in_bounds?" do
|
90
|
-
subject(:line) { Shoes::Line.new(app, app, Shoes::Point.new(100, 100), Shoes::Point.new(50, 50), input_opts) }
|
91
|
-
|
92
|
-
it "returns true if a point is in the end of the line" do
|
93
|
-
expect(subject.in_bounds?(100, 100)).to be true
|
94
|
-
end
|
95
|
-
|
96
|
-
it "returns true if a point is in the end of the line" do
|
97
|
-
expect(subject.in_bounds?(50, 50)).to be true
|
98
|
-
end
|
99
|
-
|
100
|
-
it "returns true if a point is in the middle of the line" do
|
101
|
-
expect(subject.in_bounds?(75, 75)).to be true
|
102
|
-
end
|
103
|
-
|
104
|
-
it "returns false if a point is not in the line" do
|
105
|
-
expect(subject.in_bounds?(201, 200)).to be false
|
106
|
-
end
|
107
|
-
|
108
|
-
it "takes into account :strokewidth style" do
|
109
|
-
line = Shoes::Line.new(app, app, Shoes::Point.new(50, 50), Shoes::Point.new(70, 50), input_opts)
|
110
|
-
line.style(strokewidth: 20)
|
111
|
-
expect(line.in_bounds?(50, 52)).to be true
|
112
|
-
expect(line.in_bounds?(50, 48)).to be true
|
113
|
-
expect(line.in_bounds?(50, 60)).to be true
|
114
|
-
expect(line.in_bounds?(50, 40)).to be true
|
115
|
-
expect(line.in_bounds?(49, 50)).to be false
|
116
|
-
expect(line.in_bounds?(50, 61)).to be false
|
117
|
-
expect(line.in_bounds?(70, 50)).to be true
|
118
|
-
end
|
119
|
-
end
|
120
|
-
end
|
data/spec/shoes/link_spec.rb
DELETED
@@ -1,149 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoes::Link do
|
4
|
-
let(:gui) { double("gui").as_null_object }
|
5
|
-
let(:user_facing_app) { double("user facing app") }
|
6
|
-
let(:element_styles) { Hash.new }
|
7
|
-
|
8
|
-
let(:app) do
|
9
|
-
double("app", gui: gui, style: {}, element_styles: element_styles,
|
10
|
-
warn: true, add_mouse_hover_control: nil)
|
11
|
-
end
|
12
|
-
|
13
|
-
let(:parent) { double("parent") }
|
14
|
-
let(:internal_app) { double("internal app", app: app, gui: gui, style: {}, element_styles: {}) }
|
15
|
-
let(:texts) { ["text", "goes", "first"] }
|
16
|
-
let(:text_block) { double 'text block', visible?: true, hidden?: false }
|
17
|
-
|
18
|
-
subject do
|
19
|
-
link = Shoes::Link.new(app, texts, color: :blue)
|
20
|
-
link.parent = parent
|
21
|
-
link.text_block = text_block
|
22
|
-
link
|
23
|
-
end
|
24
|
-
|
25
|
-
before do
|
26
|
-
allow(user_facing_app).to receive(:style) do |clazz, styles|
|
27
|
-
element_styles[clazz] = styles
|
28
|
-
end
|
29
|
-
|
30
|
-
allow(subject).to receive(:eval_hover_block) do |blk|
|
31
|
-
blk.call(subject) if blk
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
it_behaves_like "object with hover"
|
36
|
-
|
37
|
-
context "initialize" do
|
38
|
-
it "should set up text" do
|
39
|
-
expect(subject.texts).to eql(texts)
|
40
|
-
expect(subject.to_s).to eql("textgoesfirst")
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should set color" do
|
44
|
-
expect(subject.color).to eql(:blue)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should default styles" do
|
48
|
-
expect(subject.style[:underline]).to eql(true)
|
49
|
-
expect(subject.style[:fill]).to eql(nil)
|
50
|
-
expect(subject.style[:stroke]).to eql(Shoes::COLORS[:blue])
|
51
|
-
end
|
52
|
-
|
53
|
-
context "overriding styles" do
|
54
|
-
subject do
|
55
|
-
Shoes::Link.new(app, texts, underline: false, bg: Shoes::COLORS[:green])
|
56
|
-
end
|
57
|
-
|
58
|
-
it "should include defaults" do
|
59
|
-
expect(subject.style).to include(stroke: Shoes::COLORS[:blue])
|
60
|
-
end
|
61
|
-
|
62
|
-
it "should override defaults" do
|
63
|
-
expect(subject.style).to include(underline: false)
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should include other options" do
|
67
|
-
expect(subject.style).to include(bg: Shoes::COLORS[:green])
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
context "with a block" do
|
72
|
-
let(:callable) { double("callable") }
|
73
|
-
subject { Shoes::Link.new(internal_app, texts, {}, proc { callable.call }) }
|
74
|
-
|
75
|
-
it "sets up for the click" do
|
76
|
-
expect(callable).to receive(:call)
|
77
|
-
subject.blk.call
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
context "with click option as text" do
|
82
|
-
subject { Shoes::Link.new(internal_app, texts, click: "/url") }
|
83
|
-
|
84
|
-
it "should visit the url" do
|
85
|
-
expect(app).to receive(:visit).with("/url")
|
86
|
-
subject.blk.call
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context "with click option as Proc" do
|
91
|
-
let(:callable) { double("callable", call: nil) }
|
92
|
-
subject { Shoes::Link.new(internal_app, texts, click: proc { callable.call }) }
|
93
|
-
|
94
|
-
it "calls the block" do
|
95
|
-
expect(callable).to receive(:call)
|
96
|
-
subject.blk.call
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
context "calling click explicitly" do
|
101
|
-
let(:original_block) { double("original") }
|
102
|
-
let(:replacement_block) { double("replacement") }
|
103
|
-
subject { Shoes::Link.new(internal_app, texts) { original_block.call } }
|
104
|
-
|
105
|
-
it "replaces original block" do
|
106
|
-
expect(original_block).to_not receive(:call)
|
107
|
-
expect(replacement_block).to receive(:call)
|
108
|
-
|
109
|
-
subject.click { replacement_block.call }
|
110
|
-
subject.blk.call
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
describe 'visibility' do
|
116
|
-
describe 'with a containing text block' do
|
117
|
-
it 'forwards #visible? calls' do
|
118
|
-
subject.visible?
|
119
|
-
expect(text_block).to have_received :visible?
|
120
|
-
end
|
121
|
-
|
122
|
-
it 'forwards #hidden? calls' do
|
123
|
-
subject.hidden?
|
124
|
-
expect(text_block).to have_received :hidden?
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
describe 'without a containing text block' do
|
129
|
-
it 'does not crash on #visibie?' do
|
130
|
-
expect { subject.visible? }.not_to raise_error
|
131
|
-
end
|
132
|
-
|
133
|
-
it 'does not crash on #hidden?' do
|
134
|
-
expect { subject.hidden? }.not_to raise_error
|
135
|
-
end
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# #979
|
140
|
-
describe 'containing text block' do
|
141
|
-
before :each do
|
142
|
-
subject.parent = text_block
|
143
|
-
end
|
144
|
-
|
145
|
-
it 'has the correct parent, namingly he text block' do
|
146
|
-
expect(subject.parent).to eq text_block
|
147
|
-
end
|
148
|
-
end
|
149
|
-
end
|
data/spec/shoes/list_box_spec.rb
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoes::ListBox do
|
4
|
-
include_context "dsl app"
|
5
|
-
let(:input_opts) do
|
6
|
-
{ items: items, left: left, top: top, width: width, height: height }
|
7
|
-
end
|
8
|
-
|
9
|
-
let(:items) { ["Wine", "Vodka", "Water"] }
|
10
|
-
|
11
|
-
let(:left) { 10 }
|
12
|
-
let(:top) { 20 }
|
13
|
-
let(:width) { 100 }
|
14
|
-
let(:height) { 200 }
|
15
|
-
|
16
|
-
subject(:list_box) { Shoes::ListBox.new(app, parent, input_opts, input_block) }
|
17
|
-
|
18
|
-
it_behaves_like "an element that can respond to change"
|
19
|
-
it_behaves_like "object with style" do
|
20
|
-
let(:subject_without_style) { Shoes::ListBox.new(app, parent) }
|
21
|
-
let(:subject_with_style) { Shoes::ListBox.new(app, parent, arg_styles) }
|
22
|
-
end
|
23
|
-
it_behaves_like "object with state"
|
24
|
-
it_behaves_like "object with dimensions"
|
25
|
-
|
26
|
-
describe "relative dimensions from parent" do
|
27
|
-
subject { Shoes::ListBox.new(app, parent, relative_opts, input_block) }
|
28
|
-
it_behaves_like "object with relative dimensions"
|
29
|
-
end
|
30
|
-
|
31
|
-
describe "negative dimensions" do
|
32
|
-
subject { Shoes::ListBox.new(app, parent, negative_opts, input_block) }
|
33
|
-
it_behaves_like "object with negative dimensions"
|
34
|
-
end
|
35
|
-
|
36
|
-
it "contains the correct items" do
|
37
|
-
expect(subject.items).to eq(["Wine", "Vodka", "Water"])
|
38
|
-
end
|
39
|
-
|
40
|
-
it "changes the items" do
|
41
|
-
list_box.items = ["Pie", "Apple", "Pig"]
|
42
|
-
expect(list_box.items).to eq(["Pie", "Apple", "Pig"])
|
43
|
-
end
|
44
|
-
|
45
|
-
describe 'Updating gui' do
|
46
|
-
it "updates the gui when array methods like size are called" do
|
47
|
-
expect(list_box.gui).to receive(:update_items)
|
48
|
-
list_box.items.size
|
49
|
-
end
|
50
|
-
|
51
|
-
it "updates the gui when self-modifying array methods like map! are called" do
|
52
|
-
expect(list_box.gui).to receive(:update_items)
|
53
|
-
list_box.items.map! { "replaced!" }
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
describe 'Choosing' do
|
58
|
-
it "allows us to choose an option" do
|
59
|
-
expect(list_box).to respond_to(:choose)
|
60
|
-
end
|
61
|
-
|
62
|
-
def expect_gui_choose_with(string)
|
63
|
-
expect_any_instance_of(Shoes.configuration.backend::ListBox)
|
64
|
-
.to receive(:choose).with string
|
65
|
-
end
|
66
|
-
|
67
|
-
it "should call @gui.choose when we choose something" do
|
68
|
-
expect_gui_choose_with "Wine"
|
69
|
-
list_box.choose "Wine"
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'should not call @gui.choose when the choose option is passed' do
|
73
|
-
expect_any_instance_of(Shoes.configuration.backend::ListBox).to_not receive(:choose)
|
74
|
-
Shoes::ListBox.new app, parent, input_opts.merge(choose: 'Wine')
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should delegate #text to the backend" do
|
79
|
-
expect_any_instance_of(Shoes.configuration.backend::ListBox)
|
80
|
-
.to receive(:text).and_return("Sneakers & Sandals")
|
81
|
-
expect(list_box.text).to eq("Sneakers & Sandals")
|
82
|
-
end
|
83
|
-
|
84
|
-
it 'has the initialized text elements' do
|
85
|
-
expect(subject.items).to eq items
|
86
|
-
end
|
87
|
-
end
|
data/spec/shoes/logger_spec.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoes::Logger do
|
4
|
-
let(:awesome_logger) { Class.new }
|
5
|
-
after { Shoes::Logger.unregister(:awesome_logger) }
|
6
|
-
|
7
|
-
describe ".register" do
|
8
|
-
it "allows new loggers to be registered" do
|
9
|
-
Shoes::Logger.register(:awesome_logger, awesome_logger)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
describe ".get" do
|
14
|
-
before { Shoes::Logger.register(:awesome_logger, awesome_logger) }
|
15
|
-
|
16
|
-
it "retrieves a registered logger" do
|
17
|
-
expect(Shoes::Logger.get(:awesome_logger)).to equal(awesome_logger)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
describe "default logger" do
|
22
|
-
let(:logger) { Shoes.logger }
|
23
|
-
|
24
|
-
it "is a ruby logger" do
|
25
|
-
expect(logger).to be_an_instance_of(Shoes::Logger::Ruby)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe Shoes::Logger::Ruby do
|
31
|
-
let(:logdevice) { StringIO.new }
|
32
|
-
subject(:logger) { Shoes::Logger::Ruby.new logdevice }
|
33
|
-
|
34
|
-
it "logs messages with format 'LEVEL: Message'" do
|
35
|
-
logger.info "Message"
|
36
|
-
expect(logdevice.string).to eq("INFO: Message\n")
|
37
|
-
end
|
38
|
-
|
39
|
-
it "defaults to STDERR" do
|
40
|
-
allow(STDERR).to receive(:write)
|
41
|
-
logger = Shoes::Logger::Ruby.new
|
42
|
-
logger.error "Message"
|
43
|
-
expect(STDERR).to have_received(:write)
|
44
|
-
end
|
45
|
-
end
|
data/spec/shoes/oval_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoes::Oval do
|
4
|
-
include_context "dsl app"
|
5
|
-
|
6
|
-
let(:left) { 20 }
|
7
|
-
let(:top) { 30 }
|
8
|
-
let(:width) { 100 }
|
9
|
-
let(:height) { 200 }
|
10
|
-
|
11
|
-
describe "basic" do
|
12
|
-
subject { Shoes::Oval.new(app, parent, left, top, width, height) }
|
13
|
-
it_behaves_like "object with style" do
|
14
|
-
let(:subject_without_style) { Shoes::Oval.new(app, parent, left, top, width, height) }
|
15
|
-
let(:subject_with_style) { Shoes::Oval.new(app, parent, left, top, width, height, arg_styles) }
|
16
|
-
end
|
17
|
-
it_behaves_like "object with dimensions"
|
18
|
-
it_behaves_like "movable object"
|
19
|
-
it_behaves_like "left, top as center"
|
20
|
-
it_behaves_like "object with parent"
|
21
|
-
it_behaves_like "object with hover"
|
22
|
-
|
23
|
-
# it_styles_with :art_styles, :center, :dimensions, :radius
|
24
|
-
end
|
25
|
-
end
|
data/spec/shoes/packager_spec.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Shoes::Packager do
|
4
|
-
subject { Shoes::Packager.new }
|
5
|
-
|
6
|
-
it "creates packages" do
|
7
|
-
expect(subject.backend).to receive(:create_package).and_call_original
|
8
|
-
subject.create_package("program", "swt:app")
|
9
|
-
end
|
10
|
-
|
11
|
-
it "knows to run packaging if it created one" do
|
12
|
-
subject.create_package("program", "swt:app")
|
13
|
-
expect(subject.should_package?).to eq(true)
|
14
|
-
end
|
15
|
-
|
16
|
-
it "delegates run" do
|
17
|
-
expect(subject.backend).to receive(:run)
|
18
|
-
subject.run("path/to/shoes/app.rb")
|
19
|
-
end
|
20
|
-
|
21
|
-
it "delegates help" do
|
22
|
-
expect(subject.backend).to receive(:help)
|
23
|
-
subject.help("program")
|
24
|
-
end
|
25
|
-
end
|