diff --git a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java index 102adf195..f8f3c6f89 100644 --- a/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java +++ b/modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java @@ -28,6 +28,8 @@ public class OpenCVTestCase extends TestCase { //change to 'true' to unblock fail on fail("Not yet implemented") public static final boolean passNYI = true; + protected static boolean isEnabled = true; + protected static final int matSize = 10; protected static final double EPS = 0.001; protected static final double weakEPS = 0.5; diff --git a/modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java b/modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java index 3c416c510..f77801211 100644 --- a/modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java +++ b/modules/java/android_test/src/org/opencv/test/OpenCVTestRunner.java @@ -2,9 +2,9 @@ package org.opencv.test; import java.io.File; import java.io.IOException; -import java.util.Iterator; +//import java.util.Iterator; -import junit.framework.TestCase; +//import junit.framework.TestCase; import junit.framework.Assert; import org.opencv.android.Utils; @@ -72,15 +72,17 @@ public class OpenCVTestRunner extends InstrumentationTestRunner { //List testCases = androidTestRunner.getTestCases(); //Collections.shuffle(testCases); //shuffle the tests order - if(OpenCVTestCase.passNYI) { - // turn off problematic camera tests - Iterator it = androidTestRunner.getTestCases().iterator(); - while (it.hasNext()) { - String name = it.next().toString(); - if (name.contains("VideoCaptureTest")) - it.remove(); - } - } + // Note: VideoCapture tests turned off by flag field in VideoCaptureTest class + +// if(OpenCVTestCase.passNYI) { +// // turn off problematic camera tests +// Iterator it = androidTestRunner.getTestCases().iterator(); +// while (it.hasNext()) { +// String name = it.next().toString(); +// if (name.contains("VideoCaptureTest")) +// it.remove(); +// } +// } super.onStart(); diff --git a/modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java b/modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java index 35ffd6477..4e068e1ac 100644 --- a/modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java +++ b/modules/java/android_test/src/org/opencv/test/features2d/FASTFeatureDetectorTest.java @@ -13,6 +13,8 @@ import org.opencv.features2d.KeyPoint; import org.opencv.test.OpenCVTestCase; import org.opencv.test.OpenCVTestRunner; +import android.util.Log; + public class FASTFeatureDetectorTest extends OpenCVTestCase { FeatureDetector detector; @@ -127,9 +129,9 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase { detector.write(filename); - String truth = "\n\nFeature2D.FAST\n1\n10\n\n"; + String truth = "\n\nFeature2D.FAST\n1\n10\n2\n\n"; String data = readFile(filename); - + Log.d("qqq", "\"" + data + "\""); assertEquals(truth, data); } @@ -138,9 +140,10 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase { detector.write(filename); - String truth = "%YAML:1.0\nname: \"Feature2D.FAST\"\nnonmaxSuppression: 1\nthreshold: 10\n"; + String truth = "%YAML:1.0\nname: \"Feature2D.FAST\"\nnonmaxSuppression: 1\nthreshold: 10\ntype: 2\n"; String data = readFile(filename); + Log.d("qqq", "\"" + data + "\""); assertEquals(truth, data); } } diff --git a/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java b/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java index 9f7872771..b8e7c3b8b 100644 --- a/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java +++ b/modules/java/android_test/src/org/opencv/test/highgui/HighguiTest.java @@ -22,10 +22,10 @@ public class HighguiTest extends OpenCVTestCase { public void testImencodeStringMatListOfByteListOfInteger() { MatOfInt params40 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 40); MatOfInt params90 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 90); - /* or + /* or MatOfInt params = new MatOfInt(); - params.fromArray(Highgui.IMWRITE_JPEG_QUALITY, 40); - */ + params.fromArray(Highgui.IMWRITE_JPEG_QUALITY, 40); + */ MatOfByte buff40 = new MatOfByte(); MatOfByte buff90 = new MatOfByte(); diff --git a/modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java b/modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java index c6901c5e4..ce210714c 100644 --- a/modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java +++ b/modules/java/android_test/src/org/opencv/test/highgui/VideoCaptureTest.java @@ -19,13 +19,17 @@ public class VideoCaptureTest extends OpenCVTestCase { super.setUp(); capture = null; + isEnabled = false; isSucceed = false; isOpened = false; } public void testGet() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH); assertTrue(0 != frameWidth); @@ -35,8 +39,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testGetSupportedPreviewSizes() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); List sizes = capture.getSupportedPreviewSizes(); assertNotNull(sizes); @@ -47,12 +54,20 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testGrab() { + if (!isEnabled) { + fail("Not yet implemented"); + } + capture = new VideoCapture(); isSucceed = capture.grab(); assertFalse(isSucceed); } public void testGrabFromRealCamera() { + if (!isEnabled) { + fail("Not yet implemented"); + } + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); isSucceed = capture.grab(); @@ -63,13 +78,20 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testIsOpened() { + if (!isEnabled) { + fail("Not yet implemented"); + } + capture = new VideoCapture(); assertFalse(capture.isOpened()); } public void testIsOpenedRealCamera() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); isOpened = capture.isOpened(); assertTrue(isOpened); @@ -79,8 +101,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testOpen() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(); capture.open(Highgui.CV_CAP_ANDROID); isOpened = capture.isOpened(); @@ -91,8 +116,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testRead() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); isSucceed = capture.read(dst); assertTrue(isSucceed); @@ -104,8 +132,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testRelease() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture.release(); assertFalse(capture.isOpened()); @@ -116,8 +147,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testRetrieveMat() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture.grab(); isSucceed = capture.retrieve(dst); @@ -130,8 +164,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testRetrieveMatInt() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture.grab(); isSucceed = capture.retrieve(dst, Highgui.CV_CAP_ANDROID_GREY_FRAME); @@ -144,8 +181,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testSet() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640); capture.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, 480); @@ -165,8 +205,11 @@ public class VideoCaptureTest extends OpenCVTestCase { } public void testVideoCaptureInt() { - try - { + if (!isEnabled) { + fail("Not yet implemented"); + } + + try { capture = new VideoCapture(Highgui.CV_CAP_ANDROID); assertNotNull(capture); assertTrue(capture.isOpened());