geomotion 0.12.1 → 0.12.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/lib/geomotion/cg_rect.rb +5 -1
- data/lib/geomotion/version.rb +1 -1
- data/spec/cg_rect_spec.rb +47 -20
- metadata +2 -2
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
data/lib/geomotion/cg_rect.rb
CHANGED
@@ -185,7 +185,11 @@ class CGRect
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def below(margin = 0)
|
188
|
-
|
188
|
+
self.below(margin, height:self.height)
|
189
|
+
end
|
190
|
+
|
191
|
+
def below(margin, height:height)
|
192
|
+
CGRect.new([self.x, self.y + self.height + margin], [self.width, height])
|
189
193
|
end
|
190
194
|
|
191
195
|
def before(margin = 0)
|
data/lib/geomotion/version.rb
CHANGED
data/spec/cg_rect_spec.rb
CHANGED
@@ -347,57 +347,84 @@ describe "CGRect" do
|
|
347
347
|
it "works with margins" do
|
348
348
|
rect = CGRect.make(height: 50).above(20)
|
349
349
|
rect.origin.y.should == -70
|
350
|
+
rect.size.height.should == 50
|
351
|
+
end
|
352
|
+
|
353
|
+
it "works with height" do
|
354
|
+
rect = CGRect.make(height: 50).above(20, height: 10)
|
355
|
+
rect.origin.y.should == -30
|
356
|
+
rect.size.height.should == 10
|
350
357
|
end
|
351
358
|
|
352
359
|
it "works without margins" do
|
353
360
|
rect = CGRect.make(height: 50).above
|
354
361
|
rect.origin.y.should == -50
|
362
|
+
rect.size.height.should == 50
|
355
363
|
end
|
356
364
|
end
|
357
365
|
|
358
366
|
describe "#below" do
|
359
|
-
it "works" do
|
367
|
+
it "works with margins" do
|
360
368
|
rect = CGRect.make(height: 50).below(20)
|
361
369
|
rect.origin.y.should == 70
|
370
|
+
rect.size.height.should == 50
|
371
|
+
end
|
372
|
+
|
373
|
+
it "works with height" do
|
374
|
+
rect = CGRect.make(height: 50).below(20, height: 10)
|
375
|
+
rect.origin.y.should == 70
|
376
|
+
rect.size.height.should == 10
|
377
|
+
end
|
378
|
+
|
379
|
+
it "works without margins" do
|
380
|
+
rect = CGRect.make(height: 50).below
|
381
|
+
rect.origin.y.should == 50
|
382
|
+
rect.size.height.should == 50
|
362
383
|
end
|
363
384
|
end
|
364
385
|
|
365
386
|
describe "#before" do
|
366
|
-
it "works" do
|
367
|
-
rect = CGRect.make(
|
368
|
-
rect.origin.x.should ==
|
387
|
+
it "works with margins" do
|
388
|
+
rect = CGRect.make(width: 50).before(20)
|
389
|
+
rect.origin.x.should == -70
|
390
|
+
rect.size.width.should == 50
|
369
391
|
end
|
370
|
-
end
|
371
392
|
|
372
|
-
|
373
|
-
|
374
|
-
rect
|
375
|
-
rect.
|
393
|
+
it "works with width" do
|
394
|
+
rect = CGRect.make(width: 50).before(20, width: 10)
|
395
|
+
rect.origin.x.should == -30
|
396
|
+
rect.size.width.should == 10
|
397
|
+
end
|
398
|
+
|
399
|
+
it "works without margins" do
|
400
|
+
rect = CGRect.make(width: 50).before
|
401
|
+
rect.origin.x.should == -50
|
402
|
+
rect.size.width.should == 50
|
376
403
|
end
|
377
404
|
end
|
378
405
|
|
379
406
|
describe "#beside" do
|
380
407
|
it "works with margins" do
|
381
|
-
rect = CGRect.make(
|
382
|
-
rect.origin.x.should ==
|
408
|
+
rect = CGRect.make(width: 50).beside(20)
|
409
|
+
rect.origin.x.should == 70
|
410
|
+
rect.size.width.should == 50
|
383
411
|
end
|
384
412
|
|
385
|
-
it "works
|
386
|
-
rect = CGRect.make(
|
413
|
+
it "works with width" do
|
414
|
+
rect = CGRect.make(width: 50).beside(20, width: 10)
|
387
415
|
rect.origin.x.should == 70
|
416
|
+
rect.size.width.should == 10
|
388
417
|
end
|
389
|
-
end
|
390
418
|
|
391
|
-
|
392
|
-
|
393
|
-
rect
|
394
|
-
rect.
|
395
|
-
rect.size.width.should == 30
|
419
|
+
it "works without margins" do
|
420
|
+
rect = CGRect.make(width: 50).beside
|
421
|
+
rect.origin.x.should == 50
|
422
|
+
rect.size.width.should == 50
|
396
423
|
end
|
397
424
|
end
|
398
425
|
|
399
426
|
describe "#top_left" do
|
400
|
-
it "works" do
|
427
|
+
it "works with margins" do
|
401
428
|
rect = CGRect.make(x: 10, y: 20, width: 100, height: 200)
|
402
429
|
point = rect.top_left
|
403
430
|
point.is_a?(CGPoint).should == true
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geomotion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rake
|