summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Fischer <joeljfischer@gmail.com>2021-03-17 15:35:45 -0400
committerJoel Fischer <joeljfischer@gmail.com>2021-03-17 15:35:45 -0400
commit325a53ca7165321b21cb7fa42b55e284c5121633 (patch)
treede12017aafb8e9437ea1c92046ccd17a0ca803ce
parent77207a76cb11f271807054473357161270262ed8 (diff)
downloadsdl_ios-325a53ca7165321b21cb7fa42b55e284c5121633.tar.gz
Fixes for tests and Obj-C example appbugfix/issue-1945-swift-naming-fixes
* Fixed SeekStreamingIndicator tests for updated initializer * Added StreamingMediaConfiguration tests for added initializer and fixed tests * Fixed ChoiceSet tests for updated timeout behavior * Fixed Obj-C example app for deprecated code
-rw-r--r--Example Apps/Example ObjC/MenuManager.m2
-rw-r--r--Example Apps/Example ObjC/VehicleDataManager.m5
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m8
-rw-r--r--SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m52
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeekStreamingIndicatorSpec.m13
5 files changed, 63 insertions, 17 deletions
diff --git a/Example Apps/Example ObjC/MenuManager.m b/Example Apps/Example ObjC/MenuManager.m
index be553c459..d78be2b8f 100644
--- a/Example Apps/Example ObjC/MenuManager.m
+++ b/Example Apps/Example ObjC/MenuManager.m
@@ -62,7 +62,7 @@ NS_ASSUME_NONNULL_BEGIN
}
+ (NSArray<NSString *> *)sdlex_allVehicleDataTypes {
- return @[ACAccelerationPedalPositionMenuName, ACAirbagStatusMenuName, ACBeltStatusMenuName, ACBodyInformationMenuName, ACClusterModeStatusMenuName, ACDeviceStatusMenuName, ACDriverBrakingMenuName, ACECallInfoMenuName, ACElectronicParkBrakeStatus, ACEmergencyEventMenuName, ACEngineOilLifeMenuName, ACEngineTorqueMenuName, ACExternalTemperatureMenuName, ACFuelLevelMenuName, ACFuelLevelStateMenuName, ACFuelRangeMenuName, ACGearStatusMenuName, ACGPSMenuName, ACHeadLampStatusMenuName, ACInstantFuelConsumptionMenuName, ACMyKeyMenuName, ACOdometerMenuName, ACPRNDLMenuName, ACRPMMenuName, ACSpeedMenuName, ACSteeringWheelAngleMenuName, ACTirePressureMenuName, ACTurnSignalMenuName, ACVINMenuName, ACWiperStatusMenuName];
+ return @[ACAccelerationPedalPositionMenuName, ACAirbagStatusMenuName, ACBeltStatusMenuName, ACBodyInformationMenuName, ACClusterModeStatusMenuName, ACDeviceStatusMenuName, ACDriverBrakingMenuName, ACECallInfoMenuName, ACElectronicParkBrakeStatus, ACEmergencyEventMenuName, ACEngineOilLifeMenuName, ACEngineTorqueMenuName, ACFuelLevelMenuName, ACFuelLevelStateMenuName, ACFuelRangeMenuName, ACGearStatusMenuName, ACGPSMenuName, ACHeadLampStatusMenuName, ACInstantFuelConsumptionMenuName, ACMyKeyMenuName, ACOdometerMenuName, ACPRNDLMenuName, ACRPMMenuName, ACSpeedMenuName, ACSteeringWheelAngleMenuName, ACTirePressureMenuName, ACTurnSignalMenuName, ACVINMenuName, ACWiperStatusMenuName];
}
+ (SDLMenuCell *)sdlex_menuCellShowPerformInteractionWithManager:(SDLManager *)manager performManager:(PerformInteractionManager *)performManager {
diff --git a/Example Apps/Example ObjC/VehicleDataManager.m b/Example Apps/Example ObjC/VehicleDataManager.m
index 26384a902..a4c4514e6 100644
--- a/Example Apps/Example ObjC/VehicleDataManager.m
+++ b/Example Apps/Example ObjC/VehicleDataManager.m
@@ -213,11 +213,6 @@ NS_ASSUME_NONNULL_BEGIN
vehicleDataDescription = vehicleData.engineOilLife.description;
} else if ([vehicleDataType isEqualToString:ACEngineTorqueMenuName]) {
vehicleDataDescription = vehicleData.engineTorque.description;
- } else if ([vehicleDataType isEqualToString:ACExternalTemperatureMenuName]) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- vehicleDataDescription = vehicleData.externalTemperature.description;
-#pragma clang diagnostic pop
} else if ([vehicleDataType isEqualToString:ACFuelLevelMenuName]) {
vehicleDataDescription = vehicleData.fuelRange.firstObject.level.description;
} else if ([vehicleDataType isEqualToString:ACFuelLevelStateMenuName]) {
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m
index 54084c213..110a6c53a 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLChoiceSetSpec.m
@@ -135,12 +135,14 @@ describe(@"an SDLChoiceSet", ^{
expect(testChoiceSet).to(beNil());
});
- it(@"should return nil with too short or too long timeout", ^{
+ it(@"should cap the timeout when too long or too short", ^{
testChoiceSet = [[SDLChoiceSet alloc] initWithTitle:testTitle delegate:testDelegate layout:testLayout timeout:4.9 initialPromptString:nil timeoutPromptString:nil helpPromptString:nil vrHelpList:nil choices:@[testCell]];
- expect(testChoiceSet).to(beNil());
+ expect(testChoiceSet).toNot(beNil());
+ expect(testChoiceSet.timeout).to(beCloseTo(5.0));
testChoiceSet = [[SDLChoiceSet alloc] initWithTitle:testTitle delegate:testDelegate layout:testLayout timeout:100.1 initialPromptString:nil timeoutPromptString:nil helpPromptString:nil vrHelpList:nil choices:@[testCell]];
- expect(testChoiceSet).to(beNil());
+ expect(testChoiceSet).toNot(beNil());
+ expect(testChoiceSet.timeout).to(beCloseTo(100.0));
});
it(@"should return nil with too short or too long title", ^{
diff --git a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m
index 5132e0551..c1dd911b4 100644
--- a/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m
+++ b/SmartDeviceLinkTests/DevAPISpecs/SDLStreamingMediaConfigurationSpec.m
@@ -1,11 +1,14 @@
#import <Quick/Quick.h>
#import <Nimble/Nimble.h>
+#import <OCMock/OCMock.h>
#import <VideoToolbox/VideoToolbox.h>
#import "SDLStreamingMediaConfiguration.h"
#import "SDLFakeSecurityManager.h"
#import "SDLFakeStreamingManagerDataSource.h"
+#import "SDLImageResolution.h"
+#import "SDLVideoStreamingRange.h"
QuickSpecBegin(SDLStreamingMediaConfigurationSpec)
@@ -15,21 +18,45 @@ describe(@"a streaming media configuration", ^{
__block UIViewController *testViewController = nil;
__block SDLStreamingEncryptionFlag testEncryptionFlag = SDLStreamingEncryptionFlagNone;
__block SDLFakeStreamingManagerDataSource *testDataSource = nil;
+ __block id<SDLStreamingVideoDelegate> testDelegate = nil;
__block NSDictionary<NSString *, id> *testVideoEncoderSettings = nil;
+ __block SDLVideoStreamingRange *testLandscapeRange = nil;
+ __block SDLVideoStreamingRange *testPortraitRange = nil;
beforeEach(^{
testFakeSecurityManager = [[SDLFakeSecurityManager alloc] init];
testDataSource = [[SDLFakeStreamingManagerDataSource alloc] init];
+ testDelegate = OCMProtocolMock(@protocol(SDLStreamingVideoDelegate));
testVideoEncoderSettings = @{
(__bridge NSString *)kVTCompressionPropertyKey_ExpectedFrameRate : @1
};
testViewController = [[UIViewController alloc] init];
testEncryptionFlag = SDLStreamingEncryptionFlagAuthenticateAndEncrypt;
+ testLandscapeRange = [[SDLVideoStreamingRange alloc] initWithMinimumResolution:[[SDLImageResolution alloc] initWithWidth:100 height:100] maximumResolution:[[SDLImageResolution alloc] initWithWidth:200 height:200]];
+ testPortraitRange = [[SDLVideoStreamingRange alloc] initWithMinimumResolution:[[SDLImageResolution alloc] initWithWidth:50 height:50] maximumResolution:[[SDLImageResolution alloc] initWithWidth:150 height:150]];
});
context(@"That is created without the default secure/insecure settings", ^{
+ it(@"should properly set all properties with initWithEncryptionFlag:videoSettings:supportedLandscapeRange:supportedPortraitRange:dataSource:delegate:rootViewController:", ^{
+ testConfig = [[SDLStreamingMediaConfiguration alloc] initWithEncryptionFlag:testEncryptionFlag videoSettings:testVideoEncoderSettings supportedLandscapeRange:testLandscapeRange supportedPortraitRange:testPortraitRange dataSource:testDataSource delegate:testDelegate rootViewController:testViewController];
+
+ expect(@(testConfig.maximumDesiredEncryption)).to(equal(@(testEncryptionFlag)));
+ expect(testConfig.customVideoEncoderSettings).to(equal(testVideoEncoderSettings));
+ expect(testConfig.allowMultipleViewControllerOrientations).to(equal(NO));
+ expect(testConfig.dataSource).to(equal(testDataSource));
+ expect(testConfig.rootViewController).to(equal(testViewController));
+ expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
+ expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(equal(testDelegate));
+ expect(testConfig.supportedPortraitStreamingRange).to(equal(testPortraitRange));
+ expect(testConfig.supportedLandscapeStreamingRange).to(equal(testLandscapeRange));
+ });
+
it(@"should have properly set all properties with initWithEncryptionFlag:videoSettings:dataSource:rootViewController:", ^{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
testConfig = [[SDLStreamingMediaConfiguration alloc] initWithEncryptionFlag:testEncryptionFlag videoSettings:testVideoEncoderSettings dataSource:testDataSource rootViewController:testViewController];
+#pragma clang diagnostic pop
expect(@(testConfig.maximumDesiredEncryption)).to(equal(@(testEncryptionFlag)));
expect(testConfig.customVideoEncoderSettings).to(equal(testVideoEncoderSettings));
@@ -38,6 +65,9 @@ describe(@"a streaming media configuration", ^{
expect(testConfig.rootViewController).to(equal(testViewController));
expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(beNil());
+ expect(testConfig.supportedPortraitStreamingRange).to(beNil());
+ expect(testConfig.supportedLandscapeStreamingRange).to(beNil());
});
it(@"should have properly set and insecure configuration with init", ^{
@@ -50,6 +80,9 @@ describe(@"a streaming media configuration", ^{
expect(testConfig.rootViewController).to(beNil());
expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(beNil());
+ expect(testConfig.supportedPortraitStreamingRange).to(beNil());
+ expect(testConfig.supportedLandscapeStreamingRange).to(beNil());
});
});
@@ -64,6 +97,9 @@ describe(@"a streaming media configuration", ^{
expect(testConfig.rootViewController).to(beNil());
expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(beNil());
+ expect(testConfig.supportedPortraitStreamingRange).to(beNil());
+ expect(testConfig.supportedLandscapeStreamingRange).to(beNil());
});
it(@"should have properly set properties with autostreamingInsecureConfigurationWithInitialViewController", ^{
@@ -76,6 +112,9 @@ describe(@"a streaming media configuration", ^{
expect(testConfig.rootViewController).to(equal(testViewController));
expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(beNil());
+ expect(testConfig.supportedPortraitStreamingRange).to(beNil());
+ expect(testConfig.supportedLandscapeStreamingRange).to(beNil());
});
});
@@ -90,6 +129,9 @@ describe(@"a streaming media configuration", ^{
expect(testConfig.rootViewController).to(beNil());
expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(beNil());
+ expect(testConfig.supportedPortraitStreamingRange).to(beNil());
+ expect(testConfig.supportedLandscapeStreamingRange).to(beNil());
});
it(@"should have properly set properties with autostreamingSecureConfigurationWithInitialViewController:", ^{
@@ -102,15 +144,18 @@ describe(@"a streaming media configuration", ^{
expect(testConfig.rootViewController).to(equal(testViewController));
expect(@(testConfig.carWindowRenderingType)).to(equal(@(SDLCarWindowRenderingTypeLayer)));
expect(testConfig.enableForcedFramerateSync).to(beTrue());
+ expect(testConfig.delegate).to(beNil());
+ expect(testConfig.supportedPortraitStreamingRange).to(beNil());
+ expect(testConfig.supportedLandscapeStreamingRange).to(beNil());
});
});
- context(@"copying a filter", ^{
+ context(@"copying a configuration", ^{
__block SDLStreamingMediaConfiguration *testStreamingMediaConfiguration = nil;
__block SDLStreamingMediaConfiguration *testCopiedStreamingMediaConfiguration = nil;
beforeEach(^{
- testStreamingMediaConfiguration = [[SDLStreamingMediaConfiguration alloc] initWithEncryptionFlag:testEncryptionFlag videoSettings:testVideoEncoderSettings dataSource:testDataSource rootViewController:testViewController];
+ testStreamingMediaConfiguration = [[SDLStreamingMediaConfiguration alloc] initWithEncryptionFlag:testEncryptionFlag videoSettings:testVideoEncoderSettings supportedLandscapeRange:testLandscapeRange supportedPortraitRange:testPortraitRange dataSource:testDataSource delegate:testDelegate rootViewController:testViewController];
testCopiedStreamingMediaConfiguration = [testStreamingMediaConfiguration copy];
});
@@ -123,6 +168,9 @@ describe(@"a streaming media configuration", ^{
expect(@(testCopiedStreamingMediaConfiguration.carWindowRenderingType)).to(equal(testStreamingMediaConfiguration.carWindowRenderingType));
expect(testCopiedStreamingMediaConfiguration.enableForcedFramerateSync).to(equal(testStreamingMediaConfiguration.enableForcedFramerateSync));
expect(testCopiedStreamingMediaConfiguration.allowMultipleViewControllerOrientations).to(equal(testStreamingMediaConfiguration.allowMultipleViewControllerOrientations));
+ expect(testCopiedStreamingMediaConfiguration.delegate).to(equal(testStreamingMediaConfiguration.delegate));
+ expect(testCopiedStreamingMediaConfiguration.supportedPortraitStreamingRange).to(equal(testStreamingMediaConfiguration.supportedPortraitStreamingRange));
+ expect(testCopiedStreamingMediaConfiguration.supportedLandscapeStreamingRange).to(equal(testStreamingMediaConfiguration.supportedLandscapeStreamingRange));
});
});
});
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeekStreamingIndicatorSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeekStreamingIndicatorSpec.m
index e47a77392..7478d366e 100644
--- a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeekStreamingIndicatorSpec.m
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLSeekStreamingIndicatorSpec.m
@@ -18,11 +18,12 @@
QuickSpecBegin(SDLSeekStreamingIndicatorSpec)
describe(@"Getter/Setter Tests", ^ {
+ __block NSUInteger testSeekTimeInt = 10;
__block NSNumber<SDLUInt> *testSeekTime = nil;
__block SDLSeekIndicatorType testSeekIndicatorType = nil;
beforeEach(^{
- testSeekTime = [[NSNumber alloc] initWithInt:10.0];
+ testSeekTime = [[NSNumber alloc] initWithUnsignedInteger:testSeekTimeInt];
testSeekIndicatorType = SDLSeekIndicatorTypeTime;
});
@@ -32,7 +33,7 @@ describe(@"Getter/Setter Tests", ^ {
testStruct.seekTime = testSeekTime;
testStruct.type = testSeekIndicatorType;
- expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithInt:10.0]));
+ expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithUnsignedInteger:testSeekTimeInt]));
expect(testStruct.type).to(equal(SDLSeekIndicatorTypeTime));
});
@@ -43,7 +44,7 @@ describe(@"Getter/Setter Tests", ^ {
};
SDLSeekStreamingIndicator* testStruct = [[SDLSeekStreamingIndicator alloc] initWithDictionary:dict];
- expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithInt:10.0]));
+ expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithUnsignedInteger:testSeekTimeInt]));
expect(testStruct.type).to(equal(SDLSeekIndicatorTypeTime));
});
@@ -57,14 +58,14 @@ describe(@"Getter/Setter Tests", ^ {
it(@"Should set with initWithType:seekTime: correctly", ^ {
SDLSeekStreamingIndicator *testStruct = [[SDLSeekStreamingIndicator alloc] initWithType:testSeekIndicatorType seekTime:testSeekTime];
- expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithInt:10.0]));
+ expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithUnsignedInteger:testSeekTimeInt]));
expect(testStruct.type).to(equal(SDLSeekIndicatorTypeTime));
});
it(@"Should set with initWithType:seekTime: correctly", ^ {
- SDLSeekStreamingIndicator *testStruct = [SDLSeekStreamingIndicator seekIndicatorWithSeekTime:testSeekTime];
+ SDLSeekStreamingIndicator *testStruct = [SDLSeekStreamingIndicator seekIndicatorWithSeekTime:testSeekTimeInt];
- expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithInt:10.0]));
+ expect(testStruct.seekTime).to(equal([[NSNumber alloc] initWithUnsignedInteger:testSeekTimeInt]));
expect(testStruct.type).to(equal(SDLSeekIndicatorTypeTime));
});