Fixed formatting in MPPHandLandmarkerTests.m
This commit is contained in:
parent
0ae27fad37
commit
94a9464750
|
@ -167,7 +167,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
|
||||
- (MPPHandLandmarker *)createHandLandmarkerWithOptionsSucceeds:
|
||||
(MPPHandLandmarkerOptions *)handLandmarkerOptions {
|
||||
NSError* error;
|
||||
NSError *error;
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[[MPPHandLandmarker alloc] initWithOptions:handLandmarkerOptions error:&error];
|
||||
XCTAssertNotNil(handLandmarker);
|
||||
|
@ -298,10 +298,10 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
options.runningMode = runningModesToTest[i];
|
||||
options.handLandmarkerLiveStreamDelegate = self;
|
||||
|
||||
[self assertCreateHandLandmarkerWithOptions:options
|
||||
[self
|
||||
assertCreateHandLandmarkerWithOptions:options
|
||||
failsWithExpectedError:
|
||||
[NSError
|
||||
errorWithDomain:kExpectedErrorDomain
|
||||
[NSError errorWithDomain:kExpectedErrorDomain
|
||||
code:MPPTasksErrorCodeInvalidArgumentError
|
||||
userInfo:@{
|
||||
NSLocalizedDescriptionKey :
|
||||
|
@ -317,8 +317,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
|
||||
options.runningMode = MPPRunningModeLiveStream;
|
||||
|
||||
[self
|
||||
assertCreateHandLandmarkerWithOptions:options
|
||||
[self assertCreateHandLandmarkerWithOptions:options
|
||||
failsWithExpectedError:
|
||||
[NSError errorWithDomain:kExpectedErrorDomain
|
||||
code:MPPTasksErrorCodeInvalidArgumentError
|
||||
|
@ -335,8 +334,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPHandLandmarkerOptions *options =
|
||||
[self handLandmarkerOptionsWithModelFileInfo:kHandLandmarkerBundleAssetFile];
|
||||
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
MPPHandLandmarker *handLandmarker = [self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
|
||||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
|
@ -375,8 +373,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
[self handLandmarkerOptionsWithModelFileInfo:kHandLandmarkerBundleAssetFile];
|
||||
options.runningMode = MPPRunningModeVideo;
|
||||
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
MPPHandLandmarker *handLandmarker = [self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
|
||||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
|
@ -414,8 +411,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
options.runningMode = MPPRunningModeLiveStream;
|
||||
options.handLandmarkerLiveStreamDelegate = self;
|
||||
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
MPPHandLandmarker *handLandmarker = [self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
|
||||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
|
@ -451,17 +447,16 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
[self handLandmarkerOptionsWithModelFileInfo:kHandLandmarkerBundleAssetFile];
|
||||
options.runningMode = MPPRunningModeVideo;
|
||||
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
MPPHandLandmarker *handLandmarker = [self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
|
||||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
MPPHandLandmarkerResult *handLandmarkerResult =
|
||||
[handLandmarker detectInVideoFrame:image timestampInMilliseconds:i error:nil];
|
||||
MPPHandLandmarkerResult *handLandmarkerResult = [handLandmarker detectInVideoFrame:image
|
||||
timestampInMilliseconds:i
|
||||
error:nil];
|
||||
[self assertHandLandmarkerResult:handLandmarkerResult
|
||||
isApproximatelyEqualToExpectedResult:[MPPHandLandmarkerTests
|
||||
thumbUpHandLandmarkerResult]];
|
||||
isApproximatelyEqualToExpectedResult:[MPPHandLandmarkerTests thumbUpHandLandmarkerResult]];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -476,8 +471,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
|
||||
expectation.expectedFulfillmentCount = 1;
|
||||
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
MPPHandLandmarker *handLandmarker = [self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
|
||||
_outOfOrderTimestampTestDict = @{
|
||||
kLiveStreamTestsDictHandLandmarkerKey : handLandmarker,
|
||||
|
@ -489,9 +483,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
XCTAssertTrue([handLandmarker detectAsyncInImage:image timestampInMilliseconds:1 error:nil]);
|
||||
|
||||
NSError *error;
|
||||
XCTAssertFalse([handLandmarker detectAsyncInImage:image
|
||||
timestampInMilliseconds:0
|
||||
error:&error]);
|
||||
XCTAssertFalse([handLandmarker detectAsyncInImage:image timestampInMilliseconds:0 error:&error]);
|
||||
|
||||
NSError *expectedError =
|
||||
[NSError errorWithDomain:kExpectedErrorDomain
|
||||
|
@ -528,8 +520,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
expectation.expectedFulfillmentCount = iterationCount + 1;
|
||||
expectation.inverted = YES;
|
||||
|
||||
MPPHandLandmarker *handLandmarker =
|
||||
[self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
MPPHandLandmarker *handLandmarker = [self createHandLandmarkerWithOptionsSucceeds:options];
|
||||
|
||||
_liveStreamSucceedsTestDict = @{
|
||||
kLiveStreamTestsDictHandLandmarkerKey : handLandmarker,
|
||||
|
@ -542,9 +533,7 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
MPPImage *image = [self imageWithFileInfo:kThumbUpImage];
|
||||
|
||||
for (int i = 0; i < iterationCount; i++) {
|
||||
XCTAssertTrue([handLandmarker detectAsyncInImage:image
|
||||
timestampInMilliseconds:i
|
||||
error:nil]);
|
||||
XCTAssertTrue([handLandmarker detectAsyncInImage:image timestampInMilliseconds:i error:nil]);
|
||||
}
|
||||
|
||||
NSTimeInterval timeout = 0.5f;
|
||||
|
@ -556,16 +545,13 @@ static NSString *const kLiveStreamTestsDictExpectationKey = @"expectation";
|
|||
timestampInMilliseconds:(NSInteger)timestampInMilliseconds
|
||||
error:(NSError *)error {
|
||||
[self assertHandLandmarkerResult:handLandmarkerResult
|
||||
isApproximatelyEqualToExpectedResult:[MPPHandLandmarkerTests
|
||||
thumbUpHandLandmarkerResult]];
|
||||
isApproximatelyEqualToExpectedResult:[MPPHandLandmarkerTests thumbUpHandLandmarkerResult]];
|
||||
|
||||
if (handLandmarker == _outOfOrderTimestampTestDict[kLiveStreamTestsDictHandLandmarkerKey]) {
|
||||
[_outOfOrderTimestampTestDict[kLiveStreamTestsDictExpectationKey] fulfill];
|
||||
} else if (handLandmarker ==
|
||||
_liveStreamSucceedsTestDict[kLiveStreamTestsDictHandLandmarkerKey]) {
|
||||
} else if (handLandmarker == _liveStreamSucceedsTestDict[kLiveStreamTestsDictHandLandmarkerKey]) {
|
||||
[_liveStreamSucceedsTestDict[kLiveStreamTestsDictExpectationKey] fulfill];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in New Issue
Block a user