@@ -471,6 +471,67 @@ class NeonTests: XCTestCase {
471
471
XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 105 , 0 , 20 , 20 ) ) )
472
472
XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 105 , 25 , 20 , 20 ) ) )
473
473
XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 105 , 50 , 20 , 20 ) ) )
474
+
475
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . ToTheRightCentered, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
476
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 105 , 15 , 20 , 20 ) ) )
477
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 105 , 40 , 20 , 20 ) ) )
478
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 105 , 65 , 20 , 20 ) ) )
479
+
480
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . ToTheRightMatchingBottom, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
481
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 105 , 30 , 20 , 20 ) ) )
482
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 105 , 55 , 20 , 20 ) ) )
483
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 105 , 80 , 20 , 20 ) ) )
484
+
485
+ testAnchorView. anchorInCorner ( . TopRight, xPad: 0 , yPad: 0 , width: 100 , height: 100 )
486
+
487
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . ToTheLeftMatchingTop, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
488
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 875 , 0 , 20 , 20 ) ) )
489
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 875 , 25 , 20 , 20 ) ) )
490
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 875 , 50 , 20 , 20 ) ) )
491
+
492
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . ToTheLeftCentered, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
493
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 875 , 15 , 20 , 20 ) ) )
494
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 875 , 40 , 20 , 20 ) ) )
495
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 875 , 65 , 20 , 20 ) ) )
496
+
497
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . ToTheLeftMatchingBottom, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
498
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 875 , 30 , 20 , 20 ) ) )
499
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 875 , 55 , 20 , 20 ) ) )
500
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 875 , 80 , 20 , 20 ) ) )
501
+
502
+ testAnchorView. anchorInCorner ( . TopLeft, xPad: 0 , yPad: 0 , width: 100 , height: 100 )
503
+
504
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . UnderMatchingLeft, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
505
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 0 , 105 , 20 , 20 ) ) )
506
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 0 , 130 , 20 , 20 ) ) )
507
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 0 , 155 , 20 , 20 ) ) )
508
+
509
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . UnderCentered, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
510
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 40 , 105 , 20 , 20 ) ) )
511
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 40 , 130 , 20 , 20 ) ) )
512
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 40 , 155 , 20 , 20 ) ) )
513
+
514
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . UnderMatchingRight, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
515
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 80 , 105 , 20 , 20 ) ) )
516
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 80 , 130 , 20 , 20 ) ) )
517
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 80 , 155 , 20 , 20 ) ) )
518
+
519
+ testAnchorView. anchorInCorner ( . BottomLeft, xPad: 0 , yPad: 0 , width: 100 , height: 100 )
520
+
521
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . AboveMatchingLeft, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
522
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 0 , 825 , 20 , 20 ) ) )
523
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 0 , 850 , 20 , 20 ) ) )
524
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 0 , 875 , 20 , 20 ) ) )
525
+
526
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . AboveCentered, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
527
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 40 , 825 , 20 , 20 ) ) )
528
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 40 , 850 , 20 , 20 ) ) )
529
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 40 , 875 , 20 , 20 ) ) )
530
+
531
+ testSuperview. groupAndAlign ( group: . Vertical, andAlign: . AboveMatchingRight, views: [ testSiblingView, testSiblingView2, testSiblingView3] , relativeTo: testAnchorView, padding: 5 , width: 20 , height: 20 )
532
+ XCTAssert ( CGRectEqualToRect ( testSiblingView. frame, CGRectMake ( 80 , 825 , 20 , 20 ) ) )
533
+ XCTAssert ( CGRectEqualToRect ( testSiblingView2. frame, CGRectMake ( 80 , 850 , 20 , 20 ) ) )
534
+ XCTAssert ( CGRectEqualToRect ( testSiblingView3. frame, CGRectMake ( 80 , 875 , 20 , 20 ) ) )
474
535
}
475
536
476
537
// TODO: test groupAndFill()
0 commit comments