Authored by bibibi

mas prefix,test cover,examples

@@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
7 objects = { 7 objects = {
8 8
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
  10 + 00FC4A321B7359D700DCA999 /* MASExampleDistributeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 00FC4A311B7359D700DCA999 /* MASExampleDistributeView.m */; };
10 114413091924B6EE008E702E /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 114413081924B6EE008E702E /* Default-568h@2x.png */; }; 11 114413091924B6EE008E702E /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 114413081924B6EE008E702E /* Default-568h@2x.png */; };
11 27A27D461A6CF0C400D34F52 /* MASExampleAspectFitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27A27D451A6CF0C400D34F52 /* MASExampleAspectFitView.m */; }; 12 27A27D461A6CF0C400D34F52 /* MASExampleAspectFitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27A27D451A6CF0C400D34F52 /* MASExampleAspectFitView.m */; };
12 3C02224919D0C4EC00507321 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3C02224819D0C4EC00507321 /* Images.xcassets */; }; 13 3C02224919D0C4EC00507321 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3C02224819D0C4EC00507321 /* Images.xcassets */; };
@@ -35,6 +36,8 @@ @@ -35,6 +36,8 @@
35 /* End PBXBuildFile section */ 36 /* End PBXBuildFile section */
36 37
37 /* Begin PBXFileReference section */ 38 /* Begin PBXFileReference section */
  39 + 00FC4A301B7359D700DCA999 /* MASExampleDistributeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleDistributeView.h; sourceTree = "<group>"; };
  40 + 00FC4A311B7359D700DCA999 /* MASExampleDistributeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleDistributeView.m; sourceTree = "<group>"; };
38 114413081924B6EE008E702E /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; }; 41 114413081924B6EE008E702E /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
39 27A27D441A6CF0C400D34F52 /* MASExampleAspectFitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleAspectFitView.h; sourceTree = "<group>"; }; 42 27A27D441A6CF0C400D34F52 /* MASExampleAspectFitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASExampleAspectFitView.h; sourceTree = "<group>"; };
40 27A27D451A6CF0C400D34F52 /* MASExampleAspectFitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleAspectFitView.m; sourceTree = "<group>"; }; 43 27A27D451A6CF0C400D34F52 /* MASExampleAspectFitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASExampleAspectFitView.m; sourceTree = "<group>"; };
@@ -182,6 +185,8 @@ @@ -182,6 +185,8 @@
182 DD32C3FC18E8BFF6001F6AD2 /* MASExampleAttributeChainingView.m */, 185 DD32C3FC18E8BFF6001F6AD2 /* MASExampleAttributeChainingView.m */,
183 44C0E6AD1A9B9C55003C70CF /* MASExampleMarginView.h */, 186 44C0E6AD1A9B9C55003C70CF /* MASExampleMarginView.h */,
184 44C0E6AE1A9B9C55003C70CF /* MASExampleMarginView.m */, 187 44C0E6AE1A9B9C55003C70CF /* MASExampleMarginView.m */,
  188 + 00FC4A301B7359D700DCA999 /* MASExampleDistributeView.h */,
  189 + 00FC4A311B7359D700DCA999 /* MASExampleDistributeView.m */,
185 ); 190 );
186 name = Views; 191 name = Views;
187 sourceTree = "<group>"; 192 sourceTree = "<group>";
@@ -308,6 +313,7 @@ @@ -308,6 +313,7 @@
308 isa = PBXSourcesBuildPhase; 313 isa = PBXSourcesBuildPhase;
309 buildActionMask = 2147483647; 314 buildActionMask = 2147483647;
310 files = ( 315 files = (
  316 + 00FC4A321B7359D700DCA999 /* MASExampleDistributeView.m in Sources */,
311 DD175E6A182639FB0099129A /* MASExampleUpdateView.m in Sources */, 317 DD175E6A182639FB0099129A /* MASExampleUpdateView.m in Sources */,
312 DD52F237179CAD57005CD195 /* main.m in Sources */, 318 DD52F237179CAD57005CD195 /* main.m in Sources */,
313 3DB1CAD5184538E200E91FC5 /* MASExampleArrayView.m in Sources */, 319 3DB1CAD5184538E200E91FC5 /* MASExampleArrayView.m in Sources */,
  1 +//
  2 +// MASExampleDistributeView.h
  3 +// Masonry iOS Examples
  4 +//
  5 +// Created by bibibi on 15/8/6.
  6 +// Copyright (c) 2015年 Jonas Budelmann. All rights reserved.
  7 +//
  8 +
  9 +#import <UIKit/UIKit.h>
  10 +
  11 +@interface MASExampleDistributeView : UIView
  12 +
  13 +@end
  1 +//
  2 +// MASExampleDistributeView.m
  3 +// Masonry iOS Examples
  4 +//
  5 +// Created by bibibi on 15/8/6.
  6 +// Copyright (c) 2015年 Jonas Budelmann. All rights reserved.
  7 +//
  8 +
  9 +#import "MASExampleDistributeView.h"
  10 +
  11 +@implementation MASExampleDistributeView
  12 +
  13 +- (id)init {
  14 + self = [super init];
  15 + if (!self) return nil;
  16 +
  17 + NSMutableArray *arr = @[].mutableCopy;
  18 + for (int i = 0; i < 4; i++) {
  19 + UIView *view = UIView.new;
  20 + view.backgroundColor = [self randomColor];
  21 + view.layer.borderColor = UIColor.blackColor.CGColor;
  22 + view.layer.borderWidth = 2;
  23 + [self addSubview:view];
  24 + [arr addObject:view];
  25 + }
  26 +
  27 + unsigned int type = arc4random()%4;
  28 + switch (type) {
  29 + case 0:
  30 + [arr mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedSpacing:20 leadSpacing:5 tailSpacing:5];
  31 + [arr makeConstraints:^(MASConstraintMaker *make) {
  32 + make.top.equalTo(@60);
  33 + make.height.equalTo(@60);
  34 + }];
  35 + break;
  36 + case 1:
  37 + [arr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedSpacing:20 leadSpacing:5 tailSpacing:5];
  38 + [arr makeConstraints:^(MASConstraintMaker *make) {
  39 + make.left.equalTo(@0);
  40 + make.width.equalTo(@60);
  41 + }];
  42 + break;
  43 + case 2:
  44 + [arr mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedItemLength:30 leadSpacing:5 tailSpacing:5];
  45 + [arr makeConstraints:^(MASConstraintMaker *make) {
  46 + make.top.equalTo(@60);
  47 + make.height.equalTo(@60);
  48 + }];
  49 + break;
  50 + case 3:
  51 + [arr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedItemLength:30 leadSpacing:5 tailSpacing:5];
  52 + [arr makeConstraints:^(MASConstraintMaker *make) {
  53 + make.left.equalTo(@0);
  54 + make.width.equalTo(@60);
  55 + }];
  56 + break;
  57 +
  58 + default:
  59 + break;
  60 + }
  61 +
  62 + return self;
  63 +}
  64 +
  65 +- (UIColor *)randomColor {
  66 + CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0
  67 + CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white
  68 + CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black
  69 + return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1];
  70 +}
  71 +
  72 +@end
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
22 #import "MASExampleAttributeChainingView.h" 22 #import "MASExampleAttributeChainingView.h"
23 #import "MASExampleAspectFitView.h" 23 #import "MASExampleAspectFitView.h"
24 #import "MASExampleMarginView.h" 24 #import "MASExampleMarginView.h"
  25 +#import "MASExampleDistributeView.h"
25 26
26 static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier"; 27 static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier";
27 28
@@ -66,6 +67,8 @@ static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier"; @@ -66,6 +67,8 @@ static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier";
66 viewClass:MASExampleAttributeChainingView.class], 67 viewClass:MASExampleAttributeChainingView.class],
67 [[MASExampleViewController alloc] initWithTitle:@"Margins" 68 [[MASExampleViewController alloc] initWithTitle:@"Margins"
68 viewClass:MASExampleMarginView.class], 69 viewClass:MASExampleMarginView.class],
  70 + [[MASExampleViewController alloc] initWithTitle:@"Views Distribute"
  71 + viewClass:MASExampleDistributeView.class],
69 72
70 ]; 73 ];
71 74
@@ -10,9 +10,9 @@ @@ -10,9 +10,9 @@
10 #import "MASConstraintMaker.h" 10 #import "MASConstraintMaker.h"
11 #import "MASViewAttribute.h" 11 #import "MASViewAttribute.h"
12 12
13 -typedef NS_ENUM(NSUInteger, AxisType) {  
14 - AxisTypeHorizon,  
15 - AxisTypeVertical 13 +typedef NS_ENUM(NSUInteger, MASAxisType) {
  14 + MASAxisTypeHorizon,
  15 + MASAxisTypeVertical
16 }; 16 };
17 17
18 @interface NSArray (MASAdditions) 18 @interface NSArray (MASAdditions)
@@ -54,17 +54,19 @@ typedef NS_ENUM(NSUInteger, AxisType) { @@ -54,17 +54,19 @@ typedef NS_ENUM(NSUInteger, AxisType) {
54 * 54 *
55 * @param axisType horizon/vertical 55 * @param axisType horizon/vertical
56 * @param paddingSpace space 56 * @param paddingSpace space
57 - * @param leadSpacing head/tail 57 + * @param leadSpacing head
  58 + * @param tailSpacing tail
58 */ 59 */
59 -- (void)mas_distributeViewsAlongAxis:(AxisType)axisType withFixedSpacing:(CGFloat)paddingSpace withLeadSpacing:(CGFloat)leadSpacing; 60 +- (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)paddingSpace leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing;
60 61
61 /** 62 /**
62 * distribute with fixed item size 63 * distribute with fixed item size
63 * 64 *
64 * @param axisType horizon/vertical 65 * @param axisType horizon/vertical
65 * @param itemLength item size 66 * @param itemLength item size
66 - * @param leadSpacing head/tail 67 + * @param leadSpacing head
  68 + * @param tailSpacing tail
67 */ 69 */
68 -- (void)mas_distributeViewsAlongAxis:(AxisType)axisType withFixedItemLength:(CGFloat)itemLength withLeadSpacing:(CGFloat)leadSpacing; 70 +- (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)itemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing;
69 71
70 @end 72 @end
@@ -38,27 +38,29 @@ @@ -38,27 +38,29 @@
38 return constraints; 38 return constraints;
39 } 39 }
40 40
41 -- (void)mas_distributeViewsAlongAxis:(AxisType)axisType withFixedSpacing:(CGFloat)paddingSpace withLeadSpacing:(CGFloat)leadSpacing { 41 +- (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedSpacing:(CGFloat)paddingSpace leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing {
42 if (self.count < 2) { 42 if (self.count < 2) {
  43 + NSAssert(self.count>1,@"views to distribute need to bigger than one");
43 return; 44 return;
44 } 45 }
45 46
46 MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; 47 MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews];
47 - if (axisType == AxisTypeHorizon) { 48 + if (axisType == MASAxisTypeHorizon) {
48 MAS_VIEW *prev; 49 MAS_VIEW *prev;
49 for (int i = 0; i < self.count; i++) { 50 for (int i = 0; i < self.count; i++) {
50 MAS_VIEW *v = [self objectAtIndex:i]; 51 MAS_VIEW *v = [self objectAtIndex:i];
51 [v mas_makeConstraints:^(MASConstraintMaker *make) { 52 [v mas_makeConstraints:^(MASConstraintMaker *make) {
52 if (prev) { 53 if (prev) {
53 - make.left.equalTo(prev.mas_right).offset(paddingSpace);  
54 make.width.equalTo(prev); 54 make.width.equalTo(prev);
  55 + make.left.equalTo(prev.mas_right).offset(paddingSpace);
  56 + if (i == (CGFloat)self.count - 1) {//last one
  57 + make.right.equalTo(tempSuperView).offset(-tailSpacing);
55 } 58 }
56 - else {  
57 - make.left.equalTo(tempSuperView).offset(leadSpacing);  
58 } 59 }
59 - if (i == (CGFloat)self.count - 1) {  
60 - make.right.equalTo(tempSuperView).offset(-leadSpacing); 60 + else {//first one
  61 + make.left.equalTo(tempSuperView).offset(leadSpacing);
61 } 62 }
  63 +
62 }]; 64 }];
63 prev = v; 65 prev = v;
64 } 66 }
@@ -69,28 +71,30 @@ @@ -69,28 +71,30 @@
69 MAS_VIEW *v = [self objectAtIndex:i]; 71 MAS_VIEW *v = [self objectAtIndex:i];
70 [v mas_makeConstraints:^(MASConstraintMaker *make) { 72 [v mas_makeConstraints:^(MASConstraintMaker *make) {
71 if (prev) { 73 if (prev) {
72 - make.top.equalTo(prev.mas_bottom).offset(paddingSpace);  
73 make.height.equalTo(prev); 74 make.height.equalTo(prev);
  75 + make.top.equalTo(prev.mas_bottom).offset(paddingSpace);
  76 + if (i == (CGFloat)self.count - 1) {//last one
  77 + make.bottom.equalTo(tempSuperView).offset(-tailSpacing);
74 } 78 }
75 - else {  
76 - make.top.equalTo(tempSuperView).offset(leadSpacing);  
77 } 79 }
78 - if (i == (CGFloat)self.count - 1) {  
79 - make.bottom.equalTo(tempSuperView).offset(-leadSpacing); 80 + else {//first one
  81 + make.top.equalTo(tempSuperView).offset(leadSpacing);
80 } 82 }
  83 +
81 }]; 84 }];
82 prev = v; 85 prev = v;
83 } 86 }
84 } 87 }
85 } 88 }
86 89
87 -- (void)mas_distributeViewsAlongAxis:(AxisType)axisType withFixedItemLength:(CGFloat)itemLength withLeadSpacing:(CGFloat)leadSpacing {  
88 - if (self.count < 2) {//一个不需要均匀分布 90 +- (void)mas_distributeViewsAlongAxis:(MASAxisType)axisType withFixedItemLength:(CGFloat)itemLength leadSpacing:(CGFloat)leadSpacing tailSpacing:(CGFloat)tailSpacing {
  91 + if (self.count < 2) {
  92 + NSAssert(self.count>1,@"views to distribute need to bigger than one");
89 return; 93 return;
90 } 94 }
91 95
92 MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews]; 96 MAS_VIEW *tempSuperView = [self mas_commonSuperviewOfViews];
93 - if (axisType == AxisTypeHorizon) { 97 + if (axisType == MASAxisTypeHorizon) {
94 MAS_VIEW *prev; 98 MAS_VIEW *prev;
95 for (int i = 0; i < self.count; i++) { 99 for (int i = 0; i < self.count; i++) {
96 MAS_VIEW *v = [self objectAtIndex:i]; 100 MAS_VIEW *v = [self objectAtIndex:i];
@@ -98,15 +102,17 @@ @@ -98,15 +102,17 @@
98 if (prev) { 102 if (prev) {
99 CGFloat offset = (1-(i/((CGFloat)self.count-1)))*itemLength; 103 CGFloat offset = (1-(i/((CGFloat)self.count-1)))*itemLength;
100 make.width.equalTo(@(itemLength)); 104 make.width.equalTo(@(itemLength));
101 - make.right.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); 105 + if (i == (CGFloat)self.count - 1) {//last one
  106 + make.right.equalTo(tempSuperView).offset(-tailSpacing);
102 } 107 }
103 else { 108 else {
  109 + make.right.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset);
  110 + }
  111 + }
  112 + else {//first one
104 make.left.equalTo(tempSuperView).offset(leadSpacing); 113 make.left.equalTo(tempSuperView).offset(leadSpacing);
105 make.width.equalTo(@(itemLength)); 114 make.width.equalTo(@(itemLength));
106 } 115 }
107 - if (i == (CGFloat)self.count - 1) {  
108 - make.right.equalTo(tempSuperView).offset(-leadSpacing);  
109 - }  
110 }]; 116 }];
111 prev = v; 117 prev = v;
112 } 118 }
@@ -119,15 +125,17 @@ @@ -119,15 +125,17 @@
119 if (prev) { 125 if (prev) {
120 CGFloat offset = (1-(i/((CGFloat)self.count-1)))*itemLength; 126 CGFloat offset = (1-(i/((CGFloat)self.count-1)))*itemLength;
121 make.height.equalTo(@(itemLength)); 127 make.height.equalTo(@(itemLength));
122 - make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset); 128 + if (i == (CGFloat)self.count - 1) {//last one
  129 + make.bottom.equalTo(tempSuperView).offset(-tailSpacing);
123 } 130 }
124 else { 131 else {
  132 + make.bottom.equalTo(tempSuperView).multipliedBy(i/((CGFloat)self.count-1)).with.offset(offset);
  133 + }
  134 + }
  135 + else {//first one
125 make.top.equalTo(tempSuperView).offset(leadSpacing); 136 make.top.equalTo(tempSuperView).offset(leadSpacing);
126 make.height.equalTo(@(itemLength)); 137 make.height.equalTo(@(itemLength));
127 } 138 }
128 - if (i == (CGFloat)self.count - 1) {  
129 - make.bottom.equalTo(tempSuperView).offset(-leadSpacing);  
130 - }  
131 }]; 139 }];
132 prev = v; 140 prev = v;
133 } 141 }
@@ -59,4 +59,93 @@ SpecBegin(NSArray_MASAdditions) @@ -59,4 +59,93 @@ SpecBegin(NSArray_MASAdditions)
59 }]; 59 }];
60 } 60 }
61 61
  62 +- (void)testDistributeViewsWithFixedSpacingShouldFailWhenArrayContainsLessTwoViews {
  63 + MAS_VIEW *superView = MAS_VIEW.new;
  64 +
  65 + MAS_VIEW *subject1 = MAS_VIEW.new;
  66 + [superView addSubview:subject1];
  67 +
  68 + MAS_VIEW *subject2 = MAS_VIEW.new;
  69 + [superView addSubview:subject2];
  70 + NSArray *views = @[ subject1];
  71 + expect(^{
  72 + [views mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedSpacing:10.0 leadSpacing:5.0 tailSpacing:5.0];
  73 + }).to.raiseAny();
  74 +
  75 +}
  76 +
  77 +- (void)testDistributeViewsWithFixedItemLengthShouldFailWhenArrayContainsLessTwoViews {
  78 + MAS_VIEW *superView = MAS_VIEW.new;
  79 +
  80 + MAS_VIEW *subject1 = MAS_VIEW.new;
  81 + [superView addSubview:subject1];
  82 +
  83 + MAS_VIEW *subject2 = MAS_VIEW.new;
  84 + [superView addSubview:subject2];
  85 + NSArray *views = @[ subject1];
  86 + expect(^{
  87 + [views mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedSpacing:10.0 leadSpacing:5.0 tailSpacing:5.0];
  88 + }).to.raiseAny();
  89 +
  90 +}
  91 +
  92 +- (void)testDistributeViewsWithFixedSpacingShouldHaveCorrectNumberOfConstraints {
  93 + MAS_VIEW *superView = MAS_VIEW.new;
  94 +
  95 + MAS_VIEW *subject1 = MAS_VIEW.new;
  96 + [superView addSubview:subject1];
  97 +
  98 + MAS_VIEW *subject2 = MAS_VIEW.new;
  99 + [superView addSubview:subject2];
  100 +
  101 + MAS_VIEW *subject3 = MAS_VIEW.new;
  102 + [superView addSubview:subject3];
  103 +
  104 + NSArray *views = @[ subject1,subject2,subject3 ];
  105 +
  106 + [views mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedSpacing:10.0 leadSpacing:5.0 tailSpacing:5.0];
  107 +
  108 + //left view
  109 + NSArray *arr1 = [MASViewConstraint installedConstraintsForView:subject1];
  110 + expect(arr1).to.haveCountOf(1);
  111 +
  112 + //middle view
  113 + NSArray *arr2 = [MASViewConstraint installedConstraintsForView:subject2];
  114 + expect(arr2).to.haveCountOf(2);
  115 +
  116 + //right view
  117 + NSArray *arr3 = [MASViewConstraint installedConstraintsForView:subject3];
  118 + expect(arr3).to.haveCountOf(3);
  119 +}
  120 +
  121 +- (void)testDistributeViewsWithFixedItemLengthShouldHaveCorrectNumberOfConstraints {
  122 + MAS_VIEW *superView = MAS_VIEW.new;
  123 +
  124 + MAS_VIEW *subject1 = MAS_VIEW.new;
  125 + [superView addSubview:subject1];
  126 +
  127 + MAS_VIEW *subject2 = MAS_VIEW.new;
  128 + [superView addSubview:subject2];
  129 +
  130 + MAS_VIEW *subject3 = MAS_VIEW.new;
  131 + [superView addSubview:subject3];
  132 +
  133 + NSArray *views = @[ subject1,subject2,subject3 ];
  134 +
  135 + [views mas_distributeViewsAlongAxis:MASAxisTypeHorizon withFixedItemLength:30.0 leadSpacing:5.0 tailSpacing:5.0];
  136 +
  137 + //left view
  138 + NSArray *arr1 = [MASViewConstraint installedConstraintsForView:subject1];
  139 + expect(arr1).to.haveCountOf(2);
  140 +
  141 + //middle view
  142 + NSArray *arr2 = [MASViewConstraint installedConstraintsForView:subject2];
  143 + expect(arr2).to.haveCountOf(2);
  144 +
  145 + //right view
  146 + NSArray *arr3 = [MASViewConstraint installedConstraintsForView:subject3];
  147 + expect(arr3).to.haveCountOf(2);
  148 +}
  149 +
  150 +
62 SpecEnd 151 SpecEnd