blob: ec9dc417960d9d909bc2e3d253e6d69d9ec00c56 [file] [log] [blame]
Anders Carlsson79ce8202018-06-01 10:51:091/*
2 * Copyright 2018 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
Anders Carlsson7bca8ca2018-08-30 07:30:2911#import "components/video_codec/RTCH264ProfileLevelId.h"
Anders Carlsson79ce8202018-06-01 10:51:0912
13#import <XCTest/XCTest.h>
14
15@interface RTCH264ProfileLevelIdTests : XCTestCase
16
17@end
18
19static NSString *level31ConstrainedHigh = @"640c1f";
20static NSString *level31ConstrainedBaseline = @"42e01f";
21
22@implementation RTCH264ProfileLevelIdTests
23
24- (void)testInitWithString {
Mirko Bonadeia81e9c82020-05-04 14:14:3225 RTC_OBJC_TYPE(RTCH264ProfileLevelId) *profileLevelId =
26 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithHexString:level31ConstrainedHigh];
Anders Carlsson79ce8202018-06-01 10:51:0927 XCTAssertEqual(profileLevelId.profile, RTCH264ProfileConstrainedHigh);
28 XCTAssertEqual(profileLevelId.level, RTCH264Level3_1);
29
Mirko Bonadeia81e9c82020-05-04 14:14:3230 profileLevelId =
31 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithHexString:level31ConstrainedBaseline];
Anders Carlsson79ce8202018-06-01 10:51:0932 XCTAssertEqual(profileLevelId.profile, RTCH264ProfileConstrainedBaseline);
33 XCTAssertEqual(profileLevelId.level, RTCH264Level3_1);
34}
35
36- (void)testInitWithProfileAndLevel {
Mirko Bonadeia81e9c82020-05-04 14:14:3237 RTC_OBJC_TYPE(RTCH264ProfileLevelId) *profileLevelId =
38 [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc] initWithProfile:RTCH264ProfileConstrainedHigh
39 level:RTCH264Level3_1];
Anders Carlsson79ce8202018-06-01 10:51:0940 XCTAssertEqualObjects(profileLevelId.hexString, level31ConstrainedHigh);
41
Mirko Bonadeia81e9c82020-05-04 14:14:3242 profileLevelId = [[RTC_OBJC_TYPE(RTCH264ProfileLevelId) alloc]
43 initWithProfile:RTCH264ProfileConstrainedBaseline
44 level:RTCH264Level3_1];
Anders Carlsson79ce8202018-06-01 10:51:0945 XCTAssertEqualObjects(profileLevelId.hexString, level31ConstrainedBaseline);
46}
47
48@end