motion-kit 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +28 -8
- data/lib/{motion-kit → motion-kit-cocoa}/calculator/view_calculator.rb +0 -0
- data/lib/motion-kit-cocoa/constraints/constraint.rb +3 -1
- data/lib/motion-kit-cocoa/{layouts → helpers}/accessibility_compat.rb +0 -0
- data/lib/motion-kit-cocoa/{layouts → helpers}/cagradientlayer_helpers.rb +0 -0
- data/lib/motion-kit-cocoa/{layouts → helpers}/calayer_helpers.rb +0 -0
- data/lib/motion-kit-cocoa/{layouts → helpers}/sugarcube_compat.rb +0 -0
- data/lib/motion-kit-ios/{layouts → helpers}/constraints_helpers.rb +0 -0
- data/lib/motion-kit-ios/{layouts → helpers}/layout_device.rb +0 -0
- data/lib/motion-kit-ios/{layouts → helpers}/layout_orientation.rb +0 -0
- data/lib/motion-kit-ios/{layouts → helpers}/uibutton_helpers.rb +0 -0
- data/lib/motion-kit-ios/{layouts/uiview_layout_autoresizing.rb → helpers/uiview_autoresizing_helpers.rb} +0 -0
- data/lib/motion-kit-ios/{layouts/uiview_layout_constraints.rb → helpers/uiview_constraints_helpers.rb} +0 -0
- data/lib/motion-kit-ios/{layouts/uiview_layout_frame.rb → helpers/uiview_frame_helpers.rb} +0 -0
- data/lib/motion-kit-ios/{layouts/uiview_layout_gradient.rb → helpers/uiview_gradient_helpers.rb} +0 -0
- data/lib/motion-kit-ios/{layouts → helpers}/uiview_helpers.rb +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/constraints_helpers.rb +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nsmenu_extensions.rb +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nsmenu_helpers.rb +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nsmenuitem_extensions.rb +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nstablecolumn_helpers.rb +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nstableview_helpers.rb +0 -0
- data/lib/motion-kit-osx/{layouts/nsview_layout_autoresizing.rb → helpers/nsview_autoresizing_helpers.rb} +0 -0
- data/lib/motion-kit-osx/{layouts/nsview_layout_constraints.rb → helpers/nsview_constraints_helpers.rb} +0 -0
- data/lib/motion-kit-osx/{layouts/nsview_layout_frame.rb → helpers/nsview_frame_helpers.rb} +0 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nsview_helpers.rb +0 -0
- data/lib/motion-kit-osx/helpers/nswindow_frame_helpers.rb +361 -0
- data/lib/motion-kit-osx/{layouts → helpers}/nswindow_helpers.rb +0 -0
- data/lib/motion-kit/{layouts → helpers}/base_layout.rb +0 -0
- data/lib/motion-kit/{layouts → helpers}/base_layout_class_methods.rb +0 -0
- data/lib/motion-kit/{layouts → helpers}/parent.rb +0 -0
- data/lib/motion-kit/{layouts → helpers}/tree_layout.rb +21 -4
- data/lib/motion-kit/object.rb +11 -0
- data/lib/motion-kit/version.rb +1 -1
- data/spec/ios/layout_spec.rb +6 -6
- data/spec/ios/motion_kit_id_spec.rb +15 -0
- data/spec/ios/remove_layout_spec.rb +9 -5
- data/spec/osx/{frame_helper_spec.rb → nsview_frame_helper_spec.rb} +69 -69
- data/spec/osx/nswindow_frame_helper_spec.rb +1288 -0
- metadata +38 -34
- data/lib/motion-kit-osx/layouts/nswindow_frame.rb +0 -14
@@ -0,0 +1,1288 @@
|
|
1
|
+
describe 'Frame helpers' do
|
2
|
+
|
3
|
+
before do
|
4
|
+
@layout = TestEmptyLayout.new
|
5
|
+
@window = NSWindow.alloc.init
|
6
|
+
@window.setFrame([[0, 0], [500, 500]], display: true)
|
7
|
+
@window.title = NSBundle.mainBundle.infoDictionary['CFBundleName']
|
8
|
+
@layout.root = @window
|
9
|
+
|
10
|
+
@another_window = NSWindow.alloc.init
|
11
|
+
@another_window.setFrame([[200, 200], [200, 200]], display: true)
|
12
|
+
@another_window.title = NSBundle.mainBundle.infoDictionary['CFBundleName']
|
13
|
+
|
14
|
+
@screen_size = NSScreen.mainScreen.frame.size
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should support `x` method' do
|
18
|
+
@layout.context(@window) do
|
19
|
+
retval = @layout.x 1
|
20
|
+
retval.should == CGRectGetMinX(@window.frame)
|
21
|
+
@window.frame.origin.x.should == 1
|
22
|
+
|
23
|
+
retval = @layout.x '100% - 1'
|
24
|
+
retval.should == CGRectGetMinX(@window.frame)
|
25
|
+
@window.frame.origin.x.should == @screen_size.width - 1
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should support `left` method' do
|
30
|
+
@layout.context(@window) do
|
31
|
+
retval = @layout.left 1
|
32
|
+
retval.should == CGRectGetMinX(@window.frame)
|
33
|
+
@window.frame.origin.x.should == 1
|
34
|
+
|
35
|
+
retval = @layout.left '100% - 1'
|
36
|
+
retval.should == CGRectGetMinX(@window.frame)
|
37
|
+
@window.frame.origin.x.should == @screen_size.width - 1
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should support `right` method' do
|
42
|
+
@layout.context(@window) do
|
43
|
+
retval = @layout.right 1
|
44
|
+
retval.should == CGRectGetMaxX(@window.frame)
|
45
|
+
@window.frame.origin.x.should == 1 - @window.frame.size.width
|
46
|
+
|
47
|
+
retval = @layout.right '100% - 1'
|
48
|
+
retval.should == CGRectGetMaxX(@window.frame)
|
49
|
+
@window.frame.origin.x.should == @screen_size.width - 1 - @window.frame.size.width
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
it 'should support `center_x` method' do
|
54
|
+
@layout.context(@window) do
|
55
|
+
retval = @layout.center_x @window.frame.size.width / 2
|
56
|
+
retval.should == CGRectGetMidX(@window.frame)
|
57
|
+
@window.frame.origin.x.should == 0
|
58
|
+
|
59
|
+
retval = @layout.center_x '50%'
|
60
|
+
retval.should == CGRectGetMidX(@window.frame)
|
61
|
+
retval.should == @screen_size.width / 2
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should support `middle_x` method' do
|
66
|
+
@layout.context(@window) do
|
67
|
+
retval = @layout.middle_x @window.frame.size.width / 2
|
68
|
+
retval.should == CGRectGetMidX(@window.frame)
|
69
|
+
@window.frame.origin.x.should == 0
|
70
|
+
|
71
|
+
retval = @layout.middle_x '50%'
|
72
|
+
retval.should == CGRectGetMidX(@window.frame)
|
73
|
+
retval.should == @screen_size.width / 2
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'should support `y` method' do
|
78
|
+
@layout.context(@window) do
|
79
|
+
retval = @layout.y 1
|
80
|
+
retval.should == CGRectGetMinY(@window.frame)
|
81
|
+
@window.frame.origin.y.should == 1
|
82
|
+
|
83
|
+
retval = @layout.y '100% - 1'
|
84
|
+
retval.should == CGRectGetMinY(@window.frame)
|
85
|
+
@window.frame.origin.y.should == @screen_size.height - 1
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'should support `bottom` method' do
|
90
|
+
@layout.context(@window) do
|
91
|
+
retval = @layout.bottom 1
|
92
|
+
retval.should == CGRectGetMinY(@window.frame)
|
93
|
+
@window.frame.origin.y.should == 1
|
94
|
+
|
95
|
+
retval = @layout.bottom '100% - 1'
|
96
|
+
retval.should == CGRectGetMinY(@window.frame)
|
97
|
+
@window.frame.origin.y.should == @screen_size.height - 1
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'should support `top` method' do
|
102
|
+
@layout.context(@window) do
|
103
|
+
retval = @layout.top 1
|
104
|
+
retval.should == CGRectGetMaxY(@window.frame)
|
105
|
+
@window.frame.origin.y.should == 1 - @window.frame.size.height
|
106
|
+
|
107
|
+
retval = @layout.top '100% - 1'
|
108
|
+
retval.should == CGRectGetMaxY(@window.frame)
|
109
|
+
@window.frame.origin.y.should == @screen_size.height - 1 - @window.frame.size.height
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should support `center_y` method' do
|
114
|
+
@layout.context(@window) do
|
115
|
+
retval = @layout.center_y @window.frame.size.height / 2
|
116
|
+
retval.should == CGRectGetMidY(@window.frame)
|
117
|
+
@window.frame.origin.y.should == 0
|
118
|
+
|
119
|
+
retval = @layout.center_y '50%'
|
120
|
+
retval.should == CGRectGetMidY(@window.frame)
|
121
|
+
retval.should == @screen_size.height / 2
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
it 'should support `middle_y` method' do
|
126
|
+
@layout.context(@window) do
|
127
|
+
retval = @layout.middle_y @window.frame.size.height / 2
|
128
|
+
retval.should == CGRectGetMidY(@window.frame)
|
129
|
+
@window.frame.origin.y.should == 0
|
130
|
+
|
131
|
+
retval = @layout.middle_y '50%'
|
132
|
+
retval.should == CGRectGetMidY(@window.frame)
|
133
|
+
retval.should == @screen_size.height / 2
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'should support `width` method' do
|
138
|
+
@layout.context(@window) do
|
139
|
+
retval = @layout.width 1
|
140
|
+
retval.should == CGRectGetWidth(@window.frame)
|
141
|
+
@window.frame.size.width.should == 1
|
142
|
+
|
143
|
+
retval = @layout.width '100% - 1'
|
144
|
+
retval.should == CGRectGetWidth(@window.frame)
|
145
|
+
@window.frame.size.width.should == @screen_size.width - 1
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
it 'should support `w` method' do
|
150
|
+
@layout.context(@window) do
|
151
|
+
retval = @layout.w 1
|
152
|
+
retval.should == CGRectGetWidth(@window.frame)
|
153
|
+
@window.frame.size.width.should == 1
|
154
|
+
|
155
|
+
retval = @layout.w '100% - 1'
|
156
|
+
retval.should == CGRectGetWidth(@window.frame)
|
157
|
+
@window.frame.size.width.should == @screen_size.width - 1
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'should support `height` method' do
|
162
|
+
@layout.context(@window) do
|
163
|
+
retval = @layout.height 1
|
164
|
+
retval.should == CGRectGetHeight(@window.frame)
|
165
|
+
@window.frame.size.height.should == 1
|
166
|
+
|
167
|
+
retval = @layout.height '100% - 1'
|
168
|
+
retval.should == CGRectGetHeight(@window.frame)
|
169
|
+
@window.frame.size.height.should == @screen_size.height - 1
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'should support `h` method' do
|
174
|
+
@layout.context(@window) do
|
175
|
+
retval = @layout.h 1
|
176
|
+
retval.should == CGRectGetHeight(@window.frame)
|
177
|
+
@window.frame.size.height.should == 1
|
178
|
+
|
179
|
+
retval = @layout.h '100% - 1'
|
180
|
+
retval.should == CGRectGetHeight(@window.frame)
|
181
|
+
@window.frame.size.height.should == @screen_size.height - 1
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
it 'should support `origin([])` method' do
|
186
|
+
@layout.context(@window) do
|
187
|
+
retval = @layout.origin [1, 2]
|
188
|
+
retval.should == @window.frame.origin
|
189
|
+
@window.frame.origin.x.should == 1
|
190
|
+
@window.frame.origin.y.should == 2
|
191
|
+
|
192
|
+
retval = @layout.origin ['100% - 1', '100% - 2']
|
193
|
+
retval.should == @window.frame.origin
|
194
|
+
@window.frame.origin.x.should == @screen_size.width - 1
|
195
|
+
@window.frame.origin.y.should == @screen_size.height - 2
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'should support `origin({})` method' do
|
200
|
+
@layout.context(@window) do
|
201
|
+
retval = @layout.origin x: 1, y: 2
|
202
|
+
retval.should == @window.frame.origin
|
203
|
+
@window.frame.origin.x.should == 1
|
204
|
+
@window.frame.origin.y.should == 2
|
205
|
+
|
206
|
+
retval = @layout.origin x: '100% - 1', y: '100% - 2'
|
207
|
+
retval.should == @window.frame.origin
|
208
|
+
@window.frame.origin.x.should == @screen_size.width - 1
|
209
|
+
@window.frame.origin.y.should == @screen_size.height - 2
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
it 'should support `origin({relative: true})` method' do
|
214
|
+
@layout.context(@window) do
|
215
|
+
retval = @layout.origin x: 0, y: 0, right: 1, up: 2, relative: true
|
216
|
+
retval.should == @window.frame.origin
|
217
|
+
@window.frame.origin.x.should == 1
|
218
|
+
@window.frame.origin.y.should == 2
|
219
|
+
|
220
|
+
retval = @layout.origin x: '100%', y: '100%', left: 1, down: 2, relative: true
|
221
|
+
retval.should == @window.frame.origin
|
222
|
+
@window.frame.origin.x.should == @screen_size.width - 1
|
223
|
+
@window.frame.origin.y.should == @screen_size.height - 2
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
it 'should support `center([])` method' do
|
228
|
+
@layout.context(@window) do
|
229
|
+
retval = @layout.center [@window.frame.size.width / 2, @window.frame.size.height / 2]
|
230
|
+
retval.x.should == CGRectGetMidX(@window.frame)
|
231
|
+
retval.y.should == CGRectGetMidY(@window.frame)
|
232
|
+
@window.frame.origin.x.should == 0
|
233
|
+
@window.frame.origin.y.should == 0
|
234
|
+
|
235
|
+
retval = @layout.center ['50%', '50%']
|
236
|
+
retval.x.should == CGRectGetMidX(@window.frame)
|
237
|
+
retval.y.should == CGRectGetMidY(@window.frame)
|
238
|
+
retval.x.should == @screen_size.width / 2
|
239
|
+
retval.y.should == @screen_size.height / 2
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
243
|
+
it 'should support `center({})` method' do
|
244
|
+
@layout.context(@window) do
|
245
|
+
retval = @layout.center x: @window.frame.size.width / 2, y: @window.frame.size.height / 2
|
246
|
+
retval.x.should == CGRectGetMidX(@window.frame)
|
247
|
+
retval.y.should == CGRectGetMidY(@window.frame)
|
248
|
+
@window.frame.origin.x.should == 0
|
249
|
+
@window.frame.origin.y.should == 0
|
250
|
+
|
251
|
+
retval = @layout.center x: '50%', y: '50%'
|
252
|
+
retval.x.should == CGRectGetMidX(@window.frame)
|
253
|
+
retval.y.should == CGRectGetMidY(@window.frame)
|
254
|
+
retval.x.should == @screen_size.width / 2
|
255
|
+
retval.y.should == @screen_size.height / 2
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
it 'should support `center({relative: true})` method' do
|
260
|
+
@layout.context(@window) do
|
261
|
+
retval = @layout.center x: @window.frame.size.width / 2, y: @window.frame.size.height / 2, right: 1, up: 2, relative: true
|
262
|
+
retval.x.should == CGRectGetMidX(@window.frame)
|
263
|
+
retval.y.should == CGRectGetMidY(@window.frame)
|
264
|
+
@window.frame.origin.x.should == 1
|
265
|
+
@window.frame.origin.y.should == 2
|
266
|
+
|
267
|
+
retval = @layout.center x: '50%', y: '50%', left: 1, down: 2, relative: true
|
268
|
+
retval.x.should == CGRectGetMidX(@window.frame)
|
269
|
+
retval.y.should == CGRectGetMidY(@window.frame)
|
270
|
+
retval.x.should == @screen_size.width / 2 - 1
|
271
|
+
retval.y.should == @screen_size.height / 2 - 2
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
it 'should support `size` method' do
|
276
|
+
@layout.context(@window) do
|
277
|
+
retval = @layout.size [1, 2]
|
278
|
+
retval.should == @window.frame.size
|
279
|
+
@window.frame.size.width.should == 1
|
280
|
+
@window.frame.size.height.should == 2
|
281
|
+
|
282
|
+
retval = @layout.size ['100% - 1', '100% - 2']
|
283
|
+
retval.should == @window.frame.size
|
284
|
+
@window.frame.size.width.should == @screen_size.width - 1
|
285
|
+
@window.frame.size.height.should == @screen_size.height - 2
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
it 'should support `frame` arrays [[x, y], [w, h]]' do
|
290
|
+
@layout.context(@window) do
|
291
|
+
retval = @layout.frame [[1, 2], [3, 4]]
|
292
|
+
retval.should == @window.frame
|
293
|
+
end
|
294
|
+
@window.frame.origin.x.should == 1
|
295
|
+
@window.frame.origin.y.should == 2
|
296
|
+
@window.frame.size.width.should == 3
|
297
|
+
@window.frame.size.height.should == 4
|
298
|
+
end
|
299
|
+
|
300
|
+
it 'should support `frame` arrays [x, y, w, h]' do
|
301
|
+
@layout.context(@window) do
|
302
|
+
retval = @layout.frame [1, 2, 3, 4]
|
303
|
+
retval.should == @window.frame
|
304
|
+
end
|
305
|
+
@window.frame.origin.x.should == 1
|
306
|
+
@window.frame.origin.y.should == 2
|
307
|
+
@window.frame.size.width.should == 3
|
308
|
+
@window.frame.size.height.should == 4
|
309
|
+
end
|
310
|
+
|
311
|
+
it 'should support `frame :full`' do
|
312
|
+
@layout.context(@window) do
|
313
|
+
retval = @layout.frame :full
|
314
|
+
retval.should == @window.frame
|
315
|
+
end
|
316
|
+
@window.frame.origin.x.should == 0
|
317
|
+
@window.frame.origin.y.should == 0
|
318
|
+
@window.frame.size.width.should == @screen_size.width
|
319
|
+
@window.frame.size.height.should == @screen_size.height
|
320
|
+
end
|
321
|
+
|
322
|
+
it 'should support `frame :center`' do
|
323
|
+
@layout.context(@window) do
|
324
|
+
retval = @layout.frame :center
|
325
|
+
retval.should == @window.frame
|
326
|
+
end
|
327
|
+
@window.frame.origin.x.should == (@screen_size.width - @window.frame.size.width) / 2
|
328
|
+
@window.frame.origin.y.should == (@screen_size.height - @window.frame.size.height) / 2
|
329
|
+
@window.frame.size.width.should == @window.frame.size.width
|
330
|
+
@window.frame.size.height.should == @window.frame.size.height
|
331
|
+
end
|
332
|
+
|
333
|
+
it 'should support setting the frame via `from_bottom_left`' do
|
334
|
+
@layout.context(@window) do
|
335
|
+
retval = @layout.frame @layout.from_bottom_left()
|
336
|
+
retval.should == @window.frame
|
337
|
+
end
|
338
|
+
@window.frame.origin.x.should == 0
|
339
|
+
@window.frame.origin.y.should == 0
|
340
|
+
@window.frame.size.width.should == @window.frame.size.width
|
341
|
+
@window.frame.size.height.should == @window.frame.size.height
|
342
|
+
end
|
343
|
+
|
344
|
+
it 'should support setting the frame via `from_bottom_left(width:height:)`' do
|
345
|
+
@layout.context(@window) do
|
346
|
+
retval = @layout.frame @layout.from_bottom_left(width: 10, height: 20)
|
347
|
+
retval.should == @window.frame
|
348
|
+
end
|
349
|
+
@window.frame.origin.x.should == 0
|
350
|
+
@window.frame.origin.y.should == 0
|
351
|
+
@window.frame.size.width.should == 10
|
352
|
+
@window.frame.size.height.should == 20
|
353
|
+
end
|
354
|
+
|
355
|
+
it 'should support setting the frame via `from_bottom_left(x:y:width:height:)`' do
|
356
|
+
@layout.context(@window) do
|
357
|
+
retval = @layout.frame @layout.from_bottom_left(x: 10, y: 20, width: 22, height: 12)
|
358
|
+
retval.should == @window.frame
|
359
|
+
end
|
360
|
+
@window.frame.origin.x.should == 10
|
361
|
+
@window.frame.origin.y.should == 20
|
362
|
+
@window.frame.size.width.should == 22
|
363
|
+
@window.frame.size.height.should == 12
|
364
|
+
end
|
365
|
+
|
366
|
+
it 'should support setting the frame via `from_bottom_left(right:up:width:height:)`' do
|
367
|
+
@layout.context(@window) do
|
368
|
+
retval = @layout.frame @layout.from_bottom_left(right: 10, up: 20, width: 22, height: 12)
|
369
|
+
retval.should == @window.frame
|
370
|
+
end
|
371
|
+
@window.frame.origin.x.should == 10
|
372
|
+
@window.frame.origin.y.should == 20
|
373
|
+
@window.frame.size.width.should == 22
|
374
|
+
@window.frame.size.height.should == 12
|
375
|
+
end
|
376
|
+
|
377
|
+
it 'should support setting the frame via `from_bottom_left(left:down:width:height:)`' do
|
378
|
+
@layout.context(@window) do
|
379
|
+
retval = @layout.frame @layout.from_bottom_left(left: 10, down: 20, width: 22, height: 12)
|
380
|
+
retval.should == @window.frame
|
381
|
+
end
|
382
|
+
@window.frame.origin.x.should == -10
|
383
|
+
@window.frame.origin.y.should == -20
|
384
|
+
@window.frame.size.width.should == 22
|
385
|
+
@window.frame.size.height.should == 12
|
386
|
+
end
|
387
|
+
|
388
|
+
# ============================================================================
|
389
|
+
|
390
|
+
it 'should support setting the frame via `from_bottom_left(window)`' do
|
391
|
+
@layout.context(@window) do
|
392
|
+
retval = @layout.frame @layout.from_bottom_left(@another_window, x: 1, y: 1)
|
393
|
+
retval.should == @window.frame
|
394
|
+
end
|
395
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 1
|
396
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + 1
|
397
|
+
@window.frame.size.width.should == @window.frame.size.width
|
398
|
+
@window.frame.size.height.should == @window.frame.size.height
|
399
|
+
end
|
400
|
+
|
401
|
+
it 'should support setting the frame via `from_bottom`' do
|
402
|
+
@layout.context(@window) do
|
403
|
+
retval = @layout.frame @layout.from_bottom()
|
404
|
+
retval.should == @window.frame
|
405
|
+
end
|
406
|
+
@window.frame.origin.x.should == (@screen_size.width - @window.frame.size.width) / 2
|
407
|
+
@window.frame.origin.y.should == 0
|
408
|
+
@window.frame.size.width.should == @window.frame.size.width
|
409
|
+
@window.frame.size.height.should == @window.frame.size.height
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'should support setting the frame via `from_bottom(width:height:)`' do
|
413
|
+
@layout.context(@window) do
|
414
|
+
retval = @layout.frame @layout.from_bottom(width: 10, height: 20)
|
415
|
+
retval.should == @window.frame
|
416
|
+
end
|
417
|
+
@window.frame.origin.x.should == (@screen_size.width - 10) / 2
|
418
|
+
@window.frame.origin.y.should == 0
|
419
|
+
@window.frame.size.width.should == 10
|
420
|
+
@window.frame.size.height.should == 20
|
421
|
+
end
|
422
|
+
|
423
|
+
it 'should support setting the frame via `from_bottom(x:y:width:height:)`' do
|
424
|
+
@layout.context(@window) do
|
425
|
+
retval = @layout.frame @layout.from_bottom(x: 10, y: 20, width: 22, height: 12)
|
426
|
+
retval.should == @window.frame
|
427
|
+
end
|
428
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 + 10
|
429
|
+
@window.frame.origin.y.should == 20
|
430
|
+
@window.frame.size.width.should == 22
|
431
|
+
@window.frame.size.height.should == 12
|
432
|
+
end
|
433
|
+
|
434
|
+
it 'should support setting the frame via `from_bottom(right:up:width:height:)`' do
|
435
|
+
@layout.context(@window) do
|
436
|
+
retval = @layout.frame @layout.from_bottom(right: 10, up: 20, width: 22, height: 12)
|
437
|
+
retval.should == @window.frame
|
438
|
+
end
|
439
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 + 10
|
440
|
+
@window.frame.origin.y.should == 20
|
441
|
+
@window.frame.size.width.should == 22
|
442
|
+
@window.frame.size.height.should == 12
|
443
|
+
end
|
444
|
+
|
445
|
+
it 'should support setting the frame via `from_bottom(left:down:width:height:)`' do
|
446
|
+
@layout.context(@window) do
|
447
|
+
retval = @layout.frame @layout.from_bottom(left: 10, down: 20, width: 22, height: 12)
|
448
|
+
retval.should == @window.frame
|
449
|
+
end
|
450
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 - 10
|
451
|
+
@window.frame.origin.y.should == -20
|
452
|
+
@window.frame.size.width.should == 22
|
453
|
+
@window.frame.size.height.should == 12
|
454
|
+
end
|
455
|
+
|
456
|
+
it 'should support setting the frame via `from_bottom(window)`' do
|
457
|
+
@layout.context(@window) do
|
458
|
+
retval = @layout.frame @layout.from_bottom(@another_window, x: 1, y: 1)
|
459
|
+
retval.should == @window.frame
|
460
|
+
end
|
461
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + (@another_window.frame.size.width - @window.frame.size.width) / 2 + 1
|
462
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + 1
|
463
|
+
@window.frame.size.width.should == @window.frame.size.width
|
464
|
+
@window.frame.size.height.should == @window.frame.size.height
|
465
|
+
end
|
466
|
+
|
467
|
+
it 'should support setting the frame via `from_bottom_right`' do
|
468
|
+
@layout.context(@window) do
|
469
|
+
retval = @layout.frame @layout.from_bottom_right()
|
470
|
+
retval.should == @window.frame
|
471
|
+
end
|
472
|
+
@window.frame.origin.x.should == @screen_size.width - @window.frame.size.width
|
473
|
+
@window.frame.origin.y.should == 0
|
474
|
+
@window.frame.size.width.should == @window.frame.size.width
|
475
|
+
@window.frame.size.height.should == @window.frame.size.height
|
476
|
+
end
|
477
|
+
|
478
|
+
it 'should support setting the frame via `from_bottom_right(width:height:)`' do
|
479
|
+
@layout.context(@window) do
|
480
|
+
retval = @layout.frame @layout.from_bottom_right(width: 10, height: 20)
|
481
|
+
retval.should == @window.frame
|
482
|
+
end
|
483
|
+
@window.frame.origin.x.should == @screen_size.width - 10
|
484
|
+
@window.frame.origin.y.should == 0
|
485
|
+
@window.frame.size.width.should == 10
|
486
|
+
@window.frame.size.height.should == 20
|
487
|
+
end
|
488
|
+
|
489
|
+
it 'should support setting the frame via `from_bottom_right(x:y:width:height:)`' do
|
490
|
+
@layout.context(@window) do
|
491
|
+
retval = @layout.frame @layout.from_bottom_right(x: 10, y: 20, width: 22, height: 12)
|
492
|
+
retval.should == @window.frame
|
493
|
+
end
|
494
|
+
@window.frame.origin.x.should == @screen_size.width - 22 + 10
|
495
|
+
@window.frame.origin.y.should == 20
|
496
|
+
@window.frame.size.width.should == 22
|
497
|
+
@window.frame.size.height.should == 12
|
498
|
+
end
|
499
|
+
|
500
|
+
it 'should support setting the frame via `from_bottom_right(right:up:width:height:)`' do
|
501
|
+
@layout.context(@window) do
|
502
|
+
retval = @layout.frame @layout.from_bottom_right(right: 10, up: 20, width: 22, height: 12)
|
503
|
+
retval.should == @window.frame
|
504
|
+
end
|
505
|
+
@window.frame.origin.x.should == @screen_size.width - 22 + 10
|
506
|
+
@window.frame.origin.y.should == 20
|
507
|
+
@window.frame.size.width.should == 22
|
508
|
+
@window.frame.size.height.should == 12
|
509
|
+
end
|
510
|
+
|
511
|
+
it 'should support setting the frame via `from_bottom_right(left:down:width:height:)`' do
|
512
|
+
@layout.context(@window) do
|
513
|
+
retval = @layout.frame @layout.from_bottom_right(left: 10, down: 20, width: 22, height: 12)
|
514
|
+
retval.should == @window.frame
|
515
|
+
end
|
516
|
+
@window.frame.origin.x.should == @screen_size.width - 22 - 10
|
517
|
+
@window.frame.origin.y.should == -20
|
518
|
+
@window.frame.size.width.should == 22
|
519
|
+
@window.frame.size.height.should == 12
|
520
|
+
end
|
521
|
+
|
522
|
+
it 'should support setting the frame via `from_bottom_right(window)`' do
|
523
|
+
@layout.context(@window) do
|
524
|
+
retval = @layout.frame @layout.from_bottom_right(@another_window, x: 1, y: 1)
|
525
|
+
retval.should == @window.frame
|
526
|
+
end
|
527
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width - @window.frame.size.width + 1
|
528
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + 1
|
529
|
+
@window.frame.size.width.should == @window.frame.size.width
|
530
|
+
@window.frame.size.height.should == @window.frame.size.height
|
531
|
+
end
|
532
|
+
|
533
|
+
it 'should support setting the frame via `from_left`' do
|
534
|
+
@layout.context(@window) do
|
535
|
+
retval = @layout.frame @layout.from_left()
|
536
|
+
retval.should == @window.frame
|
537
|
+
end
|
538
|
+
@window.frame.origin.x.should == 0
|
539
|
+
@window.frame.origin.y.should == (@screen_size.height - @window.frame.size.height) / 2
|
540
|
+
@window.frame.size.width.should == @window.frame.size.width
|
541
|
+
@window.frame.size.height.should == @window.frame.size.height
|
542
|
+
end
|
543
|
+
|
544
|
+
it 'should support setting the frame via `from_left(width:height:)`' do
|
545
|
+
@layout.context(@window) do
|
546
|
+
retval = @layout.frame @layout.from_left(width: 10, height: 20)
|
547
|
+
retval.should == @window.frame
|
548
|
+
end
|
549
|
+
@window.frame.origin.x.should == 0
|
550
|
+
@window.frame.origin.y.should == (@screen_size.height - 20) / 2
|
551
|
+
@window.frame.size.width.should == 10
|
552
|
+
@window.frame.size.height.should == 20
|
553
|
+
end
|
554
|
+
|
555
|
+
it 'should support setting the frame via `from_left(x:y:width:height:)`' do
|
556
|
+
@layout.context(@window) do
|
557
|
+
retval = @layout.frame @layout.from_left(x: 10, y: 20, width: 22, height: 12)
|
558
|
+
retval.should == @window.frame
|
559
|
+
end
|
560
|
+
@window.frame.origin.x.should == 10
|
561
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 + 20
|
562
|
+
@window.frame.size.width.should == 22
|
563
|
+
@window.frame.size.height.should == 12
|
564
|
+
end
|
565
|
+
|
566
|
+
it 'should support setting the frame via `from_left(right:up:width:height:)`' do
|
567
|
+
@layout.context(@window) do
|
568
|
+
retval = @layout.frame @layout.from_left(right: 10, up: 20, width: 22, height: 12)
|
569
|
+
retval.should == @window.frame
|
570
|
+
end
|
571
|
+
@window.frame.origin.x.should == 10
|
572
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 + 20
|
573
|
+
@window.frame.size.width.should == 22
|
574
|
+
@window.frame.size.height.should == 12
|
575
|
+
end
|
576
|
+
|
577
|
+
it 'should support setting the frame via `from_left(left:down:width:height:)`' do
|
578
|
+
@layout.context(@window) do
|
579
|
+
retval = @layout.frame @layout.from_left(left: 10, down: 20, width: 22, height: 12)
|
580
|
+
retval.should == @window.frame
|
581
|
+
end
|
582
|
+
@window.frame.origin.x.should == -10
|
583
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 - 20
|
584
|
+
@window.frame.size.width.should == 22
|
585
|
+
@window.frame.size.height.should == 12
|
586
|
+
end
|
587
|
+
|
588
|
+
it 'should support setting the frame via `from_left(window)`' do
|
589
|
+
@layout.context(@window) do
|
590
|
+
retval = @layout.frame @layout.from_left(@another_window, x: 1, y: 1)
|
591
|
+
retval.should == @window.frame
|
592
|
+
end
|
593
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 1
|
594
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + (@another_window.frame.size.height - @window.frame.size.height) / 2 + 1
|
595
|
+
@window.frame.size.width.should == @window.frame.size.width
|
596
|
+
@window.frame.size.height.should == @window.frame.size.height
|
597
|
+
end
|
598
|
+
|
599
|
+
it 'should support setting the frame via `from_center`' do
|
600
|
+
@layout.context(@window) do
|
601
|
+
retval = @layout.frame @layout.from_center()
|
602
|
+
retval.should == @window.frame
|
603
|
+
end
|
604
|
+
@window.frame.origin.x.should == (@screen_size.width - @window.frame.size.width) / 2
|
605
|
+
@window.frame.origin.y.should == (@screen_size.height - @window.frame.size.height) / 2
|
606
|
+
@window.frame.size.width.should == @window.frame.size.width
|
607
|
+
@window.frame.size.height.should == @window.frame.size.height
|
608
|
+
end
|
609
|
+
|
610
|
+
it 'should support setting the frame via `from_center(width:height:)`' do
|
611
|
+
@layout.context(@window) do
|
612
|
+
retval = @layout.frame @layout.from_center(width: 10, height: 20)
|
613
|
+
retval.should == @window.frame
|
614
|
+
end
|
615
|
+
@window.frame.origin.x.should == (@screen_size.width - 10) / 2
|
616
|
+
@window.frame.origin.y.should == (@screen_size.height - 20) / 2
|
617
|
+
@window.frame.size.width.should == 10
|
618
|
+
@window.frame.size.height.should == 20
|
619
|
+
end
|
620
|
+
|
621
|
+
it 'should support setting the frame via `from_center(x:y:width:height:)`' do
|
622
|
+
@layout.context(@window) do
|
623
|
+
retval = @layout.frame @layout.from_center(x: 10, y: 20, width: 22, height: 12)
|
624
|
+
retval.should == @window.frame
|
625
|
+
end
|
626
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 + 10
|
627
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 + 20
|
628
|
+
@window.frame.size.width.should == 22
|
629
|
+
@window.frame.size.height.should == 12
|
630
|
+
end
|
631
|
+
|
632
|
+
it 'should support setting the frame via `from_center(right:up:width:height:)`' do
|
633
|
+
@layout.context(@window) do
|
634
|
+
retval = @layout.frame @layout.from_center(right: 10, up: 20, width: 22, height: 12)
|
635
|
+
retval.should == @window.frame
|
636
|
+
end
|
637
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 + 10
|
638
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 + 20
|
639
|
+
@window.frame.size.width.should == 22
|
640
|
+
@window.frame.size.height.should == 12
|
641
|
+
end
|
642
|
+
|
643
|
+
it 'should support setting the frame via `from_center(left:down:width:height:)`' do
|
644
|
+
@layout.context(@window) do
|
645
|
+
retval = @layout.frame @layout.from_center(left: 10, down: 20, width: 22, height: 12)
|
646
|
+
retval.should == @window.frame
|
647
|
+
end
|
648
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 - 10
|
649
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 - 20
|
650
|
+
@window.frame.size.width.should == 22
|
651
|
+
@window.frame.size.height.should == 12
|
652
|
+
end
|
653
|
+
|
654
|
+
it 'should support setting the frame via `from_center(window)`' do
|
655
|
+
@layout.context(@window) do
|
656
|
+
retval = @layout.frame @layout.from_center(@another_window, x: 1, y: 1)
|
657
|
+
retval.should == @window.frame
|
658
|
+
end
|
659
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + (@another_window.frame.size.width - @window.frame.size.width) / 2 + 1
|
660
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + (@another_window.frame.size.height - @window.frame.size.height) / 2 + 1
|
661
|
+
@window.frame.size.width.should == @window.frame.size.width
|
662
|
+
@window.frame.size.height.should == @window.frame.size.height
|
663
|
+
end
|
664
|
+
|
665
|
+
it 'should support setting the frame via `from_right`' do
|
666
|
+
@layout.context(@window) do
|
667
|
+
retval = @layout.frame @layout.from_right()
|
668
|
+
retval.should == @window.frame
|
669
|
+
end
|
670
|
+
@window.frame.origin.x.should == @screen_size.width - @window.frame.size.width
|
671
|
+
@window.frame.origin.y.should == (@screen_size.height - @window.frame.size.height) / 2
|
672
|
+
@window.frame.size.width.should == @window.frame.size.width
|
673
|
+
@window.frame.size.height.should == @window.frame.size.height
|
674
|
+
end
|
675
|
+
|
676
|
+
it 'should support setting the frame via `from_right(width:height:)`' do
|
677
|
+
@layout.context(@window) do
|
678
|
+
retval = @layout.frame @layout.from_right(width: 10, height: 20)
|
679
|
+
retval.should == @window.frame
|
680
|
+
end
|
681
|
+
@window.frame.origin.x.should == @screen_size.width - 10
|
682
|
+
@window.frame.origin.y.should == (@screen_size.height - 20) / 2
|
683
|
+
@window.frame.size.width.should == 10
|
684
|
+
@window.frame.size.height.should == 20
|
685
|
+
end
|
686
|
+
|
687
|
+
it 'should support setting the frame via `from_right(x:y:width:height:)`' do
|
688
|
+
@layout.context(@window) do
|
689
|
+
retval = @layout.frame @layout.from_right(x: 10, y: 20, width: 22, height: 12)
|
690
|
+
retval.should == @window.frame
|
691
|
+
end
|
692
|
+
@window.frame.origin.x.should == @screen_size.width - 22 + 10
|
693
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 + 20
|
694
|
+
@window.frame.size.width.should == 22
|
695
|
+
@window.frame.size.height.should == 12
|
696
|
+
end
|
697
|
+
|
698
|
+
it 'should support setting the frame via `from_right(right:up:width:height:)`' do
|
699
|
+
@layout.context(@window) do
|
700
|
+
retval = @layout.frame @layout.from_right(right: 10, up: 20, width: 22, height: 12)
|
701
|
+
retval.should == @window.frame
|
702
|
+
end
|
703
|
+
@window.frame.origin.x.should == @screen_size.width - 22 + 10
|
704
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 + 20
|
705
|
+
@window.frame.size.width.should == 22
|
706
|
+
@window.frame.size.height.should == 12
|
707
|
+
end
|
708
|
+
|
709
|
+
it 'should support setting the frame via `from_right(left:down:width:height:)`' do
|
710
|
+
@layout.context(@window) do
|
711
|
+
retval = @layout.frame @layout.from_right(left: 10, down: 20, width: 22, height: 12)
|
712
|
+
retval.should == @window.frame
|
713
|
+
end
|
714
|
+
@window.frame.origin.x.should == @screen_size.width - 22 - 10
|
715
|
+
@window.frame.origin.y.should == (@screen_size.height - 12) / 2 - 20
|
716
|
+
@window.frame.size.width.should == 22
|
717
|
+
@window.frame.size.height.should == 12
|
718
|
+
end
|
719
|
+
|
720
|
+
it 'should support setting the frame via `from_right(window)`' do
|
721
|
+
@layout.context(@window) do
|
722
|
+
retval = @layout.frame @layout.from_right(@another_window, x: 1, y: 1)
|
723
|
+
retval.should == @window.frame
|
724
|
+
end
|
725
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width - @window.frame.size.width + 1
|
726
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + (@another_window.frame.size.height - @window.frame.size.height) / 2 + 1
|
727
|
+
@window.frame.size.width.should == @window.frame.size.width
|
728
|
+
@window.frame.size.height.should == @window.frame.size.height
|
729
|
+
end
|
730
|
+
|
731
|
+
it 'should support setting the frame via `from_top_left`' do
|
732
|
+
@layout.context(@window) do
|
733
|
+
retval = @layout.frame @layout.from_top_left()
|
734
|
+
retval.should == @window.frame
|
735
|
+
end
|
736
|
+
@window.frame.origin.x.should == 0
|
737
|
+
@window.frame.origin.y.should == @screen_size.height - @window.frame.size.height
|
738
|
+
@window.frame.size.width.should == @window.frame.size.width
|
739
|
+
@window.frame.size.height.should == @window.frame.size.height
|
740
|
+
end
|
741
|
+
|
742
|
+
it 'should support setting the frame via `from_top_left(width:height:)`' do
|
743
|
+
@layout.context(@window) do
|
744
|
+
retval = @layout.frame @layout.from_top_left(width: 10, height: 20)
|
745
|
+
retval.should == @window.frame
|
746
|
+
end
|
747
|
+
@window.frame.origin.x.should == 0
|
748
|
+
@window.frame.origin.y.should == @screen_size.height - 20
|
749
|
+
@window.frame.size.width.should == 10
|
750
|
+
@window.frame.size.height.should == 20
|
751
|
+
end
|
752
|
+
|
753
|
+
it 'should support setting the frame via `from_top_left(x:y:width:height:)`' do
|
754
|
+
@layout.context(@window) do
|
755
|
+
retval = @layout.frame @layout.from_top_left(x: 10, y: 20, width: 22, height: 12)
|
756
|
+
retval.should == @window.frame
|
757
|
+
end
|
758
|
+
@window.frame.origin.x.should == 10
|
759
|
+
@window.frame.origin.y.should == @screen_size.height - 12 + 20
|
760
|
+
@window.frame.size.width.should == 22
|
761
|
+
@window.frame.size.height.should == 12
|
762
|
+
end
|
763
|
+
|
764
|
+
it 'should support setting the frame via `from_top_left(right:up:width:height:)`' do
|
765
|
+
@layout.context(@window) do
|
766
|
+
retval = @layout.frame @layout.from_top_left(right: 10, up: 20, width: 22, height: 12)
|
767
|
+
retval.should == @window.frame
|
768
|
+
end
|
769
|
+
@window.frame.origin.x.should == 10
|
770
|
+
@window.frame.origin.y.should == @screen_size.height - 12 + 20
|
771
|
+
@window.frame.size.width.should == 22
|
772
|
+
@window.frame.size.height.should == 12
|
773
|
+
end
|
774
|
+
|
775
|
+
it 'should support setting the frame via `from_top_left(left:down:width:height:)`' do
|
776
|
+
@layout.context(@window) do
|
777
|
+
retval = @layout.frame @layout.from_top_left(left: 10, down: 20, width: 22, height: 12)
|
778
|
+
retval.should == @window.frame
|
779
|
+
end
|
780
|
+
@window.frame.origin.x.should == -10
|
781
|
+
@window.frame.origin.y.should == @screen_size.height - 12 - 20
|
782
|
+
@window.frame.size.width.should == 22
|
783
|
+
@window.frame.size.height.should == 12
|
784
|
+
end
|
785
|
+
|
786
|
+
it 'should support setting the frame via `from_top_left(window)`' do
|
787
|
+
@layout.context(@window) do
|
788
|
+
retval = @layout.frame @layout.from_top_left(@another_window, x: 1, y: 1)
|
789
|
+
retval.should == @window.frame
|
790
|
+
end
|
791
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 1
|
792
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height - @window.frame.size.height + 1
|
793
|
+
@window.frame.size.width.should == @window.frame.size.width
|
794
|
+
@window.frame.size.height.should == @window.frame.size.height
|
795
|
+
end
|
796
|
+
|
797
|
+
it 'should support setting the frame via `from_top`' do
|
798
|
+
@layout.context(@window) do
|
799
|
+
retval = @layout.frame @layout.from_top()
|
800
|
+
retval.should == @window.frame
|
801
|
+
end
|
802
|
+
@window.frame.origin.x.should == (@screen_size.width - @window.frame.size.width) / 2
|
803
|
+
@window.frame.origin.y.should == @screen_size.height - @window.frame.size.height
|
804
|
+
@window.frame.size.width.should == @window.frame.size.width
|
805
|
+
@window.frame.size.height.should == @window.frame.size.height
|
806
|
+
end
|
807
|
+
|
808
|
+
it 'should support setting the frame via `from_top(width:height:)`' do
|
809
|
+
@layout.context(@window) do
|
810
|
+
retval = @layout.frame @layout.from_top(width: 10, height: 20)
|
811
|
+
retval.should == @window.frame
|
812
|
+
end
|
813
|
+
@window.frame.origin.x.should == (@screen_size.width - 10) / 2
|
814
|
+
@window.frame.origin.y.should == @screen_size.height - 20
|
815
|
+
@window.frame.size.width.should == 10
|
816
|
+
@window.frame.size.height.should == 20
|
817
|
+
end
|
818
|
+
|
819
|
+
it 'should support setting the frame via `from_top(x:y:width:height:)`' do
|
820
|
+
@layout.context(@window) do
|
821
|
+
retval = @layout.frame @layout.from_top(x: 10, y: 20, width: 22, height: 12)
|
822
|
+
retval.should == @window.frame
|
823
|
+
end
|
824
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 + 10
|
825
|
+
@window.frame.origin.y.should == @screen_size.height - 12 + 20
|
826
|
+
@window.frame.size.width.should == 22
|
827
|
+
@window.frame.size.height.should == 12
|
828
|
+
end
|
829
|
+
|
830
|
+
it 'should support setting the frame via `from_top(right:up:width:height:)`' do
|
831
|
+
@layout.context(@window) do
|
832
|
+
retval = @layout.frame @layout.from_top(right: 10, up: 20, width: 22, height: 12)
|
833
|
+
retval.should == @window.frame
|
834
|
+
end
|
835
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 + 10
|
836
|
+
@window.frame.origin.y.should == @screen_size.height - 12 + 20
|
837
|
+
@window.frame.size.width.should == 22
|
838
|
+
@window.frame.size.height.should == 12
|
839
|
+
end
|
840
|
+
|
841
|
+
it 'should support setting the frame via `from_top(left:down:width:height:)`' do
|
842
|
+
@layout.context(@window) do
|
843
|
+
retval = @layout.frame @layout.from_top(left: 10, down: 20, width: 22, height: 12)
|
844
|
+
retval.should == @window.frame
|
845
|
+
end
|
846
|
+
@window.frame.origin.x.should == (@screen_size.width - 22) / 2 - 10
|
847
|
+
@window.frame.origin.y.should == @screen_size.height - 12 - 20
|
848
|
+
@window.frame.size.width.should == 22
|
849
|
+
@window.frame.size.height.should == 12
|
850
|
+
end
|
851
|
+
|
852
|
+
it 'should support setting the frame via `from_top(window)`' do
|
853
|
+
@layout.context(@window) do
|
854
|
+
retval = @layout.frame @layout.from_top(@another_window, x: 1, y: 1)
|
855
|
+
retval.should == @window.frame
|
856
|
+
end
|
857
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + (@another_window.frame.size.width - @window.frame.size.width) / 2 + 1
|
858
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height - @window.frame.size.height + 1
|
859
|
+
@window.frame.size.width.should == @window.frame.size.width
|
860
|
+
@window.frame.size.height.should == @window.frame.size.height
|
861
|
+
end
|
862
|
+
|
863
|
+
it 'should support setting the frame via `from_top_right`' do
|
864
|
+
@layout.context(@window) do
|
865
|
+
retval = @layout.frame @layout.from_top_right()
|
866
|
+
retval.should == @window.frame
|
867
|
+
end
|
868
|
+
@window.frame.origin.x.should == @screen_size.width - @window.frame.size.width
|
869
|
+
@window.frame.origin.y.should == @screen_size.height - @window.frame.size.height
|
870
|
+
@window.frame.size.width.should == @window.frame.size.width
|
871
|
+
@window.frame.size.height.should == @window.frame.size.height
|
872
|
+
end
|
873
|
+
|
874
|
+
it 'should support setting the frame via `from_top_right(width:height:)`' do
|
875
|
+
@layout.context(@window) do
|
876
|
+
retval = @layout.frame @layout.from_top_right(width: 10, height: 20)
|
877
|
+
retval.should == @window.frame
|
878
|
+
end
|
879
|
+
@window.frame.origin.x.should == @screen_size.width - 10
|
880
|
+
@window.frame.origin.y.should == @screen_size.height - 20
|
881
|
+
@window.frame.size.width.should == 10
|
882
|
+
@window.frame.size.height.should == 20
|
883
|
+
end
|
884
|
+
|
885
|
+
it 'should support setting the frame via `from_top_right(x:y:width:height:)`' do
|
886
|
+
@layout.context(@window) do
|
887
|
+
retval = @layout.frame @layout.from_top_right(x: 10, y: 20, width: 22, height: 12)
|
888
|
+
retval.should == @window.frame
|
889
|
+
end
|
890
|
+
@window.frame.origin.x.should == @screen_size.width - 22 + 10
|
891
|
+
@window.frame.origin.y.should == @screen_size.height - 12 + 20
|
892
|
+
@window.frame.size.width.should == 22
|
893
|
+
@window.frame.size.height.should == 12
|
894
|
+
end
|
895
|
+
|
896
|
+
it 'should support setting the frame via `from_top_right(right:up:width:height:)`' do
|
897
|
+
@layout.context(@window) do
|
898
|
+
retval = @layout.frame @layout.from_top_right(right: 10, up: 20, width: 22, height: 12)
|
899
|
+
retval.should == @window.frame
|
900
|
+
end
|
901
|
+
@window.frame.origin.x.should == @screen_size.width - 22 + 10
|
902
|
+
@window.frame.origin.y.should == @screen_size.height - 12 + 20
|
903
|
+
@window.frame.size.width.should == 22
|
904
|
+
@window.frame.size.height.should == 12
|
905
|
+
end
|
906
|
+
|
907
|
+
it 'should support setting the frame via `from_top_right(left:down:width:height:)`' do
|
908
|
+
@layout.context(@window) do
|
909
|
+
retval = @layout.frame @layout.from_top_right(left: 10, down: 20, width: 22, height: 12)
|
910
|
+
retval.should == @window.frame
|
911
|
+
end
|
912
|
+
@window.frame.origin.x.should == @screen_size.width - 22 - 10
|
913
|
+
@window.frame.origin.y.should == @screen_size.height - 12 - 20
|
914
|
+
@window.frame.size.width.should == 22
|
915
|
+
@window.frame.size.height.should == 12
|
916
|
+
end
|
917
|
+
|
918
|
+
it 'should support setting the frame via `from_top_right(window)`' do
|
919
|
+
@layout.context(@window) do
|
920
|
+
retval = @layout.frame @layout.from_top_right(@another_window, x: 1, y: 1)
|
921
|
+
retval.should == @window.frame
|
922
|
+
end
|
923
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width - @window.frame.size.width + 1
|
924
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height - @window.frame.size.height + 1
|
925
|
+
@window.frame.size.width.should == @window.frame.size.width
|
926
|
+
@window.frame.size.height.should == @window.frame.size.height
|
927
|
+
end
|
928
|
+
|
929
|
+
it 'should support setting the frame via `above(window)`' do
|
930
|
+
@layout.context(@window) do
|
931
|
+
retval = @layout.frame @layout.above(@another_window)
|
932
|
+
retval.should == @window.frame
|
933
|
+
end
|
934
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
935
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height
|
936
|
+
@window.frame.size.width.should == @window.frame.size.width
|
937
|
+
@window.frame.size.height.should == @window.frame.size.height
|
938
|
+
end
|
939
|
+
|
940
|
+
it 'should support setting the frame via `above(window)` and ignore view origin' do
|
941
|
+
f = @window.frame
|
942
|
+
f.origin.x = 10
|
943
|
+
f.origin.y = 10
|
944
|
+
@window.setFrame(f, display: false)
|
945
|
+
|
946
|
+
@layout.context(@window) do
|
947
|
+
retval = @layout.frame @layout.above(@another_window)
|
948
|
+
retval.should == @window.frame
|
949
|
+
end
|
950
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
951
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height
|
952
|
+
@window.frame.size.width.should == @window.frame.size.width
|
953
|
+
@window.frame.size.height.should == @window.frame.size.height
|
954
|
+
end
|
955
|
+
|
956
|
+
it 'should support setting the frame via `above(window, down:)`' do
|
957
|
+
@layout.context(@window) do
|
958
|
+
retval = @layout.frame @layout.above(@another_window, down: 8)
|
959
|
+
retval.should == @window.frame
|
960
|
+
end
|
961
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
962
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height - 8
|
963
|
+
@window.frame.size.width.should == @window.frame.size.width
|
964
|
+
@window.frame.size.height.should == @window.frame.size.height
|
965
|
+
end
|
966
|
+
|
967
|
+
it 'should support setting the frame via `above(window, width:height:)`' do
|
968
|
+
@layout.context(@window) do
|
969
|
+
retval = @layout.frame @layout.above(@another_window, width: 10, height: 20)
|
970
|
+
retval.should == @window.frame
|
971
|
+
end
|
972
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
973
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height
|
974
|
+
@window.frame.size.width.should == 10
|
975
|
+
@window.frame.size.height.should == 20
|
976
|
+
end
|
977
|
+
|
978
|
+
it 'should support setting the frame via `above(window, x:y:width:height:)`' do
|
979
|
+
@layout.context(@window) do
|
980
|
+
retval = @layout.frame @layout.above(@another_window, x: 10, y: 20, width: 22, height: 12)
|
981
|
+
retval.should == @window.frame
|
982
|
+
end
|
983
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 10
|
984
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height + 20
|
985
|
+
@window.frame.size.width.should == 22
|
986
|
+
@window.frame.size.height.should == 12
|
987
|
+
end
|
988
|
+
|
989
|
+
it 'should support setting the frame via `above(window, right:up:width:height:)`' do
|
990
|
+
@layout.context(@window) do
|
991
|
+
retval = @layout.frame @layout.above(@another_window, right: 10, up: 20, width: 22, height: 12)
|
992
|
+
retval.should == @window.frame
|
993
|
+
end
|
994
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 10
|
995
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height + 20
|
996
|
+
@window.frame.size.width.should == 22
|
997
|
+
@window.frame.size.height.should == 12
|
998
|
+
end
|
999
|
+
|
1000
|
+
it 'should support setting the frame via `above(window, left:down:width:height:)`' do
|
1001
|
+
@layout.context(@window) do
|
1002
|
+
retval = @layout.frame @layout.above(@another_window, left: 10, down: 20, width: 22, height: 12)
|
1003
|
+
retval.should == @window.frame
|
1004
|
+
end
|
1005
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - 10
|
1006
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + @another_window.frame.size.height - 20
|
1007
|
+
@window.frame.size.width.should == 22
|
1008
|
+
@window.frame.size.height.should == 12
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
it 'should support setting the frame via `below(window)`' do
|
1012
|
+
@layout.context(@window) do
|
1013
|
+
retval = @layout.frame @layout.below(@another_window)
|
1014
|
+
retval.should == @window.frame
|
1015
|
+
end
|
1016
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1017
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height
|
1018
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1019
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
it 'should support setting the frame via `below(window)` and ignore view origin' do
|
1023
|
+
f = @window.frame
|
1024
|
+
f.origin.x = 10
|
1025
|
+
f.origin.y = 10
|
1026
|
+
@window.setFrame(f, display: false)
|
1027
|
+
|
1028
|
+
@layout.context(@window) do
|
1029
|
+
retval = @layout.frame @layout.below(@another_window)
|
1030
|
+
retval.should == @window.frame
|
1031
|
+
end
|
1032
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1033
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height
|
1034
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1035
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
it 'should support setting the frame via `below(view, up:)`' do
|
1039
|
+
@layout.context(@window) do
|
1040
|
+
retval = @layout.frame @layout.below(@another_window, up: 8)
|
1041
|
+
retval.should == @window.frame
|
1042
|
+
end
|
1043
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1044
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height + 8
|
1045
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1046
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
it 'should support setting the frame via `below(view, width:height:)`' do
|
1050
|
+
@layout.context(@window) do
|
1051
|
+
retval = @layout.frame @layout.below(@another_window, width: 10, height: 20)
|
1052
|
+
retval.should == @window.frame
|
1053
|
+
end
|
1054
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1055
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height
|
1056
|
+
@window.frame.size.width.should == 10
|
1057
|
+
@window.frame.size.height.should == 20
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
it 'should support setting the frame via `below(view, x:y:width:height:)`' do
|
1061
|
+
@layout.context(@window) do
|
1062
|
+
retval = @layout.frame @layout.below(@another_window, x: 10, y: 20, width: 22, height: 12)
|
1063
|
+
retval.should == @window.frame
|
1064
|
+
end
|
1065
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 10
|
1066
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height + 20
|
1067
|
+
@window.frame.size.width.should == 22
|
1068
|
+
@window.frame.size.height.should == 12
|
1069
|
+
end
|
1070
|
+
|
1071
|
+
it 'should support setting the frame via `below(view, right:up:width:height:)`' do
|
1072
|
+
@layout.context(@window) do
|
1073
|
+
retval = @layout.frame @layout.below(@another_window, right: 10, up: 20, width: 22, height: 12)
|
1074
|
+
retval.should == @window.frame
|
1075
|
+
end
|
1076
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 10
|
1077
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height + 20
|
1078
|
+
@window.frame.size.width.should == 22
|
1079
|
+
@window.frame.size.height.should == 12
|
1080
|
+
end
|
1081
|
+
|
1082
|
+
it 'should support setting the frame via `below(view, left:down:width:height:)`' do
|
1083
|
+
@layout.context(@window) do
|
1084
|
+
retval = @layout.frame @layout.below(@another_window, left: 10, down: 20, width: 22, height: 12)
|
1085
|
+
retval.should == @window.frame
|
1086
|
+
end
|
1087
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - 10
|
1088
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y - @window.frame.size.height - 20
|
1089
|
+
@window.frame.size.width.should == 22
|
1090
|
+
@window.frame.size.height.should == 12
|
1091
|
+
end
|
1092
|
+
|
1093
|
+
it 'should support setting the frame via `before(window)`' do
|
1094
|
+
@layout.context(@window) do
|
1095
|
+
retval = @layout.frame @layout.before(@another_window)
|
1096
|
+
retval.should == @window.frame
|
1097
|
+
end
|
1098
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - @window.frame.size.width
|
1099
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1100
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1101
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1102
|
+
end
|
1103
|
+
|
1104
|
+
it 'should support setting the frame via `before(window)` and ignore view origin' do
|
1105
|
+
f = @window.frame
|
1106
|
+
f.origin.x = 10
|
1107
|
+
f.origin.y = 10
|
1108
|
+
@window.setFrame(f, display: false)
|
1109
|
+
|
1110
|
+
@layout.context(@window) do
|
1111
|
+
retval = @layout.frame @layout.before(@another_window)
|
1112
|
+
retval.should == @window.frame
|
1113
|
+
end
|
1114
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - @window.frame.size.width
|
1115
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1116
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1117
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1118
|
+
end
|
1119
|
+
|
1120
|
+
it 'should support setting the frame via `before(view, left:)`' do
|
1121
|
+
@layout.context(@window) do
|
1122
|
+
retval = @layout.frame @layout.before(@another_window, left: 8)
|
1123
|
+
retval.should == @window.frame
|
1124
|
+
end
|
1125
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - @window.frame.size.width - 8
|
1126
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1127
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1128
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1129
|
+
end
|
1130
|
+
|
1131
|
+
it 'should support setting the frame via `before(view, width:height:)`' do
|
1132
|
+
@layout.context(@window) do
|
1133
|
+
retval = @layout.frame @layout.before(@another_window, width: 10, height: 20)
|
1134
|
+
retval.should == @window.frame
|
1135
|
+
end
|
1136
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - @window.frame.size.width
|
1137
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1138
|
+
@window.frame.size.width.should == 10
|
1139
|
+
@window.frame.size.height.should == 20
|
1140
|
+
end
|
1141
|
+
|
1142
|
+
it 'should support setting the frame via `before(view, x:y:width:height:)`' do
|
1143
|
+
@layout.context(@window) do
|
1144
|
+
retval = @layout.frame @layout.before(@another_window, x: 10, y: 20, width: 22, height: 12)
|
1145
|
+
retval.should == @window.frame
|
1146
|
+
end
|
1147
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x - @window.frame.size.width + 10
|
1148
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + 20
|
1149
|
+
@window.frame.size.width.should == 22
|
1150
|
+
@window.frame.size.height.should == 12
|
1151
|
+
end
|
1152
|
+
|
1153
|
+
it 'should support setting the frame via `left_of(window)`' do
|
1154
|
+
before = nil
|
1155
|
+
left_of = nil
|
1156
|
+
@layout.context(@window) do
|
1157
|
+
before = @layout.before(@another_window)
|
1158
|
+
left_of = @layout.left_of(@another_window)
|
1159
|
+
end
|
1160
|
+
left_of.origin.x.should == before.origin.x
|
1161
|
+
left_of.origin.y.should == before.origin.y
|
1162
|
+
left_of.size.width.should == before.size.width
|
1163
|
+
left_of.size.height.should == before.size.height
|
1164
|
+
end
|
1165
|
+
|
1166
|
+
it 'should support setting the frame via `after(window)`' do
|
1167
|
+
@layout.context(@window) do
|
1168
|
+
retval = @layout.frame @layout.after(@another_window)
|
1169
|
+
retval.should == @window.frame
|
1170
|
+
end
|
1171
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width
|
1172
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1173
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1174
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1175
|
+
end
|
1176
|
+
|
1177
|
+
it 'should support setting the frame via `after(window)` and ignore view origin' do
|
1178
|
+
f = @window.frame
|
1179
|
+
f.origin.x = 10
|
1180
|
+
f.origin.y = 10
|
1181
|
+
@window.setFrame(f, display: false)
|
1182
|
+
|
1183
|
+
@layout.context(@window) do
|
1184
|
+
retval = @layout.frame @layout.after(@another_window)
|
1185
|
+
retval.should == @window.frame
|
1186
|
+
end
|
1187
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width
|
1188
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1189
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1190
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1191
|
+
end
|
1192
|
+
|
1193
|
+
it 'should support setting the frame via `after(view, right:)`' do
|
1194
|
+
@layout.context(@window) do
|
1195
|
+
retval = @layout.frame @layout.after(@another_window, right: 8)
|
1196
|
+
retval.should == @window.frame
|
1197
|
+
end
|
1198
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width + 8
|
1199
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1200
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1201
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1202
|
+
end
|
1203
|
+
|
1204
|
+
it 'should support setting the frame via `after(view, width:height:)`' do
|
1205
|
+
@layout.context(@window) do
|
1206
|
+
retval = @layout.frame @layout.after(@another_window, width: 10, height: 20)
|
1207
|
+
retval.should == @window.frame
|
1208
|
+
end
|
1209
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width
|
1210
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1211
|
+
@window.frame.size.width.should == 10
|
1212
|
+
@window.frame.size.height.should == 20
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
it 'should support setting the frame via `after(view, x:y:width:height:)`' do
|
1216
|
+
@layout.context(@window) do
|
1217
|
+
retval = @layout.frame @layout.after(@another_window, x: 10, y: 20, width: 22, height: 12)
|
1218
|
+
retval.should == @window.frame
|
1219
|
+
end
|
1220
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + @another_window.frame.size.width + 10
|
1221
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + 20
|
1222
|
+
@window.frame.size.width.should == 22
|
1223
|
+
@window.frame.size.height.should == 12
|
1224
|
+
end
|
1225
|
+
|
1226
|
+
it 'should support setting the frame via `right_of(window)`' do
|
1227
|
+
after = nil
|
1228
|
+
right_of = nil
|
1229
|
+
@layout.context(@window) do
|
1230
|
+
after = @layout.after(@another_window)
|
1231
|
+
right_of = @layout.right_of(@another_window)
|
1232
|
+
end
|
1233
|
+
right_of.origin.x.should == after.origin.x
|
1234
|
+
right_of.origin.y.should == after.origin.y
|
1235
|
+
right_of.size.width.should == after.size.width
|
1236
|
+
right_of.size.height.should == after.size.height
|
1237
|
+
end
|
1238
|
+
|
1239
|
+
it 'should support setting the frame via `relative_to(window)`' do
|
1240
|
+
@layout.context(@window) do
|
1241
|
+
retval = @layout.frame @layout.relative_to(@another_window, {})
|
1242
|
+
retval.should == @window.frame
|
1243
|
+
end
|
1244
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1245
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1246
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1247
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1248
|
+
end
|
1249
|
+
|
1250
|
+
it 'should support setting the frame via `relative_to(window)` and ignore view origin' do
|
1251
|
+
f = @window.frame
|
1252
|
+
f.origin.x = 10
|
1253
|
+
f.origin.y = 10
|
1254
|
+
@window.setFrame(f, display: false)
|
1255
|
+
|
1256
|
+
@layout.context(@window) do
|
1257
|
+
retval = @layout.frame @layout.relative_to(@another_window, {})
|
1258
|
+
retval.should == @window.frame
|
1259
|
+
end
|
1260
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1261
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1262
|
+
@window.frame.size.width.should == @window.frame.size.width
|
1263
|
+
@window.frame.size.height.should == @window.frame.size.height
|
1264
|
+
end
|
1265
|
+
|
1266
|
+
it 'should support setting the frame via `relative_to(view, width:height:)`' do
|
1267
|
+
@layout.context(@window) do
|
1268
|
+
retval = @layout.frame @layout.relative_to(@another_window, width: 10, height: 20)
|
1269
|
+
retval.should == @window.frame
|
1270
|
+
end
|
1271
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x
|
1272
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y
|
1273
|
+
@window.frame.size.width.should == 10
|
1274
|
+
@window.frame.size.height.should == 20
|
1275
|
+
end
|
1276
|
+
|
1277
|
+
it 'should support setting the frame via `relative_to(view, x:y:width:height:)`' do
|
1278
|
+
@layout.context(@window) do
|
1279
|
+
retval = @layout.frame @layout.relative_to(@another_window, x: 10, y: 20, width: 22, height: 12)
|
1280
|
+
retval.should == @window.frame
|
1281
|
+
end
|
1282
|
+
@window.frame.origin.x.should == @another_window.frame.origin.x + 10
|
1283
|
+
@window.frame.origin.y.should == @another_window.frame.origin.y + 20
|
1284
|
+
@window.frame.size.width.should == 22
|
1285
|
+
@window.frame.size.height.should == 12
|
1286
|
+
end
|
1287
|
+
|
1288
|
+
end
|