Skip to content

Commit

Permalink
Merge pull request #4829 from priankakariatyml:ios-vision-api-name-ch…
Browse files Browse the repository at this point in the history
…anges

PiperOrigin-RevId: 568622587
  • Loading branch information
copybara-github committed Sep 26, 2023
2 parents 199b422 + 2d4e5a7 commit 0417817
Show file tree
Hide file tree
Showing 12 changed files with 144 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ - (void)testDetectWithImageModeAndNoFaceSucceeds {

NSError *error;
MPPImage *mppImage = [self imageWithFileInfo:kCatImage];
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectInImage:mppImage error:&error];
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectImage:mppImage error:&error];
XCTAssertNil(error);
XCTAssertNotNil(faceDetectorResult);
XCTAssertEqual(faceDetectorResult.detections.count, 0);
Expand All @@ -125,9 +125,9 @@ - (void)testDetectWithVideoModeAndPotraitSucceeds {

MPPImage *image = [self imageWithFileInfo:kPortraitImage];
for (int i = 0; i < 3; i++) {
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectInVideoFrame:image
timestampInMilliseconds:i
error:nil];
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectVideoFrame:image
timestampInMilliseconds:i
error:nil];
[self assertFaceDetectorResult:faceDetectorResult
containsExpectedKeypoints:kPortraitExpectedKeypoints];
}
Expand All @@ -141,9 +141,9 @@ - (void)testDetectWithVideoModeAndRotatedPotraitSucceeds {

MPPImage *image = [self imageWithFileInfo:kPortraitRotatedImage];
for (int i = 0; i < 3; i++) {
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectInVideoFrame:image
timestampInMilliseconds:i
error:nil];
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectVideoFrame:image
timestampInMilliseconds:i
error:nil];
[self assertFaceDetectorResult:faceDetectorResult
containsExpectedKeypoints:kPortraitRotatedExpectedKeypoints];
}
Expand Down Expand Up @@ -181,7 +181,7 @@ - (void)testDetectWithLiveStreamModeAndPotraitSucceeds {
};

for (int i = 0; i < iterationCount; i++) {
XCTAssertTrue([faceDetector detectAsyncInImage:image timestampInMilliseconds:i error:nil]);
XCTAssertTrue([faceDetector detectAsyncImage:image timestampInMilliseconds:i error:nil]);
}

NSTimeInterval timeout = 0.5f;
Expand All @@ -205,10 +205,10 @@ - (void)testDetectWithOutOfOrderTimestampsAndLiveStreamModeFails {
};

MPPImage *image = [self imageWithFileInfo:kPortraitImage];
XCTAssertTrue([faceDetector detectAsyncInImage:image timestampInMilliseconds:1 error:nil]);
XCTAssertTrue([faceDetector detectAsyncImage:image timestampInMilliseconds:1 error:nil]);

NSError *error;
XCTAssertFalse([faceDetector detectAsyncInImage:image timestampInMilliseconds:0 error:&error]);
XCTAssertFalse([faceDetector detectAsyncImage:image timestampInMilliseconds:0 error:&error]);

NSError *expectedError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand Down Expand Up @@ -274,9 +274,9 @@ - (void)testDetectFailsWithCallingWrongApiInImageMode {
MPPImage *image = [self imageWithFileInfo:kPortraitImage];

NSError *liveStreamApiCallError;
XCTAssertFalse([faceDetector detectAsyncInImage:image
timestampInMilliseconds:0
error:&liveStreamApiCallError]);
XCTAssertFalse([faceDetector detectAsyncImage:image
timestampInMilliseconds:0
error:&liveStreamApiCallError]);

NSError *expectedLiveStreamApiCallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -288,9 +288,9 @@ - (void)testDetectFailsWithCallingWrongApiInImageMode {
AssertEqualErrors(liveStreamApiCallError, expectedLiveStreamApiCallError);

NSError *videoApiCallError;
XCTAssertFalse([faceDetector detectInVideoFrame:image
timestampInMilliseconds:0
error:&videoApiCallError]);
XCTAssertFalse([faceDetector detectVideoFrame:image
timestampInMilliseconds:0
error:&videoApiCallError]);

NSError *expectedVideoApiCallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -312,9 +312,9 @@ - (void)testDetectFailsWithCallingWrongApiInVideoMode {
MPPImage *image = [self imageWithFileInfo:kPortraitImage];

NSError *liveStreamApiCallError;
XCTAssertFalse([faceDetector detectAsyncInImage:image
timestampInMilliseconds:0
error:&liveStreamApiCallError]);
XCTAssertFalse([faceDetector detectAsyncImage:image
timestampInMilliseconds:0
error:&liveStreamApiCallError]);

NSError *expectedLiveStreamApiCallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -326,7 +326,7 @@ - (void)testDetectFailsWithCallingWrongApiInVideoMode {
AssertEqualErrors(liveStreamApiCallError, expectedLiveStreamApiCallError);

NSError *imageApiCallError;
XCTAssertFalse([faceDetector detectInImage:image error:&imageApiCallError]);
XCTAssertFalse([faceDetector detectImage:image error:&imageApiCallError]);

NSError *expectedImageApiCallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -350,7 +350,7 @@ - (void)testDetectFailsWithCallingWrongApiInLiveStreamMode {
MPPImage *image = [self imageWithFileInfo:kPortraitImage];

NSError *imageApiCallError;
XCTAssertFalse([faceDetector detectInImage:image error:&imageApiCallError]);
XCTAssertFalse([faceDetector detectImage:image error:&imageApiCallError]);

NSError *expectedImageApiCallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -362,9 +362,9 @@ - (void)testDetectFailsWithCallingWrongApiInLiveStreamMode {
AssertEqualErrors(imageApiCallError, expectedImageApiCallError);

NSError *videoApiCallError;
XCTAssertFalse([faceDetector detectInVideoFrame:image
timestampInMilliseconds:0
error:&videoApiCallError]);
XCTAssertFalse([faceDetector detectVideoFrame:image
timestampInMilliseconds:0
error:&videoApiCallError]);

NSError *expectedVideoApiCallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand Down Expand Up @@ -407,7 +407,7 @@ - (void)testDetectWithLiveStreamModeSucceeds {

MPPImage *image = [self imageWithFileInfo:kPortraitImage];
for (int i = 0; i < iterationCount; i++) {
XCTAssertTrue([faceDetector detectAsyncInImage:image timestampInMilliseconds:i error:nil]);
XCTAssertTrue([faceDetector detectAsyncImage:image timestampInMilliseconds:i error:nil]);
}

NSTimeInterval timeout = 0.5f;
Expand Down Expand Up @@ -503,7 +503,7 @@ - (void)assertResultsOfDetectInImage:(MPPImage *)mppImage
usingFaceDetector:(MPPFaceDetector *)faceDetector
containsExpectedKeypoints:(NSArray<NSArray *> *)expectedKeypoints {
NSError *error;
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectInImage:mppImage error:&error];
MPPFaceDetectorResult *faceDetectorResult = [faceDetector detectImage:mppImage error:&error];
XCTAssertNil(error);
XCTAssertNotNil(faceDetectorResult);
[self assertFaceDetectorResult:faceDetectorResult containsExpectedKeypoints:expectedKeypoints];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ - (void)testDetectWithImageModeAndNoFaceSucceeds {

NSError *error;
MPPImage *mppImage = [self imageWithFileInfo:kCatImage];
MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectInImage:mppImage
error:&error];
MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectImage:mppImage
error:&error];
XCTAssertNil(error);
XCTAssertNotNil(faceLandmarkerResult);
XCTAssertEqualObjects(faceLandmarkerResult.faceLandmarks, [NSArray array]);
Expand All @@ -158,9 +158,9 @@ - (void)testDetectWithVideoModeAndPotraitSucceeds {
NSArray<MPPNormalizedLandmark *> *expectedLandmarks =
[MPPFaceLandmarkerTests expectedLandmarksFromFileInfo:kPortraitExpectedLandmarksName];
for (int i = 0; i < 3; i++) {
MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectInVideoFrame:image
timestampInMilliseconds:i
error:nil];
MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectVideoFrame:image
timestampInMilliseconds:i
error:nil];
[self assertFaceLandmarkerResult:faceLandmarkerResult
containsExpectedLandmarks:expectedLandmarks
expectedBlendshapes:NULL
Expand Down Expand Up @@ -200,7 +200,7 @@ - (void)testDetectWithLiveStreamModeAndPotraitSucceeds {
};

for (int i = 0; i < iterationCount; i++) {
XCTAssertTrue([faceLandmarker detectAsyncInImage:image timestampInMilliseconds:i error:nil]);
XCTAssertTrue([faceLandmarker detectAsyncImage:image timestampInMilliseconds:i error:nil]);
}

NSTimeInterval timeout = 0.5f;
Expand All @@ -224,10 +224,10 @@ - (void)testDetectWithOutOfOrderTimestampsAndLiveStreamModeFails {
};

MPPImage *image = [self imageWithFileInfo:kPortraitImage];
XCTAssertTrue([faceLandmarker detectAsyncInImage:image timestampInMilliseconds:1 error:nil]);
XCTAssertTrue([faceLandmarker detectAsyncImage:image timestampInMilliseconds:1 error:nil]);

NSError *error;
XCTAssertFalse([faceLandmarker detectAsyncInImage:image timestampInMilliseconds:0 error:&error]);
XCTAssertFalse([faceLandmarker detectAsyncImage:image timestampInMilliseconds:0 error:&error]);

NSError *expectedError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand Down Expand Up @@ -292,9 +292,9 @@ - (void)testDetectFailsWithCallingWrongAPIInImageMode {
MPPImage *image = [self imageWithFileInfo:kPortraitImage];

NSError *liveStreamAPICallError;
XCTAssertFalse([faceLandmarker detectAsyncInImage:image
timestampInMilliseconds:0
error:&liveStreamAPICallError]);
XCTAssertFalse([faceLandmarker detectAsyncImage:image
timestampInMilliseconds:0
error:&liveStreamAPICallError]);

NSError *expectedLiveStreamAPICallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -306,9 +306,9 @@ - (void)testDetectFailsWithCallingWrongAPIInImageMode {
AssertEqualErrors(liveStreamAPICallError, expectedLiveStreamAPICallError);

NSError *videoAPICallError;
XCTAssertFalse([faceLandmarker detectInVideoFrame:image
timestampInMilliseconds:0
error:&videoAPICallError]);
XCTAssertFalse([faceLandmarker detectVideoFrame:image
timestampInMilliseconds:0
error:&videoAPICallError]);

NSError *expectedVideoAPICallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -329,9 +329,9 @@ - (void)testDetectFailsWithCallingWrongAPIInVideoMode {

MPPImage *image = [self imageWithFileInfo:kPortraitImage];
NSError *liveStreamAPICallError;
XCTAssertFalse([faceLandmarker detectAsyncInImage:image
timestampInMilliseconds:0
error:&liveStreamAPICallError]);
XCTAssertFalse([faceLandmarker detectAsyncImage:image
timestampInMilliseconds:0
error:&liveStreamAPICallError]);

NSError *expectedLiveStreamAPICallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -343,7 +343,7 @@ - (void)testDetectFailsWithCallingWrongAPIInVideoMode {
AssertEqualErrors(liveStreamAPICallError, expectedLiveStreamAPICallError);

NSError *imageAPICallError;
XCTAssertFalse([faceLandmarker detectInImage:image error:&imageAPICallError]);
XCTAssertFalse([faceLandmarker detectImage:image error:&imageAPICallError]);

NSError *expectedImageAPICallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -365,7 +365,7 @@ - (void)testDetectFailsWithCallingWrongAPIInLiveStreamMode {
MPPImage *image = [self imageWithFileInfo:kPortraitImage];

NSError *imageAPICallError;
XCTAssertFalse([faceLandmarker detectInImage:image error:&imageAPICallError]);
XCTAssertFalse([faceLandmarker detectImage:image error:&imageAPICallError]);

NSError *expectedImageAPICallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand All @@ -377,9 +377,9 @@ - (void)testDetectFailsWithCallingWrongAPIInLiveStreamMode {
AssertEqualErrors(imageAPICallError, expectedImageAPICallError);

NSError *videoAPICallError;
XCTAssertFalse([faceLandmarker detectInVideoFrame:image
timestampInMilliseconds:0
error:&videoAPICallError]);
XCTAssertFalse([faceLandmarker detectVideoFrame:image
timestampInMilliseconds:0
error:&videoAPICallError]);

NSError *expectedVideoAPICallError =
[NSError errorWithDomain:kExpectedErrorDomain
Expand Down Expand Up @@ -484,7 +484,7 @@ - (void)assertFaceLandmarkerResult:(MPPFaceLandmarkerResult *)faceLandmarkerResu
}
}

if (expectedTransformationMatrix == NULL) {
if (expectedTransformationMatrix == nullptr) {
XCTAssertEqualObjects(faceLandmarkerResult.facialTransformationMatrixes, [NSArray array]);
} else {
MPPTransformMatrix *actualTransformationMatrix =
Expand Down Expand Up @@ -539,8 +539,8 @@ - (void)assertResultsOfDetectInImageWithFileInfo:(ResourceFileInfo *)fileInfo
MPPImage *mppImage = [self imageWithFileInfo:fileInfo];

NSError *error;
MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectInImage:mppImage
error:&error];
MPPFaceLandmarkerResult *faceLandmarkerResult = [faceLandmarker detectImage:mppImage
error:&error];
XCTAssertNil(error);
XCTAssertNotNil(faceLandmarkerResult);

Expand Down
Loading

0 comments on commit 0417817

Please sign in to comment.