summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrettyWhite <geekman3454@protonmail.com>2017-07-31 15:48:01 -0400
committerBrettyWhite <geekman3454@protonmail.com>2017-07-31 15:48:01 -0400
commit6da21259db094bac96a62602c3d7cf7a901dd687 (patch)
treec84d9f9f4d2ff2a6ea419c08dbe408ddf83b2b51
parent14303136cabaa2f9ef95e7bf1e57ab7184ababbd (diff)
downloadsdl_ios-6da21259db094bac96a62602c3d7cf7a901dd687.tar.gz
finished tests
-rw-r--r--SmartDeviceLink-iOS.xcodeproj/project.pbxproj16
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m28
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m28
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingCapabilitySpec.m88
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingFormatSpec.m39
5 files changed, 199 insertions, 0 deletions
diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
index b96c607db..0230bd1a2 100644
--- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
+++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj
@@ -908,6 +908,10 @@
8B7B31A31F2F7FEA00BDC38D /* SDLVideoStreamingFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7B31A11F2F7FEA00BDC38D /* SDLVideoStreamingFormat.m */; };
8B7B31A61F2F875200BDC38D /* SDLVideoStreamingCapability.h in Headers */ = {isa = PBXBuildFile; fileRef = 8B7B31A41F2F875200BDC38D /* SDLVideoStreamingCapability.h */; };
8B7B31A71F2F875200BDC38D /* SDLVideoStreamingCapability.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7B31A51F2F875200BDC38D /* SDLVideoStreamingCapability.m */; };
+ 8B7B31A91F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7B31A81F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m */; };
+ 8B7B31AB1F2FB93500BDC38D /* SDLVideoStreamingCodecSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7B31AA1F2FB93500BDC38D /* SDLVideoStreamingCodecSpec.m */; };
+ 8B7B31AF1F2FBA0200BDC38D /* SDLVideoStreamingCapabilitySpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7B31AE1F2FBA0200BDC38D /* SDLVideoStreamingCapabilitySpec.m */; };
+ 8B7B31B11F2FBD9500BDC38D /* SDLVideoStreamingFormatSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 8B7B31B01F2FBD9500BDC38D /* SDLVideoStreamingFormatSpec.m */; };
97E26DEC1E807AD70074A3C7 /* SDLMutableDataQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 97E26DEA1E807AD70074A3C7 /* SDLMutableDataQueue.h */; };
97E26DED1E807AD70074A3C7 /* SDLMutableDataQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = 97E26DEB1E807AD70074A3C7 /* SDLMutableDataQueue.m */; };
DA0C46AD1DCD35080001F2A8 /* SDLNames.m in Sources */ = {isa = PBXBuildFile; fileRef = DA0C46AC1DCD35080001F2A8 /* SDLNames.m */; };
@@ -1973,6 +1977,10 @@
8B7B31A11F2F7FEA00BDC38D /* SDLVideoStreamingFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingFormat.m; sourceTree = "<group>"; };
8B7B31A41F2F875200BDC38D /* SDLVideoStreamingCapability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLVideoStreamingCapability.h; sourceTree = "<group>"; };
8B7B31A51F2F875200BDC38D /* SDLVideoStreamingCapability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingCapability.m; sourceTree = "<group>"; };
+ 8B7B31A81F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingProtocolSpec.m; sourceTree = "<group>"; };
+ 8B7B31AA1F2FB93500BDC38D /* SDLVideoStreamingCodecSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingCodecSpec.m; sourceTree = "<group>"; };
+ 8B7B31AE1F2FBA0200BDC38D /* SDLVideoStreamingCapabilitySpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingCapabilitySpec.m; sourceTree = "<group>"; };
+ 8B7B31B01F2FBD9500BDC38D /* SDLVideoStreamingFormatSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLVideoStreamingFormatSpec.m; sourceTree = "<group>"; };
97E26DEA1E807AD70074A3C7 /* SDLMutableDataQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLMutableDataQueue.h; sourceTree = "<group>"; };
97E26DEB1E807AD70074A3C7 /* SDLMutableDataQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLMutableDataQueue.m; sourceTree = "<group>"; };
DA0C46AC1DCD35080001F2A8 /* SDLNames.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLNames.m; sourceTree = "<group>"; };
@@ -2175,6 +2183,8 @@
162E82241A9BDE8A00906325 /* SDLWarningLightStatusSpec.m */,
DA9F7E9D1DCC05B900ACAE48 /* SDLWaypointTypeSpec.m */,
162E82251A9BDE8A00906325 /* SDLWiperStatusSpec.m */,
+ 8B7B31A81F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m */,
+ 8B7B31AA1F2FB93500BDC38D /* SDLVideoStreamingCodecSpec.m */,
);
path = EnumSpecs;
sourceTree = "<group>";
@@ -2370,6 +2380,8 @@
162E82B41A9BDE8A00906325 /* SDLVehicleDataResultSpec.m */,
162E82B51A9BDE8A00906325 /* SDLVehicleTypeSpec.m */,
162E82B61A9BDE8A00906325 /* SDLVrHelpItemSpec.m */,
+ 8B7B31AE1F2FBA0200BDC38D /* SDLVideoStreamingCapabilitySpec.m */,
+ 8B7B31B01F2FBD9500BDC38D /* SDLVideoStreamingFormatSpec.m */,
);
path = StructSpecs;
sourceTree = "<group>";
@@ -4786,6 +4798,7 @@
5DCF76FE1ACDDB5A00BB647B /* SDLSendLocationResponseSpec.m in Sources */,
162E837D1A9BDE8B00906325 /* SDLEmergencyEventSpec.m in Sources */,
162E82D31A9BDE8A00906325 /* SDLCarModeStatusSpec.m in Sources */,
+ 8B7B31A91F2FB8BC00BDC38D /* SDLVideoStreamingProtocolSpec.m in Sources */,
162E82EA1A9BDE8B00906325 /* SDLLanguageSpec.m in Sources */,
5D76E3291D3D0A8800647CFA /* SDLFakeViewControllerPresenter.m in Sources */,
162E83331A9BDE8B00906325 /* SDLPerformInteractionSpec.m in Sources */,
@@ -4895,6 +4908,7 @@
162E83071A9BDE8B00906325 /* SDLVehicleDataNotificationStatusSpec.m in Sources */,
5D9F50811BE7E6E300FEF399 /* SDLPermissionsManagerSpec.m in Sources */,
162E83361A9BDE8B00906325 /* SDLRegisterAppInterfaceSpec.m in Sources */,
+ 8B7B31AB1F2FB93500BDC38D /* SDLVideoStreamingCodecSpec.m in Sources */,
162E82DD1A9BDE8B00906325 /* SDLFileTypeSpec.m in Sources */,
162E836A1A9BDE8B00906325 /* SDLSubscribeVehicleDataResponseSpec.m in Sources */,
5D43465B1E6F154400B639C6 /* SDLLogConfigurationSpec.m in Sources */,
@@ -4987,8 +5001,10 @@
DA9F7EAC1DCC062400ACAE48 /* SDLUnsubscribeWaypointsResponseSpec.m in Sources */,
5D43466B1E6F3B4C00B639C6 /* SDLLogFilterSpec.m in Sources */,
162E836B1A9BDE8B00906325 /* SDLSyncPDataResponseSpec.m in Sources */,
+ 8B7B31AF1F2FBA0200BDC38D /* SDLVideoStreamingCapabilitySpec.m in Sources */,
162E839B1A9BDE8B00906325 /* SDLRPCNotificationSpec.m in Sources */,
162E83581A9BDE8B00906325 /* SDLGetVehicleDataResponseSpec.m in Sources */,
+ 8B7B31B11F2FBD9500BDC38D /* SDLVideoStreamingFormatSpec.m in Sources */,
162E831D1A9BDE8B00906325 /* SDLOnSystemRequestSpec.m in Sources */,
162E835D1A9BDE8B00906325 /* SDLReadDIDResponseSpec.m in Sources */,
162E82D41A9BDE8A00906325 /* SDLCharacterSetSpec.m in Sources */,
diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m
new file mode 100644
index 000000000..ce329445f
--- /dev/null
+++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingCodecSpec.m
@@ -0,0 +1,28 @@
+//
+// SDLVideoStreamingCodecSpec.m
+// SmartDeviceLink-iOS
+//
+// Created by Brett McIsaac on 7/31/17.
+// Copyright © 2017 smartdevicelink. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <Quick/Quick.h>
+#import <Nimble/Nimble.h>
+
+#import "SDLVideoStreamingCodec.h"
+
+QuickSpecBegin(SDLVideoStreamingCodecSpec)
+
+describe(@"Individual Enum Value Tests", ^ {
+ it(@"Should match internal values", ^ {
+ expect(SDLVideoStreamingCodecH264).to(equal(@"H264"));
+ expect(SDLVideoStreamingCodecH265).to(equal(@"H265"));
+ expect(SDLVideoStreamingCodecTHEORA).to(equal(@"THEORA"));
+ expect(SDLVideoStreamingCodecVP8).to(equal(@"VP8"));
+ expect(SDLVideoStreamingCodecVP9).to(equal(@"VP9"));
+ });
+});
+
+QuickSpecEnd
diff --git a/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m
new file mode 100644
index 000000000..89df1fc47
--- /dev/null
+++ b/SmartDeviceLinkTests/RPCSpecs/EnumSpecs/SDLVideoStreamingProtocolSpec.m
@@ -0,0 +1,28 @@
+//
+// SDLVideoStreamingProtocolSpec.m
+// SmartDeviceLink-iOS
+//
+// Created by Brett McIsaac on 7/31/17.
+// Copyright © 2017 smartdevicelink. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <Quick/Quick.h>
+#import <Nimble/Nimble.h>
+
+#import "SDLVideoStreamingProtocol.h"
+
+QuickSpecBegin(SDLVideoStreamingProtocolSpec)
+
+describe(@"Individual Enum Value Tests", ^ {
+ it(@"Should match internal values", ^ {
+ expect(SDLVideoStreamingProtocolRTP).to(equal(@"RTP"));
+ expect(SDLVideoStreamingProtocolRAW).to(equal(@"RAW"));
+ expect(SDLVideoStreamingProtocolRTMP).to(equal(@"RTMP"));
+ expect(SDLVideoStreamingProtocolRTSP).to(equal(@"RTSP"));
+ expect(SDLVideoStreamingProtocolWEBM).to(equal(@"WEBM"));
+ });
+});
+
+QuickSpecEnd
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingCapabilitySpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingCapabilitySpec.m
new file mode 100644
index 000000000..1c1d4cee8
--- /dev/null
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingCapabilitySpec.m
@@ -0,0 +1,88 @@
+//
+// SDLVideoStreamingCapabilitySpec.m
+// SmartDeviceLink-iOS
+//
+// Created by Brett McIsaac on 7/28/17.
+// Copyright © 2017 smartdevicelink. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <Quick/Quick.h>
+#import <Nimble/Nimble.h>
+
+#import "SDLNames.h"
+#import "SDLImageResolution.h"
+#import "SDLVideoStreamingCapability.h"
+#import "SDLVideoStreamingCodec.h"
+#import "SDLVideoStreamingFormat.h"
+#import "SDLVideoStreamingProtocol.h"
+
+QuickSpecBegin(SDLVideoStreamingCapabilitySpec)
+
+describe(@"Initialization tests", ^{
+ it(@"Should get correctly when initialized with a dictionary", ^ {
+
+ SDLImageResolution* resolution = [[SDLImageResolution alloc] init];
+ resolution.resolutionWidth = @600;
+ resolution.resolutionHeight = @500;
+
+ NSNumber *maxBitrate = @100;
+
+ SDLVideoStreamingFormat *format1 = [[SDLVideoStreamingFormat alloc] init];
+ format1.codec = SDLVideoStreamingCodecH264;
+ format1.protocol = SDLVideoStreamingProtocolRTP;
+
+ SDLVideoStreamingFormat *format2 = [[SDLVideoStreamingFormat alloc] init];
+ format2.codec = SDLVideoStreamingCodecH265;
+ format2.protocol = SDLVideoStreamingProtocolRTSP;
+
+ NSArray<SDLVideoStreamingFormat *> *formatArray = @[format1, format2];
+
+ NSMutableDictionary* dict = [@{SDLNamePreferredResolution: resolution,
+ SDLNameMaxBitrate: maxBitrate,
+ SDLNameSupportedFormats: formatArray} mutableCopy];
+
+ SDLVideoStreamingCapability* testStruct = [[SDLVideoStreamingCapability alloc] initWithDictionary:dict];
+
+ expect(testStruct.preferredResolution).to(equal(resolution));
+ expect(testStruct.maxBitrate).to(equal(maxBitrate));
+ expect(testStruct.supportedFormats).to(equal(formatArray));
+ });
+
+ it(@"Should return nil if not set", ^ {
+ SDLVideoStreamingCapability* testStruct = [[SDLVideoStreamingCapability alloc] init];
+
+ expect(testStruct.preferredResolution).to(beNil());
+ expect(testStruct.maxBitrate).to(beNil());
+ expect(testStruct.supportedFormats).to(beNil());
+ });
+
+ it(@"Should initialize correctly with initWithVideoStreaming:(SDLImageResolution *)preferredResolution (NSNumber *)maxBitrate (NSArray<SDLVideoStreamingFormat *> *)suportedFormats", ^ {
+
+ SDLImageResolution* resolution = [[SDLImageResolution alloc] init];
+ resolution.resolutionWidth = @600;
+ resolution.resolutionHeight = @500;
+
+ NSNumber *maxBitrate = @100;
+
+ SDLVideoStreamingFormat *format1 = [[SDLVideoStreamingFormat alloc] init];
+ format1.codec = SDLVideoStreamingCodecH264;
+ format1.protocol = SDLVideoStreamingProtocolRTP;
+
+ SDLVideoStreamingFormat *format2 = [[SDLVideoStreamingFormat alloc] init];
+ format2.codec = SDLVideoStreamingCodecH265;
+ format2.protocol = SDLVideoStreamingProtocolRTSP;
+
+ NSArray<SDLVideoStreamingFormat *> *formatArray = @[format1, format2];
+
+ SDLVideoStreamingCapability *testStruct = [[SDLVideoStreamingCapability alloc] initWithVideoStreaming:resolution maxBitrate:maxBitrate supportedFormats:formatArray];
+
+ expect(testStruct.preferredResolution).to(equal(resolution));
+ expect(testStruct.maxBitrate).to(equal(maxBitrate));
+ expect(testStruct.supportedFormats).to(equal(formatArray));
+ });
+
+});
+
+QuickSpecEnd
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingFormatSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingFormatSpec.m
new file mode 100644
index 000000000..551110ee8
--- /dev/null
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLVideoStreamingFormatSpec.m
@@ -0,0 +1,39 @@
+//
+// SDLVideoStreamingFormatSpec.m
+// SmartDeviceLink-iOS
+//
+// Created by Brett McIsaac on 7/28/17.
+// Copyright © 2017 smartdevicelink. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <Quick/Quick.h>
+#import <Nimble/Nimble.h>
+
+#import "SDLNames.h"
+#import "SDLVideoStreamingCodec.h"
+#import "SDLVideoStreamingFormat.h"
+#import "SDLVideoStreamingProtocol.h"
+
+QuickSpecBegin(SDLVideoStreamingFormatSpec)
+
+describe(@"Initialization tests", ^{
+ it(@"Should get correctly when initialized with a dictionary", ^ {
+ NSMutableDictionary* dict = [@{SDLNameVideoProtocol: SDLVideoStreamingProtocolRAW,
+ SDLNameVideoCodec: SDLVideoStreamingCodecH264} mutableCopy];
+ SDLVideoStreamingFormat* testStruct = [[SDLVideoStreamingFormat alloc] initWithDictionary:dict];
+
+ expect(testStruct.protocol).to(equal(SDLVideoStreamingProtocolRAW));
+ expect(testStruct.codec).to(equal(SDLVideoStreamingCodecH264));
+ });
+
+ it(@"Should return nil if not set", ^ {
+ SDLVideoStreamingFormat* testStruct = [[SDLVideoStreamingFormat alloc] init];
+
+ expect(testStruct.protocol).to(beNil());
+ expect(testStruct.codec).to(beNil());
+ });
+});
+
+QuickSpecEnd