Blame view

3rdparty/opencv-4.5.4/modules/videoio/misc/java/test/VideoCaptureTest.java 1.55 KB
f4334277   Hu Chunming   提交3rdparty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  package org.opencv.test.videoio;
  
  import java.util.List;
  
  import org.opencv.core.Size;
  import org.opencv.videoio.Videoio;
  import org.opencv.videoio.VideoCapture;
  
  import org.opencv.test.OpenCVTestCase;
  
  public class VideoCaptureTest extends OpenCVTestCase {
  
      private VideoCapture capture;
      private boolean isOpened;
      private boolean isSucceed;
  
      @Override
      protected void setUp() throws Exception {
          super.setUp();
  
          capture = null;
          isTestCaseEnabled = false;
          isSucceed = false;
          isOpened = false;
      }
  
      public void testGrab() {
          capture = new VideoCapture();
          isSucceed = capture.grab();
          assertFalse(isSucceed);
      }
  
      public void testIsOpened() {
          capture = new VideoCapture();
          assertFalse(capture.isOpened());
      }
  
      public void testDefaultConstructor() {
          capture = new VideoCapture();
          assertNotNull(capture);
          assertFalse(capture.isOpened());
      }
  
      public void testConstructorWithFilename() {
          capture = new VideoCapture("some_file.avi");
          assertNotNull(capture);
      }
  
      public void testConstructorWithFilenameAndExplicitlySpecifiedAPI() {
          capture = new VideoCapture("some_file.avi", Videoio.CAP_ANY);
          assertNotNull(capture);
      }
  
      public void testConstructorWithIndex() {
          capture = new VideoCapture(0);
          assertNotNull(capture);
      }
  
      public void testConstructorWithIndexAndExplicitlySpecifiedAPI() {
          capture = new VideoCapture(0, Videoio.CAP_ANY);
          assertNotNull(capture);
      }
  
  }