VideoCaptureTest.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package org.opencv.test.videoio;
  2. import java.util.List;
  3. import org.opencv.core.Size;
  4. import org.opencv.videoio.Videoio;
  5. import org.opencv.videoio.VideoCapture;
  6. import org.opencv.test.OpenCVTestCase;
  7. public class VideoCaptureTest extends OpenCVTestCase {
  8. private VideoCapture capture;
  9. private boolean isOpened;
  10. private boolean isSucceed;
  11. @Override
  12. protected void setUp() throws Exception {
  13. super.setUp();
  14. capture = null;
  15. isTestCaseEnabled = false;
  16. isSucceed = false;
  17. isOpened = false;
  18. }
  19. public void testGrab() {
  20. capture = new VideoCapture();
  21. isSucceed = capture.grab();
  22. assertFalse(isSucceed);
  23. }
  24. public void testIsOpened() {
  25. capture = new VideoCapture();
  26. assertFalse(capture.isOpened());
  27. }
  28. public void testDefaultConstructor() {
  29. capture = new VideoCapture();
  30. assertNotNull(capture);
  31. assertFalse(capture.isOpened());
  32. }
  33. public void testConstructorWithFilename() {
  34. capture = new VideoCapture("some_file.avi");
  35. assertNotNull(capture);
  36. }
  37. public void testConstructorWithFilenameAndExplicitlySpecifiedAPI() {
  38. capture = new VideoCapture("some_file.avi", Videoio.CAP_ANY);
  39. assertNotNull(capture);
  40. }
  41. public void testConstructorWithIndex() {
  42. capture = new VideoCapture(0);
  43. assertNotNull(capture);
  44. }
  45. public void testConstructorWithIndexAndExplicitlySpecifiedAPI() {
  46. capture = new VideoCapture(0, Videoio.CAP_ANY);
  47. assertNotNull(capture);
  48. }
  49. }