summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2018-10-03 09:54:53 -0400
committerJoel Fischer <joeljfischer@gmail.com>2018-10-03 09:54:53 -0400
commit52862c414145cdd1dc7e3b874e5edcd5e4bbc03b (patch)
treed8244b9083ecb4655523f1eedf4f2033a869360a
parent883a58baef6bc82b1a94a7b3e98fbae81c08d44b (diff)
downloadsdl_ios-52862c414145cdd1dc7e3b874e5edcd5e4bbc03b.tar.gz
Add initializer and test cases
-rw-r--r--SmartDeviceLink/SDLAudioControlCapabilities.h2
-rw-r--r--SmartDeviceLink/SDLAudioControlCapabilities.m3
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m9
3 files changed, 11 insertions, 3 deletions
diff --git a/SmartDeviceLink/SDLAudioControlCapabilities.h b/SmartDeviceLink/SDLAudioControlCapabilities.h
index 54c861c64..b7f29a01c 100644
--- a/SmartDeviceLink/SDLAudioControlCapabilities.h
+++ b/SmartDeviceLink/SDLAudioControlCapabilities.h
@@ -25,7 +25,7 @@ NS_ASSUME_NONNULL_BEGIN
@param equalizerMaxChannelID Equalizer channel ID (between 1-100).
@return An instance of the SDLAudioControlCapabilities class.
*/
-- (instancetype)initWithModuleName:(NSString *)name sourceAvailable:(nullable NSNumber<SDLBool> *)sourceAvailable volueAvailable:(nullable NSNumber<SDLBool> *)volumeAvailable equalizerAvailable:(nullable NSNumber<SDLBool> *)equalizerAvailable equalizerMaxChannelID:(nullable NSNumber<SDLInt> *)equalizerMaxChannelID;
+- (instancetype)initWithModuleName:(NSString *)name sourceAvailable:(nullable NSNumber<SDLBool> *)sourceAvailable keepContextAvailable:(nullable NSNumber<SDLBool> *)keepContextAvailable volumeAvailable:(nullable NSNumber<SDLBool> *)volumeAvailable equalizerAvailable:(nullable NSNumber<SDLBool> *)equalizerAvailable equalizerMaxChannelID:(nullable NSNumber<SDLInt> *)equalizerMaxChannelID;
/**
* @abstract The short friendly name of the audio control module.
diff --git a/SmartDeviceLink/SDLAudioControlCapabilities.m b/SmartDeviceLink/SDLAudioControlCapabilities.m
index 4ec2d6385..e0d64d4da 100644
--- a/SmartDeviceLink/SDLAudioControlCapabilities.m
+++ b/SmartDeviceLink/SDLAudioControlCapabilities.m
@@ -19,13 +19,14 @@ NS_ASSUME_NONNULL_BEGIN
return self;
}
-- (instancetype)initWithModuleName:(NSString *)name sourceAvailable:(nullable NSNumber<SDLBool> *)sourceAvailable volueAvailable:(nullable NSNumber<SDLBool> *)volumeAvailable equalizerAvailable:(nullable NSNumber<SDLBool> *)equalizerAvailable equalizerMaxChannelID:(nullable NSNumber<SDLInt> *)equalizerMaxChannelID {
+- (instancetype)initWithModuleName:(NSString *)name sourceAvailable:(nullable NSNumber<SDLBool> *)sourceAvailable keepContextAvailable:(nullable NSNumber<SDLBool> *)keepContextAvailable volumeAvailable:(nullable NSNumber<SDLBool> *)volumeAvailable equalizerAvailable:(nullable NSNumber<SDLBool> *)equalizerAvailable equalizerMaxChannelID:(nullable NSNumber<SDLInt> *)equalizerMaxChannelID {
self = [self init];
if (!self) {
return nil;
}
self.moduleName = name;
self.sourceAvailable = sourceAvailable;
+ self.keepContextAvailable = keepContextAvailable;
self.volumeAvailable = volumeAvailable;
self.equalizerAvailable = equalizerAvailable;
self.equalizerMaxChannelId = equalizerMaxChannelID;
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m
index 0e01a3680..f785e9bce 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlCapabilitiesSpec.m
@@ -20,11 +20,13 @@ describe(@"Getter/Setter Tests", ^ {
testStruct.moduleName = @"module";
testStruct.sourceAvailable = @(YES);
+ testStruct.keepContextAvailable = @YES;
testStruct.volumeAvailable = @(NO);
testStruct.equalizerAvailable = @(NO);
testStruct.equalizerMaxChannelId = @56;
expect(testStruct.moduleName).to(equal(@"module"));
+ expect(testStruct.keepContextAvailable).to(equal(@YES));
expect(testStruct.sourceAvailable).to(equal(@(YES)));
expect(testStruct.volumeAvailable).to(equal(@(NO)));
expect(testStruct.equalizerAvailable).to(equal(@(NO)));
@@ -36,16 +38,18 @@ describe(@"Getter/Setter Tests", ^ {
expect(testStruct.moduleName).to(equal(@"module"));
expect(testStruct.sourceAvailable).to(beNil());
+ expect(testStruct.keepContextAvailable).to(beNil());
expect(testStruct.volumeAvailable).to(beNil());
expect(testStruct.equalizerAvailable).to(beNil());
expect(testStruct.equalizerMaxChannelId).to(beNil());
});
it(@"Should set and get correctly", ^ {
- SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] initWithModuleName:@"module" sourceAvailable:@NO volueAvailable:@YES equalizerAvailable:@NO equalizerMaxChannelID:@34];
+ SDLAudioControlCapabilities* testStruct = [[SDLAudioControlCapabilities alloc] initWithModuleName:@"module" sourceAvailable:@NO keepContextAvailable:@NO volumeAvailable:@YES equalizerAvailable:@NO equalizerMaxChannelID:@34];
expect(testStruct.moduleName).to(equal(@"module"));
expect(testStruct.sourceAvailable).to(equal(@(NO)));
+ expect(testStruct.keepContextAvailable).to(equal(@NO));
expect(testStruct.volumeAvailable).to(equal(@(YES)));
expect(testStruct.equalizerAvailable).to(equal(@(NO)));
expect(testStruct.equalizerMaxChannelId).to(equal(@34));
@@ -54,6 +58,7 @@ describe(@"Getter/Setter Tests", ^ {
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary* dict = [@{SDLNameModuleName:@"module",
SDLNameSourceAvailable:@(NO),
+ SDLNameKeepContextAvailable: @YES,
SDLNameVolumeAvailable:@(YES),
SDLNameEqualizerAvailable:@(NO),
SDLNameEqualizerMaxChannelId:@12
@@ -62,6 +67,7 @@ describe(@"Getter/Setter Tests", ^ {
expect(testStruct.moduleName).to(equal(@"module"));
expect(testStruct.sourceAvailable).to(equal(@(NO)));
+ expect(testStruct.keepContextAvailable).to(equal(@YES));
expect(testStruct.volumeAvailable).to(equal(@(YES)));
expect(testStruct.equalizerAvailable).to(equal(@(NO)));
expect(testStruct.equalizerMaxChannelId).to(equal(@12));
@@ -73,6 +79,7 @@ describe(@"Getter/Setter Tests", ^ {
expect(testStruct.moduleName).to(beNil());
expect(testStruct.sourceAvailable).to(beNil());
+ expect(testStruct.keepContextAvailable).to(beNil());
expect(testStruct.volumeAvailable).to(beNil());
expect(testStruct.equalizerAvailable).to(beNil());
expect(testStruct.equalizerMaxChannelId).to(beNil());