shoes-swt 4.0.0.pre3 → 4.0.0.pre4
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/bin/shoes-swt +2 -2
- data/lib/shoes/swt.rb +90 -72
- data/lib/shoes/swt/app.rb +5 -0
- data/lib/shoes/swt/click_listener.rb +0 -1
- data/lib/shoes/swt/color.rb +7 -7
- data/lib/shoes/swt/common/fill.rb +9 -3
- data/lib/shoes/swt/common/painter.rb +14 -11
- data/lib/shoes/swt/common/stroke.rb +9 -3
- data/lib/shoes/swt/dialog.rb +2 -2
- data/lib/shoes/swt/gradient.rb +13 -11
- data/lib/shoes/swt/image.rb +1 -3
- data/lib/shoes/swt/image_pattern.rb +2 -2
- data/lib/shoes/swt/line.rb +0 -2
- data/lib/shoes/swt/list_box.rb +6 -1
- data/lib/shoes/swt/progress.rb +9 -8
- data/lib/shoes/swt/redrawing_aspect.rb +1 -1
- data/lib/shoes/swt/shape.rb +3 -1
- data/lib/shoes/swt/shoes_layout.rb +38 -24
- data/lib/shoes/swt/text_block.rb +41 -12
- data/lib/shoes/swt/text_block/cursor_painter.rb +1 -1
- data/lib/shoes/swt/text_block/fitter.rb +8 -3
- data/lib/shoes/swt/text_block/painter.rb +9 -28
- data/lib/shoes/swt/text_block/text_segment.rb +16 -6
- data/lib/shoes/swt/text_block/text_segment_collection.rb +17 -5
- data/lib/shoes/swt/tooling/leak_hunter.rb +1 -1
- data/lib/shoes/swt/version.rb +1 -1
- data/shoes-swt.gemspec +2 -2
- data/spec/shoes/cli_spec.rb +1 -1
- data/spec/shoes/swt/app_spec.rb +15 -6
- data/spec/shoes/swt/color_spec.rb +8 -7
- data/spec/shoes/swt/common/painter_spec.rb +30 -5
- data/spec/shoes/swt/disposed_protection_spec.rb +0 -1
- data/spec/shoes/swt/font_spec.rb +2 -2
- data/spec/shoes/swt/gradient_spec.rb +5 -2
- data/spec/shoes/swt/image_pattern_spec.rb +11 -1
- data/spec/shoes/swt/list_box_spec.rb +24 -4
- data/spec/shoes/swt/mouse_move_listener_spec.rb +1 -1
- data/spec/shoes/swt/oval_spec.rb +0 -1
- data/spec/shoes/swt/progress_spec.rb +3 -4
- data/spec/shoes/swt/radio_group_spec.rb +4 -4
- data/spec/shoes/swt/radio_spec.rb +1 -1
- data/spec/shoes/swt/shape_spec.rb +8 -1
- data/spec/shoes/swt/shared_examples/paintable.rb +0 -1
- data/spec/shoes/swt/shared_examples/pattern.rb +2 -6
- data/spec/shoes/swt/shared_examples/swt_app_context.rb +0 -1
- data/spec/shoes/swt/shell_control_listener_spec.rb +4 -4
- data/spec/shoes/swt/shoes_layout_spec.rb +84 -0
- data/spec/shoes/swt/slot_spec.rb +1 -1
- data/spec/shoes/swt/spec_helper.rb +2 -0
- data/spec/shoes/swt/text_block/cursor_painter_spec.rb +2 -2
- data/spec/shoes/swt/text_block/fitter_spec.rb +19 -4
- data/spec/shoes/swt/text_block/painter_spec.rb +15 -189
- data/spec/shoes/swt/text_block/text_segment_collection_spec.rb +10 -5
- data/spec/shoes/swt/text_block/text_segment_spec.rb +4 -4
- data/spec/shoes/swt/text_block_spec.rb +28 -15
- metadata +8 -6
@@ -78,12 +78,12 @@ describe Shoes::Swt::TextBlock::TextSegment do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
describe "shrinking on initialization" do
|
81
|
-
it "
|
82
|
-
|
81
|
+
it "happens when too long for container" do
|
82
|
+
bounds.width = segment_width + 10
|
83
|
+
expect(subject.layout).to have_received(:width=).with(segment_width)
|
83
84
|
end
|
84
85
|
|
85
|
-
it "
|
86
|
-
bounds.width = segment_width + 10
|
86
|
+
it "happens even when enough containing width" do
|
87
87
|
expect(subject.layout).to have_received(:width=).with(segment_width)
|
88
88
|
end
|
89
89
|
end
|
@@ -59,35 +59,41 @@ describe Shoes::Swt::TextBlock do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "positions single line of text" do
|
62
|
-
expect(dsl).to receive(:absolute_right=).with(layout_width + 50)
|
63
|
-
expect(dsl).to receive(:absolute_bottom=).with(layout_height)
|
62
|
+
expect(dsl).to receive(:absolute_right=).with(layout_width + 50 - 1)
|
63
|
+
expect(dsl).to receive(:absolute_bottom=).with(layout_height - 1)
|
64
64
|
|
65
65
|
when_aligns_and_positions
|
66
66
|
|
67
|
-
expect(current_position.y).to eq(layout_height - line_height)
|
67
|
+
expect(current_position.y).to eq(layout_height - line_height + 1)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "positions single line with margin" do
|
71
71
|
allow(dsl).to receive_messages(margin_left: margin, margin_right: margin,
|
72
72
|
margin_top: margin, margin_bottom: margin)
|
73
73
|
|
74
|
-
expect(dsl).to receive(:absolute_right=).with(layout_width + 50 + margin)
|
75
|
-
expect(dsl).to receive(:absolute_bottom=).with(layout_height + 2 * margin)
|
74
|
+
expect(dsl).to receive(:absolute_right=).with(layout_width + 50 + margin - 1)
|
75
|
+
expect(dsl).to receive(:absolute_bottom=).with(layout_height + 2 * margin - 1)
|
76
76
|
|
77
77
|
when_aligns_and_positions
|
78
78
|
|
79
|
-
expect(current_position.y).to eq(layout_height - line_height)
|
79
|
+
expect(current_position.y).to eq(layout_height - line_height + 1)
|
80
80
|
end
|
81
81
|
|
82
82
|
it "pushes to next line if ends in newline" do
|
83
83
|
allow(dsl).to receive(:text) { "text\n" }
|
84
84
|
|
85
85
|
expect(dsl).to receive(:absolute_right=).with(50)
|
86
|
-
expect(dsl).to receive(:
|
86
|
+
expect(dsl).to receive(:absolute_right=).with(149)
|
87
|
+
expect(dsl).to receive(:absolute_bottom=).with(layout_height - 1)
|
87
88
|
|
88
89
|
when_aligns_and_positions
|
89
90
|
|
90
|
-
expect(current_position.y).to eq(layout_height)
|
91
|
+
expect(current_position.y).to eq(layout_height + 1)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "is aligns and positions safely without segments" do
|
95
|
+
allow(fitter).to receive(:fit_it_in).and_return([])
|
96
|
+
when_aligns_and_positions
|
91
97
|
end
|
92
98
|
|
93
99
|
it "disposes of prior segments" do
|
@@ -124,6 +130,13 @@ describe Shoes::Swt::TextBlock do
|
|
124
130
|
subject.remove
|
125
131
|
end
|
126
132
|
end
|
133
|
+
|
134
|
+
context "when doesn't fit" do
|
135
|
+
it "bails out early" do
|
136
|
+
allow(fitter).to receive(:fit_it_in).and_return([])
|
137
|
+
subject.contents_alignment(current_position)
|
138
|
+
end
|
139
|
+
end
|
127
140
|
end
|
128
141
|
|
129
142
|
describe "with two segments" do
|
@@ -140,24 +153,24 @@ describe Shoes::Swt::TextBlock do
|
|
140
153
|
end
|
141
154
|
|
142
155
|
it "positions in two segments" do
|
143
|
-
expect(dsl).to receive(:absolute_right=).with(layout_width)
|
144
|
-
expect(dsl).to receive(:absolute_bottom=).with(layout_height)
|
156
|
+
expect(dsl).to receive(:absolute_right=).with(layout_width - 1)
|
157
|
+
expect(dsl).to receive(:absolute_bottom=).with(layout_height - 1)
|
145
158
|
|
146
159
|
when_aligns_and_positions
|
147
160
|
|
148
|
-
expect(current_position.y).to eq(layout_height - line_height)
|
161
|
+
expect(current_position.y).to eq(layout_height - line_height + 1)
|
149
162
|
end
|
150
163
|
|
151
164
|
it "positions in two segments with margins" do
|
152
165
|
allow(dsl).to receive_messages(margin_left: margin, margin_right: margin,
|
153
166
|
margin_top: margin, margin_bottom: margin)
|
154
167
|
|
155
|
-
expect(dsl).to receive(:absolute_right=).with(layout_width + margin)
|
156
|
-
expect(dsl).to receive(:absolute_bottom=).with(layout_height + 2 * margin)
|
168
|
+
expect(dsl).to receive(:absolute_right=).with(layout_width + margin - 1)
|
169
|
+
expect(dsl).to receive(:absolute_bottom=).with(layout_height + 2 * margin - 1)
|
157
170
|
|
158
171
|
when_aligns_and_positions
|
159
172
|
|
160
|
-
expect(current_position.y).to eq(layout_height - line_height)
|
173
|
+
expect(current_position.y).to eq(layout_height - line_height + 1)
|
161
174
|
end
|
162
175
|
end
|
163
176
|
end
|
@@ -183,7 +196,7 @@ describe Shoes::Swt::TextBlock do
|
|
183
196
|
def create_segment(name="segment", width=layout_width,
|
184
197
|
height=layout_height, line_height=line_height)
|
185
198
|
bounds = double("bounds", width: width, height: height)
|
186
|
-
double(name, disposed?: false,
|
199
|
+
double(name, disposed?: false, style_from: nil,
|
187
200
|
width: width, height: height,
|
188
201
|
last_line_width: width, last_line_height: line_height,
|
189
202
|
bounds: bounds)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shoes-swt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.
|
4
|
+
version: 4.0.0.pre4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Team Shoes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
requirements:
|
44
44
|
- - '='
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 4.0.0.
|
46
|
+
version: 4.0.0.pre4
|
47
47
|
name: shoes-core
|
48
48
|
prerelease: false
|
49
49
|
type: :runtime
|
@@ -51,13 +51,13 @@ dependencies:
|
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.0.0.
|
54
|
+
version: 4.0.0.pre4
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - '='
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 4.0.0.
|
60
|
+
version: 4.0.0.pre4
|
61
61
|
name: shoes-package
|
62
62
|
prerelease: false
|
63
63
|
type: :runtime
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
requirements:
|
66
66
|
- - '='
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 4.0.0.
|
68
|
+
version: 4.0.0.pre4
|
69
69
|
description: A JRuby and Swt backend for Shoes, the best little GUI toolkit for Ruby. Shoes makes building for Mac, Windows, and Linux super simple.
|
70
70
|
email:
|
71
71
|
- shoes@librelist.com
|
@@ -198,6 +198,7 @@ files:
|
|
198
198
|
- spec/shoes/swt/shared_examples/swt_app_context.rb
|
199
199
|
- spec/shoes/swt/shared_examples/visibility.rb
|
200
200
|
- spec/shoes/swt/shell_control_listener_spec.rb
|
201
|
+
- spec/shoes/swt/shoes_layout_spec.rb
|
201
202
|
- spec/shoes/swt/slot_spec.rb
|
202
203
|
- spec/shoes/swt/spec_helper.rb
|
203
204
|
- spec/shoes/swt/star_spec.rb
|
@@ -282,6 +283,7 @@ test_files:
|
|
282
283
|
- spec/shoes/swt/shared_examples/swt_app_context.rb
|
283
284
|
- spec/shoes/swt/shared_examples/visibility.rb
|
284
285
|
- spec/shoes/swt/shell_control_listener_spec.rb
|
286
|
+
- spec/shoes/swt/shoes_layout_spec.rb
|
285
287
|
- spec/shoes/swt/slot_spec.rb
|
286
288
|
- spec/shoes/swt/spec_helper.rb
|
287
289
|
- spec/shoes/swt/star_spec.rb
|