summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Elias <francois.elias@livio.io>2020-09-17 15:36:46 -0400
committerFrank Elias <francois.elias@livio.io>2020-09-17 15:36:46 -0400
commit9a16ac2e307929b920861940abb1f18a2df5ce07 (patch)
treec65fdb8520a4a50b2ea072253a793b5472105d69
parent01cfe4c0a817b9058f5a5c7db9d372472a0d03ac (diff)
downloadsdl_ios-bugfix/issue-1771-SetGlobalProperties-init-missing-userLocation.tar.gz
set init from generator file
-rw-r--r--SmartDeviceLink/public/SDLSetGlobalProperties.h6
-rw-r--r--SmartDeviceLink/public/SDLSetGlobalProperties.m14
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetGlobalPropertiesSpec.m102
3 files changed, 90 insertions, 32 deletions
diff --git a/SmartDeviceLink/public/SDLSetGlobalProperties.h b/SmartDeviceLink/public/SDLSetGlobalProperties.h
index a4ed7f9e3..bb2adaa9d 100644
--- a/SmartDeviceLink/public/SDLSetGlobalProperties.h
+++ b/SmartDeviceLink/public/SDLSetGlobalProperties.h
@@ -74,8 +74,8 @@ NS_ASSUME_NONNULL_BEGIN
/**
Initialize SetGlobalProperties with all possible items
- @param helpText A string that will be turned into TTS chunks for the help prompt
- @param timeoutText A string that will be turned into TTS chunks for the timeout prompt
+ @param helpPrompt A string that will be turned into TTS chunks for the help prompt
+ @param timeoutPrompt A string that will be turned into TTS chunks for the timeout prompt
@param vrHelpTitle The title of the help interface prompt
@param vrHelp The items of the help interface prompt
@param menuTitle The title of the menu button
@@ -86,7 +86,7 @@ NS_ASSUME_NONNULL_BEGIN
@return The SetGlobalProperties RPC
*/
-- (instancetype)initWithHelpText:(nullable NSString *)helpText timeoutText:(nullable NSString *)timeoutText vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp menuTitle:(nullable NSString *)menuTitle menuIcon:(nullable SDLImage *)menuIcon keyboardProperties:(nullable SDLKeyboardProperties *)keyboardProperties userLocation:(nullable SDLSeatLocation *)userLocation menuLayout:(nullable SDLMenuLayout)menuLayout;
+- (instancetype)initWithUserLocation:(nullable SDLSeatLocation *)userLocation helpPrompt:(nullable NSArray<SDLTTSChunk *> *)helpPrompt timeoutPrompt:(nullable NSArray<SDLTTSChunk *> *)timeoutPrompt vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp menuTitle:(nullable NSString *)menuTitle menuIcon:(nullable SDLImage *)menuIcon keyboardProperties:(nullable SDLKeyboardProperties *)keyboardProperties menuLayout:(nullable SDLMenuLayout)menuLayout;
/**
Help prompt for when the user asks for help with an interface prompt
diff --git a/SmartDeviceLink/public/SDLSetGlobalProperties.m b/SmartDeviceLink/public/SDLSetGlobalProperties.m
index a58999c00..b0638fbd4 100644
--- a/SmartDeviceLink/public/SDLSetGlobalProperties.m
+++ b/SmartDeviceLink/public/SDLSetGlobalProperties.m
@@ -27,29 +27,29 @@ NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic pop
- (instancetype)initWithHelpText:(nullable NSString *)helpText timeoutText:(nullable NSString *)timeoutText {
- return [self initWithHelpText:helpText timeoutText:timeoutText vrHelpTitle:nil vrHelp:nil menuTitle:nil menuIcon:nil keyboardProperties:nil menuLayout:nil];
+ return [self initWithUserLocation:nil helpPrompt:[SDLTTSChunk textChunksFromString:helpText] timeoutPrompt:[SDLTTSChunk textChunksFromString:timeoutText] vrHelpTitle:nil vrHelp:nil menuTitle:nil menuIcon:nil keyboardProperties:nil menuLayout:nil];
}
- (instancetype)initWithHelpText:(nullable NSString *)helpText timeoutText:(nullable NSString *)timeoutText vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp {
- return [self initWithHelpText:helpText timeoutText:timeoutText vrHelpTitle:vrHelpTitle vrHelp:vrHelp menuTitle:nil menuIcon:nil keyboardProperties:nil menuLayout:nil];
+ return [self initWithUserLocation:nil helpPrompt:[SDLTTSChunk textChunksFromString:helpText] timeoutPrompt:[SDLTTSChunk textChunksFromString:timeoutText] vrHelpTitle:vrHelpTitle vrHelp:vrHelp menuTitle:nil menuIcon:nil keyboardProperties:nil menuLayout:nil];
}
- (instancetype)initWithHelpText:(nullable NSString *)helpText timeoutText:(nullable NSString *)timeoutText vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp menuTitle:(nullable NSString *)menuTitle menuIcon:(nullable SDLImage *)menuIcon keyboardProperties:(nullable SDLKeyboardProperties *)keyboardProperties {
- return [self initWithHelpText:helpText timeoutText:timeoutText vrHelpTitle:vrHelpTitle vrHelp:vrHelp menuTitle:menuTitle menuIcon:menuIcon keyboardProperties:keyboardProperties menuLayout:nil];
+ return [self initWithUserLocation:nil helpPrompt:[SDLTTSChunk textChunksFromString:helpText] timeoutPrompt:[SDLTTSChunk textChunksFromString:timeoutText] vrHelpTitle:vrHelpTitle vrHelp:vrHelp menuTitle:menuTitle menuIcon:menuIcon keyboardProperties:keyboardProperties menuLayout:nil];
}
- (instancetype)initWithHelpText:(nullable NSString *)helpText timeoutText:(nullable NSString *)timeoutText vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp menuTitle:(nullable NSString *)menuTitle menuIcon:(nullable SDLImage *)menuIcon keyboardProperties:(nullable SDLKeyboardProperties *)keyboardProperties menuLayout:(nullable SDLMenuLayout)menuLayout {
- return [self initWithHelpText:helpText timeoutText:timeoutText vrHelpTitle:vrHelpTitle vrHelp:vrHelp menuTitle:menuTitle menuIcon:menuIcon keyboardProperties:keyboardProperties userLocation:nil menuLayout:menuLayout];
+ return [self initWithUserLocation:nil helpPrompt:[SDLTTSChunk textChunksFromString:helpText] timeoutPrompt:[SDLTTSChunk textChunksFromString:timeoutText] vrHelpTitle:vrHelpTitle vrHelp:vrHelp menuTitle:menuTitle menuIcon:menuIcon keyboardProperties:keyboardProperties menuLayout:menuLayout];
}
-- (instancetype)initWithHelpText:(nullable NSString *)helpText timeoutText:(nullable NSString *)timeoutText vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp menuTitle:(nullable NSString *)menuTitle menuIcon:(nullable SDLImage *)menuIcon keyboardProperties:(nullable SDLKeyboardProperties *)keyboardProperties userLocation:(nullable SDLSeatLocation *)userLocation menuLayout:(nullable SDLMenuLayout)menuLayout {
+- (instancetype)initWithUserLocation:(nullable SDLSeatLocation *)userLocation helpPrompt:(nullable NSArray<SDLTTSChunk *> *)helpPrompt timeoutPrompt:(nullable NSArray<SDLTTSChunk *> *)timeoutPrompt vrHelpTitle:(nullable NSString *)vrHelpTitle vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp menuTitle:(nullable NSString *)menuTitle menuIcon:(nullable SDLImage *)menuIcon keyboardProperties:(nullable SDLKeyboardProperties *)keyboardProperties menuLayout:(nullable SDLMenuLayout)menuLayout {
self = [self init];
if (!self) {
return nil;
}
- self.helpPrompt = [SDLTTSChunk textChunksFromString:helpText];
- self.timeoutPrompt = [SDLTTSChunk textChunksFromString:timeoutText];
+ self.helpPrompt = helpPrompt;
+ self.timeoutPrompt = timeoutPrompt;
self.vrHelpTitle = vrHelpTitle;
self.vrHelp = [vrHelp mutableCopy];
self.menuTitle = menuTitle;
diff --git a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetGlobalPropertiesSpec.m b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetGlobalPropertiesSpec.m
index 413c95542..411f97831 100644
--- a/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetGlobalPropertiesSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSetGlobalPropertiesSpec.m
@@ -22,8 +22,8 @@ QuickSpecBegin(SDLSetGlobalPropertiesSpec)
NSString *menuTitle = @"TheNewMenu";
NSString *vrHelpTitle = @"vr";
-NSString *helpTest =@"TheHelpText";
-NSString *timeoutTest =@"timeout Test";
+NSString *helpTest = @"TheHelpText";
+NSString *timeoutTest = @"timeout Test";
SDLTTSChunk* chunk1 = [[SDLTTSChunk alloc] init];
SDLTTSChunk* chunk2 = [[SDLTTSChunk alloc] init];
SDLVRHelpItem* help = [[SDLVRHelpItem alloc] init];
@@ -35,19 +35,19 @@ describe(@"Getter/Setter Tests", ^ {
it(@"Should set and get correctly", ^ {
SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] init];
- testRequest.helpPrompt = [@[chunk1] mutableCopy];
- testRequest.timeoutPrompt = [@[chunk2] mutableCopy];
+ testRequest.helpPrompt = @[chunk1];
+ testRequest.timeoutPrompt = @[chunk2];
testRequest.vrHelpTitle = vrHelpTitle;
- testRequest.vrHelp = [@[help] mutableCopy];
+ testRequest.vrHelp = @[help];
testRequest.menuTitle = menuTitle;
testRequest.menuIcon = image;
testRequest.keyboardProperties = keyboard;
testRequest.userLocation = seatLocation;
- expect(testRequest.helpPrompt).to(equal([@[chunk1] mutableCopy]));
- expect(testRequest.timeoutPrompt).to(equal([@[chunk2] mutableCopy]));
+ expect(testRequest.helpPrompt).to(equal(@[chunk1]));
+ expect(testRequest.timeoutPrompt).to(equal(@[chunk2]));
expect(testRequest.vrHelpTitle).to(equal(vrHelpTitle));
- expect(testRequest.vrHelp).to(equal([@[help] mutableCopy]));
+ expect(testRequest.vrHelp).to(equal(@[help]));
expect(testRequest.menuTitle).to(equal(menuTitle));
expect(testRequest.menuIcon).to(equal(image));
expect(testRequest.keyboardProperties).to(equal(keyboard));
@@ -57,10 +57,10 @@ describe(@"Getter/Setter Tests", ^ {
it(@"Should get correctly when initialized", ^ {
NSMutableDictionary<NSString *, id> *dict = [@{SDLRPCParameterNameRequest:
@{SDLRPCParameterNameParameters:
- @{SDLRPCParameterNameHelpPrompt:[@[chunk1] mutableCopy],
- SDLRPCParameterNameTimeoutPrompt:[@[chunk2] mutableCopy],
+ @{SDLRPCParameterNameHelpPrompt:@[chunk1],
+ SDLRPCParameterNameTimeoutPrompt:@[chunk2],
SDLRPCParameterNameVRHelpTitle:vrHelpTitle,
- SDLRPCParameterNameVRHelp:[@[help] mutableCopy],
+ SDLRPCParameterNameVRHelp:@[help],
SDLRPCParameterNameMenuTitle:menuTitle,
SDLRPCParameterNameUserLocation: seatLocation,
SDLRPCParameterNameMenuIcon:image,
@@ -71,10 +71,10 @@ describe(@"Getter/Setter Tests", ^ {
SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithDictionary:dict];
#pragma clang diagnostic pop
- expect(testRequest.helpPrompt).to(equal([@[chunk1] mutableCopy]));
- expect(testRequest.timeoutPrompt).to(equal([@[chunk2] mutableCopy]));
+ expect(testRequest.helpPrompt).to(equal(@[chunk1]));
+ expect(testRequest.timeoutPrompt).to(equal(@[chunk2]));
expect(testRequest.vrHelpTitle).to(equal(vrHelpTitle));
- expect(testRequest.vrHelp).to(equal([@[help] mutableCopy]));
+ expect(testRequest.vrHelp).to(equal(@[help]));
expect(testRequest.menuTitle).to(equal(menuTitle));
expect(testRequest.menuIcon).to(equal(image));
expect(testRequest.keyboardProperties).to(equal(keyboard));
@@ -94,24 +94,82 @@ describe(@"Getter/Setter Tests", ^ {
expect(testRequest.userLocation).to(beNil());
});
- it(@"Should return new init", ^ {
- SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest vrHelpTitle:vrHelpTitle vrHelp:[@[help] mutableCopy] menuTitle:menuTitle menuIcon:image keyboardProperties:keyboard menuLayout:nil];
+ it(@"Should init correctly with initWithUserLocation:helpPrompt:timeoutPrompt:vrHelpTitle:vrHelp:menuTitle:menuIcon:keyboardProperties:menuLayout:", ^ {
+ SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithUserLocation:seatLocation helpPrompt:[SDLTTSChunk textChunksFromString:helpTest] timeoutPrompt:[SDLTTSChunk textChunksFromString:timeoutTest] vrHelpTitle:vrHelpTitle vrHelp:@[help] menuTitle:menuTitle menuIcon:image keyboardProperties:keyboard menuLayout:nil];
- SDLSetGlobalProperties* testRequest2 = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest vrHelpTitle:vrHelpTitle vrHelp:[@[help] mutableCopy] menuTitle:menuTitle menuIcon:image keyboardProperties:keyboard userLocation:nil menuLayout:nil];
+ expect(testRequest.helpPrompt).to(equal([SDLTTSChunk textChunksFromString:helpTest]));
+ expect(testRequest.timeoutPrompt).to(equal([SDLTTSChunk textChunksFromString:timeoutTest]));
+ expect(testRequest.vrHelpTitle).to(equal(vrHelpTitle));
+ expect(testRequest.vrHelp).to(equal(@[help]));
+ expect(testRequest.menuTitle).to(equal(menuTitle));
+ expect(testRequest.menuIcon).to(equal(image));
+ expect(testRequest.userLocation).to(equal(seatLocation));
+ expect(testRequest.keyboardProperties).to(equal(keyboard));
+ expect(testRequest.menuLayout).to(beNil());
+ });
- expect(testRequest).to(equal(testRequest2));
+ it(@"Should init correctly with initWithHelpText:timeoutText:", ^{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ SDLSetGlobalProperties *testRequest = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest];
+#pragma clang diagnostic pop
+ expect(testRequest.helpPrompt).to(equal([SDLTTSChunk textChunksFromString:helpTest]));
+ expect(testRequest.timeoutPrompt).to(equal([SDLTTSChunk textChunksFromString:timeoutTest]));
+ expect(testRequest.vrHelpTitle).to(beNil());
+ expect(testRequest.vrHelp).to(beNil());
+ expect(testRequest.menuTitle).to(beNil());
+ expect(testRequest.menuIcon).to(beNil());
+ expect(testRequest.userLocation).to(beNil());
+ expect(testRequest.keyboardProperties).to(beNil());
+ expect(testRequest.menuLayout).to(beNil());
+ });
+
+ it(@"Should init correctly with initWithHelpText:timeoutText:vrHelpTitle:vrHelp:", ^{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ SDLSetGlobalProperties *testRequest = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest vrHelpTitle:vrHelpTitle vrHelp:@[help]];
+#pragma clang diagnostic pop
+ expect(testRequest.helpPrompt).to(equal([SDLTTSChunk textChunksFromString:helpTest]));
+ expect(testRequest.timeoutPrompt).to(equal([SDLTTSChunk textChunksFromString:timeoutTest]));
+ expect(testRequest.vrHelpTitle).to(equal(vrHelpTitle));
+ expect(testRequest.vrHelp).to(equal(@[help]));
+ expect(testRequest.menuTitle).to(beNil());
+ expect(testRequest.menuIcon).to(beNil());
+ expect(testRequest.userLocation).to(beNil());
+ expect(testRequest.keyboardProperties).to(beNil());
+ expect(testRequest.menuLayout).to(beNil());
});
- it(@"Should set initWithHelpText", ^ {
- SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest vrHelpTitle:vrHelpTitle vrHelp:[@[help] mutableCopy] menuTitle:menuTitle menuIcon:image keyboardProperties:keyboard userLocation:seatLocation menuLayout:nil];
+ it(@"Should init correctly with initWithHelpText:timeoutText:vrHelpTitle:vrHelp:menuTitle:menuIcon:keyboardProperties:", ^ {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest vrHelpTitle:vrHelpTitle vrHelp:@[help] menuTitle:menuTitle menuIcon:image keyboardProperties:keyboard];
+#pragma clang diagnostic pop
expect(testRequest.helpPrompt).to(equal([SDLTTSChunk textChunksFromString:helpTest]));
expect(testRequest.timeoutPrompt).to(equal([SDLTTSChunk textChunksFromString:timeoutTest]));
expect(testRequest.vrHelpTitle).to(equal(vrHelpTitle));
- expect(testRequest.vrHelp).to(equal([@[help] mutableCopy]));
+ expect(testRequest.vrHelp).to(equal(@[help]));
expect(testRequest.menuTitle).to(equal(menuTitle));
expect(testRequest.menuIcon).to(equal(image));
- expect(testRequest.userLocation).to(equal(seatLocation));
+ expect(testRequest.userLocation).to(beNil());
+ expect(testRequest.keyboardProperties).to(equal(keyboard));
+ expect(testRequest.menuLayout).to(beNil());
+ });
+
+ it(@"Should init correctly with initWithHelpText:timeoutText:vrHelpTitle:vrHelp:menuTitle:menuIcon:keyboardProperties:menuLayout:", ^ {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ SDLSetGlobalProperties* testRequest = [[SDLSetGlobalProperties alloc] initWithHelpText:helpTest timeoutText:timeoutTest vrHelpTitle:vrHelpTitle vrHelp:@[help] menuTitle:menuTitle menuIcon:image keyboardProperties:keyboard menuLayout:nil];
+#pragma clang diagnostic pop
+
+ expect(testRequest.helpPrompt).to(equal([SDLTTSChunk textChunksFromString:helpTest]));
+ expect(testRequest.timeoutPrompt).to(equal([SDLTTSChunk textChunksFromString:timeoutTest]));
+ expect(testRequest.vrHelpTitle).to(equal(vrHelpTitle));
+ expect(testRequest.vrHelp).to(equal(@[help]));
+ expect(testRequest.menuTitle).to(equal(menuTitle));
+ expect(testRequest.menuIcon).to(equal(image));
+ expect(testRequest.userLocation).to(beNil());
expect(testRequest.keyboardProperties).to(equal(keyboard));
expect(testRequest.menuLayout).to(beNil());
});