package com.shootoff.camera;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ErrorCollector;
import com.shootoff.camera.shot.DisplayShot;
import com.shootoff.camera.shot.ShotColor;
import com.shootoff.camera.shotdetection.JavaShotDetector;
import com.shootoff.config.Configuration;
import com.shootoff.config.ConfigurationException;
import com.shootoff.gui.MockCanvasManager;
public class TestCameraManagerHighRes extends ShotDetectionTestor {
private Configuration config;
private MockCanvasManager mockManager;
private boolean[][] sectorStatuses;
@Rule public ErrorCollector collector = new ErrorCollector();
@Before
public void setUp() throws ConfigurationException {
config = new Configuration(new String[0]);
// Minimize logging attempts because Travis-CI will kill us
// due to verbose output. To re-enable log outputs you also
// need to comment out the code in ShotDetectionTestor.setUpBaseClass()
// that disables all loggers.
config.setDebugMode(false);
mockManager = new MockCanvasManager(config, true);
sectorStatuses = new boolean[JavaShotDetector.SECTOR_ROWS][JavaShotDetector.SECTOR_COLUMNS];
for (int x = 0; x < JavaShotDetector.SECTOR_COLUMNS; x++) {
for (int y = 0; y < JavaShotDetector.SECTOR_ROWS; y++) {
sectorStatuses[y][x] = true;
}
}
}
@Test
// Shots are missed because shot detection has not been modified to support
// other resolutions
public void test1280x720Green() {
List<DisplayShot> shots = findShots("/shotsearcher/highres-green.mp4", Optional.empty(), mockManager, config,
sectorStatuses);
List<Shot> requiredShots = new ArrayList<Shot>();
// These coordinates are scaled down to a 640x480 display resolution
// Scaled down from 586.30, 395.44
requiredShots.add(new Shot(ShotColor.GREEN, 293.14, 263.34, 0, 2));
// Scaled down from 532.16, 347.98
requiredShots.add(new Shot(ShotColor.GREEN, 265.61, 231.68, 0, 2));
// Scaled down from 587.80, 396.73
requiredShots.add(new Shot(ShotColor.GREEN, 294.02, 264.28, 0, 2));
List<Shot> optionalShots = new ArrayList<Shot>();
super.checkShots(collector, shots, requiredShots, optionalShots, false);
}
}