summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2016-02-26 09:29:42 -0500
committerJoel Fischer <joeljfischer@gmail.com>2016-02-26 09:29:42 -0500
commit2c6e59a757d0c12a28600545372dc82787ddae9c (patch)
treeabe4de77903a8db3747bc994315073818cd20974
parent12741520edbe2877a59c4ab4520dbaa53897929d (diff)
parentc5aa6e58198c31bb6a966952bafcf6d163e10f59 (diff)
downloadsdl_ios-2c6e59a757d0c12a28600545372dc82787ddae9c.tar.gz
Merge branch 'hotfix/issue_131'
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLSendLocation.m12
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.h7
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/FactorySpecs/SDLRPCRequestFactorySpec.m40
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m190
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLObjectWithPrioritySpec.m43
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m32
-rw-r--r--SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m2
7 files changed, 150 insertions, 176 deletions
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLSendLocation.m b/SmartDeviceLink-iOS/SmartDeviceLink/SDLSendLocation.m
index cbf9d6cd3..7bf1c5c70 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLSendLocation.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLSendLocation.m
@@ -71,6 +71,18 @@
}
}
+- (NSString *)locationDescription {
+ return parameters[NAMES_locationDescription];
+}
+
+- (void)setLocationDescription:(NSString *)locationDescription {
+ if (locationDescription != nil) {
+ parameters[NAMES_locationDescription] = locationDescription;
+ } else {
+ [parameters removeObjectForKey:NAMES_locationDescription];
+ }
+}
+
- (NSArray *)addressLines {
return parameters[NAMES_addressLines];
}
diff --git a/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.h b/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.h
index c11f2791e..d5d9daf6a 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.h
+++ b/SmartDeviceLink-iOS/SmartDeviceLink/SDLUpdateTurnList.h
@@ -15,7 +15,14 @@
- (instancetype)init;
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict;
+/**
+ * Optional, SDLTurn, 1 - 100 entries
+ */
@property (strong) NSMutableArray *turnList;
+
+/**
+ * Required, SDLSoftButton, 0 - 1 Entries
+ */
@property (strong) NSMutableArray *softButtons;
@end
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/FactorySpecs/SDLRPCRequestFactorySpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/FactorySpecs/SDLRPCRequestFactorySpec.m
index 892f4d1ad..1f7da2226 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/FactorySpecs/SDLRPCRequestFactorySpec.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/FactorySpecs/SDLRPCRequestFactorySpec.m
@@ -487,7 +487,10 @@ describe(@"BuildRegisterAppInterface Tests", ^ {
isMediaApp:@YES languageDesired:[SDLLanguage EN_US]
hmiDisplayLanguageDesired:[SDLLanguage ES_MX] appID:@"6h43g"];
- expect(message.syncMsgVersion).to(beNil());
+ expect(message.syncMsgVersion).toNot(beNil());
+ expect(message.syncMsgVersion.majorVersion).to(equal(@1));
+ expect(message.syncMsgVersion.minorVersion).to(equal(@0));
+
expect(message.appName).to(equal(@"Interface"));
expect(message.ttsName).to(equal(ttsName));
expect(message.ngnMediaScreenAppName).to(equal(@"Interface"));
@@ -497,13 +500,16 @@ describe(@"BuildRegisterAppInterface Tests", ^ {
expect(message.hmiDisplayLanguageDesired).to(equal([SDLLanguage ES_MX]));
expect(message.appHMIType).to(beNil());
expect(message.hashID).to(beNil());
- expect(message.deviceInfo).to(beNil());
+ expect(message.deviceInfo).toNot(beNil());
expect(message.appID).to(equal(@"6h43g"));
expect(message.correlationID).to(equal(@1));
message = [SDLRPCRequestFactory buildRegisterAppInterfaceWithAppName:@"Register App Interface" isMediaApp:@NO languageDesired:[SDLLanguage PT_BR] appID:@"36g6rsw4"];
- expect(message.syncMsgVersion).to(beNil());
+ expect(message.syncMsgVersion).toNot(beNil());
+ expect(message.syncMsgVersion.majorVersion).to(equal(@1));
+ expect(message.syncMsgVersion.minorVersion).to(equal(@0));
+
expect(message.appName).to(equal(@"Register App Interface"));
expect(message.ttsName).to(beNil());
expect(message.ngnMediaScreenAppName).to(equal(@"Register App Interface"));
@@ -513,13 +519,16 @@ describe(@"BuildRegisterAppInterface Tests", ^ {
expect(message.hmiDisplayLanguageDesired).to(equal([SDLLanguage PT_BR]));
expect(message.appHMIType).to(beNil());
expect(message.hashID).to(beNil());
- expect(message.deviceInfo).to(beNil());
+ expect(message.deviceInfo).toNot(beNil());
expect(message.appID).to(equal(@"36g6rsw4"));
expect(message.correlationID).to(equal(@1));
message = [SDLRPCRequestFactory buildRegisterAppInterfaceWithAppName:@"..." languageDesired:[SDLLanguage CS_CZ] appID:@"56ht5j"];
- expect(message.syncMsgVersion).to(beNil());
+ expect(message.syncMsgVersion).toNot(beNil());
+ expect(message.syncMsgVersion.majorVersion).to(equal(@1));
+ expect(message.syncMsgVersion.minorVersion).to(equal(@0));
+
expect(message.appName).to(equal(@"..."));
expect(message.ttsName).to(beNil());
expect(message.ngnMediaScreenAppName).to(equal(@"..."));
@@ -529,7 +538,7 @@ describe(@"BuildRegisterAppInterface Tests", ^ {
expect(message.hmiDisplayLanguageDesired).to(equal([SDLLanguage CS_CZ]));
expect(message.appHMIType).to(beNil());
expect(message.hashID).to(beNil());
- expect(message.deviceInfo).to(beNil());
+ expect(message.deviceInfo).toNot(beNil());
expect(message.appID).to(equal(@"56ht5j"));
expect(message.correlationID).to(equal(@1));
});
@@ -940,19 +949,26 @@ describe(@"BuildSubscribeVehicleData Tests", ^ {
});
describe(@"SDLUpdateTurnList Tests", ^ {
- __block NSMutableArray *softButtons = nil;
- __block NSMutableArray *turnImages = nil;
+ __block NSMutableArray<SDLSoftButton *> *softButtons = nil;
+ __block NSMutableArray<SDLTurn *> *turns = nil;
__block SDLUpdateTurnList *message = nil;
+ __block SDLTurn *turn1 = nil;
+ __block SDLTurn *turn2 = nil;
+
describe(@"Should build correctly", ^ {
beforeEach(^{
softButtons = [@[[[SDLSoftButton alloc] init]] mutableCopy];
- turnImages = [@[@"Image 1", @"Image 2", @"Image 3"] mutableCopy];
- message = [SDLRPCRequestFactory buildUpdateTurnListWithTurnList:turnImages softButtons:softButtons correlationID:@1234];
+
+ turn1 = [[SDLTurn alloc] init];
+ turn2 = [[SDLTurn alloc] init];
+ turns = [@[turn1, turn2] mutableCopy];
+
+ message = [SDLRPCRequestFactory buildUpdateTurnListWithTurnList:turns softButtons:softButtons correlationID:@1234];
});
- it(@"Should properly set Turn imaged", ^{
- expect(message.turnList).to(equal(turnImages));
+ it(@"Should properly set Turns", ^{
+ expect(message.turnList).to(equal(turns));
});
it(@"Should properly set Soft Buttons", ^{
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m
index cfd0a4abf..ccd4bafdb 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/RPCSpecs/RequestSpecs/SDLSendLocationSpec.m
@@ -27,100 +27,58 @@ describe(@"Send Location RPC", ^{
});
context(@"when parameters are set correctly", ^{
- context(@"when parameters are set with immutable properties", ^{
- beforeEach(^{
- someLongitude = @123.4567;
- someLatitude = @65.4321;
- someLocation = @"Livio";
- someLocationDescription = @"A great place to work";
- someAddressLines = @[@"3136 Hilton Rd", @"Ferndale, MI", @"48220"];
- somePhoneNumber = @"248-591-0333";
- someImage = [[SDLImage alloc] init];
-
- testRequest.longitudeDegrees = someLongitude;
- testRequest.latitudeDegrees = someLatitude;
- testRequest.locationName = someLocation;
- testRequest.locationDescription = someLocationDescription;
- testRequest.addressLines = someAddressLines;
- testRequest.phoneNumber = somePhoneNumber;
- testRequest.locationImage = someImage;
- });
-
- // Since all the properties are immutable, a copy should be executed as a retain, which means they should be identical
- it(@"should get longitude correctly", ^{
- expect(testRequest.longitudeDegrees).to(equal(someLongitude));
- expect(testRequest.longitudeDegrees).to(beIdenticalTo(someLongitude));
- });
-
- it(@"should get latitude correctly", ^{
- expect(testRequest.latitudeDegrees).to(equal(someLatitude));
- expect(testRequest.latitudeDegrees).to(beIdenticalTo(someLatitude));
- });
-
- it(@"should get location correctly", ^{
- expect(testRequest.locationName).to(equal(someLocation));
- expect(testRequest.locationName).to(beIdenticalTo(someLocation));
- });
-
- it(@"should get location description correctly", ^{
- expect(testRequest.locationDescription).to(equal(someLocationDescription));
- expect(testRequest.locationDescription).to(beIdenticalTo(someLocationDescription));
- });
-
- it(@"should get address lines correctly", ^{
- expect(testRequest.addressLines).to(equal(someAddressLines));
- expect(testRequest.addressLines).to(beIdenticalTo(someAddressLines));
- });
-
- it(@"should get phone number correctly", ^{
- expect(testRequest.phoneNumber).to(equal(somePhoneNumber));
- expect(testRequest.phoneNumber).to(beIdenticalTo(somePhoneNumber));
- });
+ beforeEach(^{
+ someLongitude = @123.4567;
+ someLatitude = @65.4321;
+ someLocation = @"Livio";
+ someLocationDescription = @"A great place to work";
+ someAddressLines = @[@"3136 Hilton Rd", @"Ferndale, MI", @"48220"];
+ somePhoneNumber = @"248-591-0333";
+ someImage = [[SDLImage alloc] init];
- it(@"should get image correctly", ^{
- expect(testRequest.locationImage).to(equal(someImage));
- expect(testRequest.locationImage).to(beIdenticalTo(someImage));
- });
+ testRequest.longitudeDegrees = someLongitude;
+ testRequest.latitudeDegrees = someLatitude;
+ testRequest.locationName = someLocation;
+ testRequest.locationDescription = someLocationDescription;
+ testRequest.addressLines = someAddressLines;
+ testRequest.phoneNumber = somePhoneNumber;
+ testRequest.locationImage = someImage;
});
- context(@"when strings and arrays are set with mutable properties", ^{
- beforeEach(^{
- someLocation = [NSMutableString stringWithString:@"Livio"];
- someLocationDescription = [NSMutableString stringWithString:@"A great place to work"];
- someAddressLines = [NSMutableArray arrayWithArray:@[@"3136 Hilton Rd", @"Ferndale, MI", @"48220"]];
- somePhoneNumber = [NSMutableString stringWithString:@"248-591-0333"];
-
- testRequest.locationName = someLocation;
- testRequest.locationDescription = someLocationDescription;
- testRequest.addressLines = someAddressLines;
- testRequest.phoneNumber = somePhoneNumber;
- });
-
- // Since all the properties tested are mutable, they should be copied, and therefore not identical
- it(@"should get location correctly", ^{
- expect(testRequest.locationName).to(equal(someLocation));
- expect(testRequest.locationName).toNot(beIdenticalTo(someLocation));
- });
-
- it(@"should get location description correctly", ^{
- expect(testRequest.locationDescription).to(equal(someLocationDescription));
- expect(testRequest.locationDescription).toNot(beIdenticalTo(someLocationDescription));
- });
-
- it(@"should get address lines correctly", ^{
- expect(testRequest.addressLines).to(equal(someAddressLines));
- expect(testRequest.addressLines).toNot(beIdenticalTo(someAddressLines));
- });
-
- it(@"should get phone number correctly", ^{
- expect(testRequest.phoneNumber).to(equal(somePhoneNumber));
- expect(testRequest.phoneNumber).toNot(beIdenticalTo(somePhoneNumber));
- });
-
- it(@"should get image correctly", ^{
- expect(testRequest.locationImage).to(equal(someImage));
- expect(testRequest.locationImage).toNot(beIdenticalTo(someImage));
- });
+ // Since all the properties are immutable, a copy should be executed as a retain, which means they should be identical
+ it(@"should get longitude correctly", ^{
+ expect(testRequest.longitudeDegrees).to(equal(someLongitude));
+ expect(testRequest.longitudeDegrees).to(beIdenticalTo(someLongitude));
+ });
+
+ it(@"should get latitude correctly", ^{
+ expect(testRequest.latitudeDegrees).to(equal(someLatitude));
+ expect(testRequest.latitudeDegrees).to(beIdenticalTo(someLatitude));
+ });
+
+ it(@"should get location correctly", ^{
+ expect(testRequest.locationName).to(equal(someLocation));
+ expect(testRequest.locationName).to(beIdenticalTo(someLocation));
+ });
+
+ it(@"should get location description correctly", ^{
+ expect(testRequest.locationDescription).to(equal(someLocationDescription));
+ expect(testRequest.locationDescription).to(beIdenticalTo(someLocationDescription));
+ });
+
+ it(@"should get address lines correctly", ^{
+ expect(testRequest.addressLines).to(equal(someAddressLines));
+ expect(testRequest.addressLines).to(beIdenticalTo(someAddressLines));
+ });
+
+ it(@"should get phone number correctly", ^{
+ expect(testRequest.phoneNumber).to(equal(somePhoneNumber));
+ expect(testRequest.phoneNumber).to(beIdenticalTo(somePhoneNumber));
+ });
+
+ it(@"should get image correctly", ^{
+ expect(testRequest.locationImage).to(equal(someImage));
+ expect(testRequest.locationImage).to(beIdenticalTo(someImage));
});
});
@@ -174,7 +132,7 @@ describe(@"Send Location RPC", ^{
NAMES_locationDescription: someLocationDescription,
NAMES_addressLines: someAddressLines,
NAMES_phoneNumber: somePhoneNumber,
- NAMES_image: someImage
+ NAMES_locationImage: someImage
}
}
};
@@ -218,54 +176,6 @@ describe(@"Send Location RPC", ^{
expect(testRequest.locationImage).to(beIdenticalTo(someImage));
});
});
-
- context(@"when strings and arrays are set with mutable properties", ^{
- beforeEach(^{
- someLocation = [NSMutableString stringWithString:@"Livio"];
- someLocationDescription = [NSMutableString stringWithString:@"A great place to work"];
- someAddressLines = [NSMutableArray arrayWithArray:@[@"3136 Hilton Rd", @"Ferndale, MI", @"48220"]];
- somePhoneNumber = [NSMutableString stringWithString:@"248-591-0333"];
-
- NSDictionary *initDict = @{
- NAMES_request: @{
- NAMES_parameters: @{
- NAMES_locationName: someLocation,
- NAMES_locationDescription: someLocationDescription,
- NAMES_addressLines: someAddressLines,
- NAMES_phoneNumber: somePhoneNumber
- }
- }
- };
-
- testRequest = [[SDLSendLocation alloc] initWithDictionary:[NSMutableDictionary dictionaryWithDictionary:initDict]];
- });
-
- // Since all the properties tested are mutable, they should be copied, and therefore not identical
- it(@"should get location correctly", ^{
- expect(testRequest.locationName).to(equal(someLocation));
- expect(testRequest.locationName).toNot(beIdenticalTo(someLocation));
- });
-
- it(@"should get location description correctly", ^{
- expect(testRequest.locationDescription).to(equal(someLocationDescription));
- expect(testRequest.locationDescription).toNot(beIdenticalTo(someLocationDescription));
- });
-
- it(@"should get address lines correctly", ^{
- expect(testRequest.addressLines).to(equal(someAddressLines));
- expect(testRequest.addressLines).toNot(beIdenticalTo(someAddressLines));
- });
-
- it(@"should get phone number correctly", ^{
- expect(testRequest.phoneNumber).to(equal(somePhoneNumber));
- expect(testRequest.phoneNumber).toNot(beIdenticalTo(somePhoneNumber));
- });
-
- it(@"should get image correctly", ^{
- expect(testRequest.locationImage).to(equal(someImage));
- expect(testRequest.locationImage).toNot(beIdenticalTo(someImage));
- });
- });
context(@"when parameters are not set", ^{
beforeEach(^{
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLObjectWithPrioritySpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLObjectWithPrioritySpec.m
index dd8348e89..73ca3f7ea 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLObjectWithPrioritySpec.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLObjectWithPrioritySpec.m
@@ -12,23 +12,42 @@
QuickSpecBegin(SDLObjectWithPrioritySpec)
describe(@"a prioritized object", ^{
- it(@"should initialize properly", ^{
- SDLObjectWithPriority *object = [[SDLObjectWithPriority alloc] init];
+ __block SDLObjectWithPriority *testObject = nil;
+
+ beforeEach(^{
+ testObject = [[SDLObjectWithPriority alloc] init];
+ });
+
+ describe(@"should initialize properly", ^{
+ it(@"should not be nil", ^{
+ expect(testObject).toNot(beNil());
+ });
- expect(object).toNot(beNil());
- expect(object.object).to(beNil());
- expect(@(object.priority)).to(equal(@0));
+ it(@"should store a nil object", ^{
+ expect(testObject.object).to(beNil());
+ });
+
+ it(@"should have a priority of 0", ^{
+ expect(@(testObject.priority)).to(equal(@(NSIntegerMax)));
+ });
});
- it(@"should store an object properly", ^{
- NSString *testString = @"TestString";
- SDLObjectWithPriority *object = [[SDLObjectWithPriority alloc] init];
+ describe(@"should store an object properly", ^{
+ __block NSString *testString = nil;
+
+ beforeEach(^{
+ testString = @"TestString";
+ testObject.object = testString;
+ testObject.priority = 100;
+ });
- object.object = testString;
- object.priority = 100;
+ it(@"should store the string as it's object", ^{
+ expect(testObject.object).to(equal(testString));
+ });
- expect(object.object).to(equal(testString));
- expect(@(object.priority)).to(equal(@100));
+ it(@"should set the priority as specified", ^{
+ expect(@(testObject.priority)).to(equal(@100));
+ });
});
});
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m
index d4b1a6674..d417d6d1d 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/Prioritized Objects/SDLPrioritizedObjectCollectionSpec.m
@@ -48,19 +48,29 @@ describe(@"a prioritized object collection", ^{
});
describe(@"should retrieve higher priority objects first", ^{
- NSString *highPriorityString = @"highPriority";
- NSString *mediumPriorityString = @"mediumPriority";
- NSString *lowPriorityString = @"lowPriority";
+ __block id firstObjectOut = nil;
+ __block id secondObjectOut = nil;
+ __block id thirdObjectOut = nil;
- // Add them in "incorrect" order to make sure sorting works correctly.
- // Lower numbers indicate higher priority
- [collection addObject:mediumPriorityString withPriority:100];
- [collection addObject:lowPriorityString withPriority:200];
- [collection addObject:highPriorityString withPriority:0];
+ __block NSString *highPriorityString = nil;
+ __block NSString *mediumPriorityString = nil;
+ __block NSString *lowPriorityString = nil;
- id firstObjectOut = [collection nextObject];
- id secondObjectOut = [collection nextObject];
- id thirdObjectOut = [collection nextObject];
+ beforeEach(^{
+ highPriorityString = @"highPriority";
+ mediumPriorityString = @"mediumPriority";
+ lowPriorityString = @"lowPriority";
+
+ // Add them in "incorrect" order to make sure sorting works correctly.
+ // Lower numbers indicate higher priority
+ [collection addObject:mediumPriorityString withPriority:100];
+ [collection addObject:lowPriorityString withPriority:200];
+ [collection addObject:highPriorityString withPriority:0];
+
+ firstObjectOut = [collection nextObject];
+ secondObjectOut = [collection nextObject];
+ thirdObjectOut = [collection nextObject];
+ });
it(@"should retrieve the highest priority first", ^{
expect(firstObjectOut).to(equal(highPriorityString));
diff --git a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
index 1c310e558..8acaaadcf 100644
--- a/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
+++ b/SmartDeviceLink-iOS/SmartDeviceLinkTests/UtilitiesSpecs/SDLGlobalsSpec.m
@@ -8,7 +8,7 @@ QuickSpecBegin(SDLGlobalsSpec)
describe(@"The SDLGlobals class", ^{
__block SDLGlobals *testGlobals = nil;
__block NSNumber *v1And2MTUSize = @1024;
- __block NSNumber *v3And4MTUSize = @128000;
+ __block NSNumber *v3And4MTUSize = @131084;
beforeEach(^{
testGlobals = [[SDLGlobals alloc] init];