summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2017-08-23 15:45:02 -0400
committerJoel Fischer <joeljfischer@gmail.com>2017-08-23 15:45:02 -0400
commit5977dcd72c626d143addd4f09b3a1af06a8076c6 (patch)
tree3fa6bb79ec9b99feb541c105e3f9423cf3392bf6
parentff710fe095f309873b111b87699b0d530e6fe961 (diff)
downloadsdl_ios-feature/SDL_0075_OEM_specific_HID_support.tar.gz
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRectangleSpec.m48
1 files changed, 48 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRectangleSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRectangleSpec.m
index 86b5af722..ae4ee0791 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRectangleSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLRectangleSpec.m
@@ -1,6 +1,54 @@
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
+#import "SDLNames.h"
+#import "SDLRectangle.h"
+
QuickSpecBegin(SDLRectangleSpec)
+it(@"Should set and get correctly", ^{
+ SDLRectangle *testStruct = [[SDLRectangle alloc] init];
+
+ testStruct.x = @10;
+ testStruct.y = @100;
+ testStruct.width = @1000;
+ testStruct.height = @2000;
+
+ expect(testStruct.x).to(equal(@10));
+ expect(testStruct.y).to(equal(@100));
+ expect(testStruct.width).to(equal(@1000));
+ expect(testStruct.height).to(equal(@2000));
+});
+
+it(@"Should get correctly when initialized with parameters", ^{
+ SDLRectangle *testStruct = [[SDLRectangle alloc] initWithX:@50.5 y:@60.2 width:@500 height:@600];
+
+ expect(testStruct.x).to(beCloseTo(@50.5));
+ expect(testStruct.y).to(beCloseTo(@60.2));
+ expect(testStruct.width).to(equal(@500.0));
+ expect(testStruct.height).to(equal(@600.0));
+});
+
+it(@"Should get correctly when initialized with a dict", ^{
+ NSDictionary *dict = @{NAMES_x:@20,
+ NAMES_y:@200,
+ NAMES_width:@2000,
+ NAMES_height:@3000};
+ SDLRectangle *testStruct = [[SDLRectangle alloc] initWithDictionary:[dict mutableCopy]];
+
+ expect(testStruct.x).to(equal(@20));
+ expect(testStruct.y).to(equal(@200));
+ expect(testStruct.width).to(equal(@2000));
+ expect(testStruct.height).to(equal(@3000));
+});
+
+it(@"Should return nil if not set", ^{
+ SDLRectangle *testStruct = [[SDLRectangle alloc] init];
+
+ expect(testStruct.x).to(beNil());
+ expect(testStruct.y).to(beNil());
+ expect(testStruct.width).to(beNil());
+ expect(testStruct.height).to(beNil());
+});
+
QuickSpecEnd