Removed few test from MPPGestureRecognizerTests.m
This commit is contained in:
parent
365956807d
commit
c87e21206a
|
@ -296,116 +296,4 @@ static const float kLandmarksErrorTolerance = 0.03f;
|
||||||
AssertGestureRecognizerResultIsEmpty(gestureRecognizerResult);
|
AssertGestureRecognizerResultIsEmpty(gestureRecognizerResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)testRecognizeWithScoreThresholdSucceeds {
|
|
||||||
MPPGestureRecognizerOptions *gestureRecognizerOptions =
|
|
||||||
[self gestureRecognizerOptionsWithModelFileInfo:kGestureRecognizerBundleAssetFile];
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions = [[MPPClassifierOptions alloc] init];
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions.scoreThreshold = 0.5f;
|
|
||||||
|
|
||||||
MPPGestureRecognizer *gestureRecognizer =
|
|
||||||
[self createGestureRecognizerWithOptionsSucceeds:gestureRecognizerOptions];
|
|
||||||
|
|
||||||
MPPGestureRecognizerResult *gestureRecognizerResult =
|
|
||||||
[self recognizeImageWithFileInfo:kThumbUpImage usingGestureRecognizer:gestureRecognizer];
|
|
||||||
|
|
||||||
MPPGestureRecognizerResult *expectedGestureRecognizerResult =
|
|
||||||
[MPPGestureRecognizerTests thumbUpGestureRecognizerResult];
|
|
||||||
|
|
||||||
XCTAssertTrue(gestureRecognizerResult.gestures.count == 1);
|
|
||||||
AssertEqualGestures(gestureRecognizerResult.gestures[0][0],
|
|
||||||
expectedGestureRecognizerResult.gestures[0][0], 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testRecognizeWithNumHandsSucceeds {
|
|
||||||
MPPGestureRecognizerOptions *gestureRecognizerOptions =
|
|
||||||
[self gestureRecognizerOptionsWithModelFileInfo:kGestureRecognizerBundleAssetFile];
|
|
||||||
|
|
||||||
const NSInteger numHands = 2;
|
|
||||||
gestureRecognizerOptions.numHands = numHands;
|
|
||||||
|
|
||||||
MPPGestureRecognizer *gestureRecognizer =
|
|
||||||
[self createGestureRecognizerWithOptionsSucceeds:gestureRecognizerOptions];
|
|
||||||
|
|
||||||
MPPGestureRecognizerResult *gestureRecognizerResult =
|
|
||||||
[self recognizeImageWithFileInfo:kTwoHandsImage usingGestureRecognizer:gestureRecognizer];
|
|
||||||
|
|
||||||
XCTAssertTrue(gestureRecognizerResult.handedness.count == numHands);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testRecognizeWithRotationSucceeds {
|
|
||||||
MPPGestureRecognizerOptions *gestureRecognizerOptions =
|
|
||||||
[self gestureRecognizerOptionsWithModelFileInfo:kGestureRecognizerBundleAssetFile];
|
|
||||||
|
|
||||||
const NSInteger numHands = 2;
|
|
||||||
gestureRecognizerOptions.numHands = numHands;
|
|
||||||
|
|
||||||
MPPGestureRecognizer *gestureRecognizer =
|
|
||||||
[self createGestureRecognizerWithOptionsSucceeds:gestureRecognizerOptions];
|
|
||||||
MPPImage *mppImage = [self imageWithFileInfo:kPointingUpRotatedImage
|
|
||||||
orientation:UIImageOrientationRight];
|
|
||||||
|
|
||||||
MPPGestureRecognizerResult *gestureRecognizerResult = [gestureRecognizer recognizeImage:mppImage
|
|
||||||
error:nil];
|
|
||||||
|
|
||||||
XCTAssertNotNil(gestureRecognizerResult);
|
|
||||||
|
|
||||||
const NSInteger expectedGesturesCount = 1;
|
|
||||||
|
|
||||||
XCTAssertEqual(gestureRecognizerResult.gestures.count, expectedGesturesCount);
|
|
||||||
XCTAssertEqualObjects(gestureRecognizerResult.gestures[0][0].categoryName,
|
|
||||||
kExpectedPointingUpLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testRecognizeWithCannedGestureFistSucceeds {
|
|
||||||
MPPGestureRecognizerOptions *gestureRecognizerOptions =
|
|
||||||
[self gestureRecognizerOptionsWithModelFileInfo:kGestureRecognizerBundleAssetFile];
|
|
||||||
|
|
||||||
const NSInteger numHands = 1;
|
|
||||||
gestureRecognizerOptions.numHands = numHands;
|
|
||||||
|
|
||||||
MPPGestureRecognizer *gestureRecognizer =
|
|
||||||
[self createGestureRecognizerWithOptionsSucceeds:gestureRecognizerOptions];
|
|
||||||
|
|
||||||
[self assertResultsOfRecognizeImageWithFileInfo:kFistImage
|
|
||||||
usingGestureRecognizer:gestureRecognizer
|
|
||||||
approximatelyEqualsGestureRecognizerResult:
|
|
||||||
[MPPGestureRecognizerTests fistGestureRecognizerResultWithLabel:kFistLabel]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testRecognizeWithAllowGestureFistSucceeds {
|
|
||||||
MPPGestureRecognizerOptions *gestureRecognizerOptions =
|
|
||||||
[self gestureRecognizerOptionsWithModelFileInfo:kGestureRecognizerBundleAssetFile];
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions = [[MPPClassifierOptions alloc] init];
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions.scoreThreshold = 0.5f;
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions.categoryAllowlist = @[ kFistLabel ];
|
|
||||||
|
|
||||||
const NSInteger numHands = 1;
|
|
||||||
gestureRecognizerOptions.numHands = numHands;
|
|
||||||
|
|
||||||
MPPGestureRecognizer *gestureRecognizer =
|
|
||||||
[self createGestureRecognizerWithOptionsSucceeds:gestureRecognizerOptions];
|
|
||||||
|
|
||||||
[self assertResultsOfRecognizeImageWithFileInfo:kFistImage
|
|
||||||
usingGestureRecognizer:gestureRecognizer
|
|
||||||
approximatelyEqualsGestureRecognizerResult:
|
|
||||||
[MPPGestureRecognizerTests fistGestureRecognizerResultWithLabel:kFistLabel]];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)testRecognizeWithDenyGestureFistSucceeds {
|
|
||||||
MPPGestureRecognizerOptions *gestureRecognizerOptions =
|
|
||||||
[self gestureRecognizerOptionsWithModelFileInfo:kGestureRecognizerBundleAssetFile];
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions = [[MPPClassifierOptions alloc] init];
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions.scoreThreshold = 0.5f;
|
|
||||||
gestureRecognizerOptions.cannedGesturesClassifierOptions.categoryDenylist = @[ kFistLabel ];
|
|
||||||
|
|
||||||
const NSInteger numHands = 1;
|
|
||||||
gestureRecognizerOptions.numHands = numHands;
|
|
||||||
|
|
||||||
MPPGestureRecognizer *gestureRecognizer =
|
|
||||||
[self createGestureRecognizerWithOptionsSucceeds:gestureRecognizerOptions];
|
|
||||||
MPPGestureRecognizerResult *gestureRecognizerResult =
|
|
||||||
[self recognizeImageWithFileInfo:kFistImage usingGestureRecognizer:gestureRecognizer];
|
|
||||||
AssertGestureRecognizerResultIsEmpty(gestureRecognizerResult);
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user