diff options
Diffstat (limited to 'SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSystemCapabilitySpec.m')
-rwxr-xr-x | SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSystemCapabilitySpec.m | 102 |
1 files changed, 65 insertions, 37 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSystemCapabilitySpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSystemCapabilitySpec.m index abfd13afb..c759058d8 100755 --- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSystemCapabilitySpec.m +++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSystemCapabilitySpec.m @@ -5,69 +5,93 @@ #import "SDLSystemCapability.h" +#import "SDLAppServicesCapabilities.h" #import "SDLImageResolution.h" #import "SDLNavigationCapability.h" #import "SDLPhoneCapability.h" #import "SDLSystemCapabilityType.h" #import "SDLRemoteControlCapabilities.h" -#import "SDLNames.h" +#import "SDLRPCParameterNames.h" #import "SDLVideoStreamingCapability.h" #import "SDLVideoStreamingCodec.h" #import "SDLVideoStreamingFormat.h" #import "SDLVideoStreamingProtocol.h" -#import "SDLNames.h" +#import "SDLRPCParameterNames.h" QuickSpecBegin(SDLSystemCapabilitySpec) -SDLRemoteControlCapabilities *someRemoteControlCapabilities = [[SDLRemoteControlCapabilities alloc] init]; describe(@"Getter/Setter Tests", ^ { + __block SDLAppServicesCapabilities *testAppServicesCapabilities = nil; + __block SDLNavigationCapability *testNavigationCapability = nil; + __block SDLPhoneCapability *testPhoneCapability = nil; + __block SDLRemoteControlCapabilities *testRemoteControlCapabilities = nil; + __block SDLVideoStreamingCapability *testVideoStreamingCapability = nil; + + beforeEach(^{ + testAppServicesCapabilities = [[SDLAppServicesCapabilities alloc] initWithAppServices:nil]; + testNavigationCapability = [[SDLNavigationCapability alloc] initWithSendLocation:YES waypoints:NO]; + testPhoneCapability = [[SDLPhoneCapability alloc] initWithDialNumber:YES]; + testRemoteControlCapabilities = [[SDLRemoteControlCapabilities alloc] initWithClimateControlCapabilities:nil radioControlCapabilities:nil buttonCapabilities:nil seatControlCapabilities:nil audioControlCapabilities:nil hmiSettingsControlCapabilities:nil lightControlCapabilities:nil]; + testVideoStreamingCapability = [[SDLVideoStreamingCapability alloc] initWithPreferredResolution:[[SDLImageResolution alloc] initWithWidth:50 height:50] maxBitrate:5 supportedFormats:@[] hapticDataSupported:false]; + }); + it(@"Should set and get correctly", ^ { SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] init]; - testStruct.systemCapabilityType = SDLSystemCapabilityTypeNavigation; - testStruct.navigationCapability = [[SDLNavigationCapability alloc] initWithSendLocation:YES waypoints:NO]; - testStruct.phoneCapability = [[SDLPhoneCapability alloc] initWithDialNumber:YES]; - testStruct.remoteControlCapability = someRemoteControlCapabilities; + testStruct.appServicesCapabilities = testAppServicesCapabilities; + testStruct.navigationCapability = testNavigationCapability; + testStruct.phoneCapability = testPhoneCapability; + testStruct.videoStreamingCapability = testVideoStreamingCapability; + testStruct.remoteControlCapability = testRemoteControlCapabilities; expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeNavigation)); - expect(testStruct.navigationCapability.sendLocationEnabled).to(equal(YES)); - expect(testStruct.navigationCapability.getWayPointsEnabled).to(equal(NO)); - expect(testStruct.phoneCapability.dialNumberEnabled).to(equal(YES)); - - testStruct.systemCapabilityType = SDLSystemCapabilityTypeVideoStreaming; - - expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeVideoStreaming)); - expect(testStruct.remoteControlCapability).to(equal(someRemoteControlCapabilities)); - + expect(testStruct.appServicesCapabilities).to(equal(testAppServicesCapabilities)); + expect(testStruct.navigationCapability).to(equal(testNavigationCapability)); + expect(testStruct.phoneCapability).to(equal(testPhoneCapability)); + expect(testStruct.videoStreamingCapability).to(equal(testVideoStreamingCapability)); + expect(testStruct.remoteControlCapability).to(equal(testRemoteControlCapabilities)); }); -}); -describe(@"Initialization tests", ^{ it(@"Should get correctly when initialized with a dictionary", ^ { - NSMutableDictionary* dict = [@{SDLNameSystemCapabilityType: @"NAVIGATION", - SDLNameNavigationCapability: @{SDLNameGetWayPointsEnabled: @(NO), - SDLNameSendLocationEnabled: @(YES)}, - SDLNamePhoneCapability: @{SDLNameDialNumberEnabled: @(YES)}, - SDLNameRemoteControlCapability: someRemoteControlCapabilities} mutableCopy]; + NSDictionary *dict = @{ + SDLRPCParameterNameSystemCapabilityType:SDLSystemCapabilityTypeNavigation, + SDLRPCParameterNameAppServicesCapabilities:testAppServicesCapabilities, + SDLRPCParameterNameNavigationCapability:testNavigationCapability, + SDLRPCParameterNamePhoneCapability:testPhoneCapability, + SDLRPCParameterNameRemoteControlCapability:testRemoteControlCapabilities, + SDLRPCParameterNameVideoStreamingCapability:testVideoStreamingCapability + }; SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithDictionary:dict]; expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeNavigation)); - expect(testStruct.navigationCapability.sendLocationEnabled).to(equal(YES)); - expect(testStruct.navigationCapability.getWayPointsEnabled).to(equal(NO)); - expect(testStruct.phoneCapability.dialNumberEnabled).to(equal(YES)); - expect(testStruct.remoteControlCapability).to(equal(someRemoteControlCapabilities)); + expect(testStruct.appServicesCapabilities).to(equal(testAppServicesCapabilities)); + expect(testStruct.navigationCapability).to(equal(testNavigationCapability)); + expect(testStruct.phoneCapability).to(equal(testPhoneCapability)); + expect(testStruct.remoteControlCapability).to(equal(testRemoteControlCapabilities)); + expect(testStruct.videoStreamingCapability).to(equal(testVideoStreamingCapability)); }); it(@"Should return nil if not set", ^ { SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] init]; expect(testStruct.systemCapabilityType).to(beNil()); + expect(testStruct.appServicesCapabilities).to(beNil()); expect(testStruct.navigationCapability).to(beNil()); expect(testStruct.phoneCapability).to(beNil()); expect(testStruct.videoStreamingCapability).to(beNil()); expect(testStruct.remoteControlCapability).to(beNil()); + }); + it(@"should initialize correctly with initWithAppServicesCapabilities:", ^{ + SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithAppServicesCapabilities:testAppServicesCapabilities]; + + expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeAppServices)); + expect(testStruct.appServicesCapabilities).to(equal(testAppServicesCapabilities)); + expect(testStruct.navigationCapability).to(beNil()); + expect(testStruct.phoneCapability).to(beNil()); + expect(testStruct.remoteControlCapability).to(beNil()); + expect(testStruct.videoStreamingCapability).to(beNil()); }); it(@"should initialize correctly with initWithPhoneCapability:", ^{ @@ -75,10 +99,11 @@ describe(@"Initialization tests", ^{ SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithPhoneCapability:testPhoneStruct]; expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypePhoneCall)); - expect(testStruct.phoneCapability.dialNumberEnabled).to(equal(YES)); + expect(testStruct.appServicesCapabilities).to(beNil()); expect(testStruct.navigationCapability).to(beNil()); - expect(testStruct.videoStreamingCapability).to(beNil()); + expect(testStruct.phoneCapability).to(equal(testPhoneStruct)); expect(testStruct.remoteControlCapability).to(beNil()); + expect(testStruct.videoStreamingCapability).to(beNil()); }); it(@"should initialize correctly with initWithNavigationCapability:", ^{ @@ -86,11 +111,11 @@ describe(@"Initialization tests", ^{ SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithNavigationCapability:testNavStruct]; expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeNavigation)); - expect(testStruct.navigationCapability.sendLocationEnabled).to(equal(YES)); - expect(testStruct.navigationCapability.getWayPointsEnabled).to(equal(YES)); + expect(testStruct.appServicesCapabilities).to(beNil()); + expect(testStruct.navigationCapability).to(equal(testNavStruct)); expect(testStruct.phoneCapability).to(beNil()); - expect(testStruct.videoStreamingCapability).to(beNil()); expect(testStruct.remoteControlCapability).to(beNil()); + expect(testStruct.videoStreamingCapability).to(beNil()); }); it(@"should initialize correctly with initWithVideoStreamingCapability:", ^{ @@ -115,19 +140,22 @@ describe(@"Initialization tests", ^{ SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithVideoStreamingCapability:testVidStruct]; expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeVideoStreaming)); - expect(testStruct.navigationCapability.sendLocationEnabled).to(beNil()); - expect(testStruct.navigationCapability.getWayPointsEnabled).to(beNil()); + expect(testStruct.appServicesCapabilities).to(beNil()); + expect(testStruct.navigationCapability).to(beNil()); expect(testStruct.phoneCapability).to(beNil()); - + expect(testStruct.remoteControlCapability).to(beNil()); + expect(testStruct.videoStreamingCapability).to(equal(testVidStruct)); }); it(@"should initialize correctly with initWithRemoteControlCapability:", ^{ - SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithRemoteControlCapability:someRemoteControlCapabilities]; + SDLSystemCapability *testStruct = [[SDLSystemCapability alloc] initWithRemoteControlCapability:testRemoteControlCapabilities]; expect(testStruct.systemCapabilityType).to(equal(SDLSystemCapabilityTypeRemoteControl)); + expect(testStruct.appServicesCapabilities).to(beNil()); expect(testStruct.navigationCapability).to(beNil()); expect(testStruct.phoneCapability).to(beNil()); - expect(testStruct.remoteControlCapability).to(equal(someRemoteControlCapabilities)); + expect(testStruct.remoteControlCapability).to(equal(testRemoteControlCapabilities)); + expect(testStruct.videoStreamingCapability).to(beNil()); }); }); |