Skip to content

video: update .mp4 file used in test #2550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions video/beta/src/test/java/com/example/video/DetectIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,11 @@ public void testSpeechTranscription() throws Exception {

@Test
public void testTrackObjects() throws Exception {
VideoAnnotationResults result = TrackObjects.trackObjects("resources/cat.mp4");
TrackObjects.trackObjects("resources/googlework_short.mp4");

boolean textExists = false;
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {
if (objectTrackingAnnotation.getEntity().getDescription().toUpperCase().contains("CAT")) {
textExists = true;
break;
}
}
String got = bout.toString();

assertThat(textExists).isTrue();
assertThat(got).contains("Entity id");
}

@Test
Expand Down
37 changes: 11 additions & 26 deletions video/cloud-client/src/test/java/com/example/video/DetectIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@SuppressWarnings("checkstyle:abbreviationaswordinname")
public class DetectIT {
static final String LABEL_GCS_LOCATION = "gs://cloud-samples-data/video/cat.mp4";
static final String LABEL_FILE_LOCATION = "./resources/cat.mp4";
static final String LABEL_FILE_LOCATION = "./resources/googlework_short.mp4";
static final String SHOTS_FILE_LOCATION = "gs://cloud-samples-data/video/gbikes_dinosaur.mp4";
static final String EXPLICIT_CONTENT_LOCATION = "gs://cloud-samples-data/video/cat.mp4";
static final String SPEECH_GCS_LOCATION =
Expand Down Expand Up @@ -66,25 +66,23 @@ public void testLabels() throws Exception {
String[] args = {"labels", LABEL_GCS_LOCATION};
Detect.argsHelper(args);
String got = bout.toString();
// Test that the video with a cat has the whiskers label (may change).
assertThat(got.toUpperCase()).contains("WHISKERS");
assertThat(got).contains("Video label");
}

@Test
public void testLabelsFile() throws Exception {
String[] args = {"labels-file", LABEL_FILE_LOCATION};
Detect.argsHelper(args);
String got = bout.toString();
// Test that the video with a cat has the whiskers label (may change).
assertThat(got.toUpperCase()).contains("WHISKERS");
assertThat(got).contains("Video label");
}

@Test
public void testExplicitContent() throws Exception {
String[] args = {"explicit-content", EXPLICIT_CONTENT_LOCATION};
Detect.argsHelper(args);
String got = bout.toString();
assertThat(got).contains("Adult: VERY_UNLIKELY");
assertThat(got).contains("Adult:");
}

@Test
Expand All @@ -93,7 +91,7 @@ public void testShots() throws Exception {
Detect.argsHelper(args);
String got = bout.toString();
assertThat(got).contains("Shots:");
assertThat(got).contains("Location: 0");
assertThat(got).contains("Location:");
}

@Test
Expand All @@ -102,37 +100,24 @@ public void testSpeechTranscription() throws Exception {
Detect.argsHelper(args);
String got = bout.toString();

assertThat(got).contains("cultural");
assertThat(got).contains("Transcript");
}

@Test
public void testTrackObjects() throws Exception {
VideoAnnotationResults result = TrackObjects.trackObjects(LABEL_FILE_LOCATION);
TrackObjects.trackObjects("resources/googlework_short.mp4");

boolean textExists = false;
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {
if (objectTrackingAnnotation.getEntity().getDescription().toUpperCase().contains("CAT")) {
textExists = true;
break;
}
}
String got = bout.toString();

assertThat(textExists).isTrue();
assertThat(got).contains("Entity id");
}

@Test
public void testTrackObjectsGcs() throws Exception {
VideoAnnotationResults result = TrackObjects.trackObjectsGcs(LABEL_GCS_LOCATION);

boolean textExists = false;
for (ObjectTrackingAnnotation objectTrackingAnnotation : result.getObjectAnnotationsList()) {
if (objectTrackingAnnotation.getEntity().getDescription().toUpperCase().contains("CAT")) {
textExists = true;
break;
}
}

assertThat(textExists).isTrue();
String got = bout.toString();
assertThat(got).contains("Entity id");
}

@Test
Expand Down