summaryrefslogtreecommitdiff
path: root/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m
diff options
context:
space:
mode:
authorSho Amano <samano@xevo.com>2018-08-09 21:01:58 +0900
committerSho Amano <samano@xevo.com>2018-08-09 22:32:13 +0900
commitf0cff660f098eea0a1d48979734516a4965c44c0 (patch)
tree04893006d6f63ec2360ae8e1f2f4ceacff6c3c44 /SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m
parent114f9c69f68b0255331236585a338e49069dd62e (diff)
parent3cb0f3be950203b8c0737ffe36debb2628d8d707 (diff)
downloadsdl_ios-f0cff660f098eea0a1d48979734516a4965c44c0.tar.gz
Merge branch 'develop' into feature/multiple_transports
Conflicts: SmartDeviceLink-iOS.xcodeproj/project.pbxproj SmartDeviceLink/SDLCarWindow.m SmartDeviceLink/SDLLifecycleManager.m SmartDeviceLink/SDLStreamingAudioLifecycleManager.h SmartDeviceLink/SDLStreamingAudioLifecycleManager.m SmartDeviceLink/SDLStreamingMediaManager.m SmartDeviceLink/SDLStreamingVideoLifecycleManager.h SmartDeviceLink/SDLStreamingVideoLifecycleManager.m SmartDeviceLinkTests/DevAPISpecs/SDLStreamingVideoLifecycleManagerSpec.m SmartDeviceLinkTests/SDLStreamingMediaLifecycleManagerSpec.m SmartDeviceLinkTests/SDLStreamingVideoLifecycleManagerSpec.m
Diffstat (limited to 'SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m')
-rw-r--r--SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m71
1 files changed, 71 insertions, 0 deletions
diff --git a/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m
new file mode 100644
index 000000000..f12cbc52b
--- /dev/null
+++ b/SmartDeviceLinkTests/RPCSpecs/StructSpecs/SDLAudioControlDataSpec.m
@@ -0,0 +1,71 @@
+//
+// SDLAudioControlDataSpec.m
+// SmartDeviceLinkTests
+//
+
+#import <Foundation/Foundation.h>
+
+#import <Quick/Quick.h>
+#import <Nimble/Nimble.h>
+
+#import "SDLAudioControlData.h"
+#import "SDLPrimaryAudioSource.h"
+#import "SDLEqualizerSettings.h"
+#import "SDLNames.h"
+
+
+QuickSpecBegin( SDLAudioControlDataSpec)
+
+SDLEqualizerSettings *someEqualizerSettings = [[SDLEqualizerSettings alloc] init];
+
+describe(@"Getter/Setter Tests", ^ {
+ it(@"Should set and get correctly", ^ {
+ SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] init];
+
+ testStruct.source = SDLPrimaryAudioSourceCD;
+ testStruct.keepContext = @(NO);
+ testStruct.volume = @(NO);
+ testStruct.equalizerSettings = [@[someEqualizerSettings] copy];
+
+ expect(testStruct.source).to(equal(SDLPrimaryAudioSourceCD));
+ expect(testStruct.keepContext).to(equal(@(NO)));
+ expect(testStruct.volume).to(equal(@(NO)));
+ expect(testStruct.equalizerSettings).to(equal([@[someEqualizerSettings] copy]));
+ });
+
+ it(@"Should set and get correctly", ^ {
+ SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] initWithSource:SDLPrimaryAudioSourceCD keepContext:@(NO) volume:@32 equalizerSettings:[@[someEqualizerSettings] copy]];
+
+ expect(testStruct.source).to(equal(SDLPrimaryAudioSourceCD));
+ expect(testStruct.keepContext).to(equal(@(NO)));
+ expect(testStruct.volume).to(equal(@32));
+ expect(testStruct.equalizerSettings).to(equal([@[someEqualizerSettings] copy]));
+ });
+
+ it(@"Should get correctly when initialized", ^ {
+ NSMutableDictionary* dict = [@{SDLNameSource:SDLPrimaryAudioSourceCD,
+ SDLNameKeepContext:@(NO),
+ SDLNameVolume:@(NO),
+ SDLNameEqualizerSettings:[@[someEqualizerSettings] copy]
+ } mutableCopy];
+ SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] initWithDictionary:dict];
+
+ expect(testStruct.source).to(equal(SDLPrimaryAudioSourceCD));
+ expect(testStruct.keepContext).to(equal(@(NO)));
+ expect(testStruct.volume).to(equal(@(NO)));
+ expect(testStruct.equalizerSettings).to(equal([@[someEqualizerSettings] copy]));
+
+ });
+
+ it(@"Should return nil if not set", ^ {
+ SDLAudioControlData* testStruct = [[SDLAudioControlData alloc] init];
+
+ expect(testStruct.source).to(beNil());
+ expect(testStruct.keepContext).to(beNil());
+ expect(testStruct.volume).to(beNil());
+ expect(testStruct.equalizerSettings).to(beNil());
+
+ });
+});
+
+QuickSpecEnd