Java test fix. Eclipse test execution fix.
This commit is contained in:
parent
4d059e9e5b
commit
baef62b4d2
@ -28,6 +28,8 @@ public class OpenCVTestCase extends TestCase {
|
|||||||
//change to 'true' to unblock fail on fail("Not yet implemented")
|
//change to 'true' to unblock fail on fail("Not yet implemented")
|
||||||
public static final boolean passNYI = true;
|
public static final boolean passNYI = true;
|
||||||
|
|
||||||
|
protected static boolean isEnabled = true;
|
||||||
|
|
||||||
protected static final int matSize = 10;
|
protected static final int matSize = 10;
|
||||||
protected static final double EPS = 0.001;
|
protected static final double EPS = 0.001;
|
||||||
protected static final double weakEPS = 0.5;
|
protected static final double weakEPS = 0.5;
|
||||||
|
@ -2,9 +2,9 @@ package org.opencv.test;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
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 junit.framework.Assert;
|
||||||
|
|
||||||
import org.opencv.android.Utils;
|
import org.opencv.android.Utils;
|
||||||
@ -72,15 +72,17 @@ public class OpenCVTestRunner extends InstrumentationTestRunner {
|
|||||||
//List<TestCase> testCases = androidTestRunner.getTestCases();
|
//List<TestCase> testCases = androidTestRunner.getTestCases();
|
||||||
//Collections.shuffle(testCases); //shuffle the tests order
|
//Collections.shuffle(testCases); //shuffle the tests order
|
||||||
|
|
||||||
if(OpenCVTestCase.passNYI) {
|
// Note: VideoCapture tests turned off by flag field in VideoCaptureTest class
|
||||||
// turn off problematic camera tests
|
|
||||||
Iterator<TestCase> it = androidTestRunner.getTestCases().iterator();
|
// if(OpenCVTestCase.passNYI) {
|
||||||
while (it.hasNext()) {
|
// // turn off problematic camera tests
|
||||||
String name = it.next().toString();
|
// Iterator<TestCase> it = androidTestRunner.getTestCases().iterator();
|
||||||
if (name.contains("VideoCaptureTest"))
|
// while (it.hasNext()) {
|
||||||
it.remove();
|
// String name = it.next().toString();
|
||||||
}
|
// if (name.contains("VideoCaptureTest"))
|
||||||
}
|
// it.remove();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
@ -13,6 +13,8 @@ import org.opencv.features2d.KeyPoint;
|
|||||||
import org.opencv.test.OpenCVTestCase;
|
import org.opencv.test.OpenCVTestCase;
|
||||||
import org.opencv.test.OpenCVTestRunner;
|
import org.opencv.test.OpenCVTestRunner;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
public class FASTFeatureDetectorTest extends OpenCVTestCase {
|
public class FASTFeatureDetectorTest extends OpenCVTestCase {
|
||||||
|
|
||||||
FeatureDetector detector;
|
FeatureDetector detector;
|
||||||
@ -127,9 +129,9 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
detector.write(filename);
|
detector.write(filename);
|
||||||
|
|
||||||
String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.FAST</name>\n<nonmaxSuppression>1</nonmaxSuppression>\n<threshold>10</threshold>\n</opencv_storage>\n";
|
String truth = "<?xml version=\"1.0\"?>\n<opencv_storage>\n<name>Feature2D.FAST</name>\n<nonmaxSuppression>1</nonmaxSuppression>\n<threshold>10</threshold>\n<type>2</type>\n</opencv_storage>\n";
|
||||||
String data = readFile(filename);
|
String data = readFile(filename);
|
||||||
|
Log.d("qqq", "\"" + data + "\"");
|
||||||
assertEquals(truth, data);
|
assertEquals(truth, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,9 +140,10 @@ public class FASTFeatureDetectorTest extends OpenCVTestCase {
|
|||||||
|
|
||||||
detector.write(filename);
|
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);
|
String data = readFile(filename);
|
||||||
|
|
||||||
|
Log.d("qqq", "\"" + data + "\"");
|
||||||
assertEquals(truth, data);
|
assertEquals(truth, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,10 @@ public class HighguiTest extends OpenCVTestCase {
|
|||||||
public void testImencodeStringMatListOfByteListOfInteger() {
|
public void testImencodeStringMatListOfByteListOfInteger() {
|
||||||
MatOfInt params40 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 40);
|
MatOfInt params40 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 40);
|
||||||
MatOfInt params90 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 90);
|
MatOfInt params90 = new MatOfInt(Highgui.IMWRITE_JPEG_QUALITY, 90);
|
||||||
/* or
|
/* or
|
||||||
MatOfInt params = new MatOfInt();
|
MatOfInt params = new MatOfInt();
|
||||||
params.fromArray(Highgui.IMWRITE_JPEG_QUALITY, 40);
|
params.fromArray(Highgui.IMWRITE_JPEG_QUALITY, 40);
|
||||||
*/
|
*/
|
||||||
MatOfByte buff40 = new MatOfByte();
|
MatOfByte buff40 = new MatOfByte();
|
||||||
MatOfByte buff90 = new MatOfByte();
|
MatOfByte buff90 = new MatOfByte();
|
||||||
|
|
||||||
|
@ -19,13 +19,17 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
capture = null;
|
capture = null;
|
||||||
|
isEnabled = false;
|
||||||
isSucceed = false;
|
isSucceed = false;
|
||||||
isOpened = false;
|
isOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGet() {
|
public void testGet() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
|
double frameWidth = capture.get(Highgui.CV_CAP_PROP_FRAME_WIDTH);
|
||||||
assertTrue(0 != frameWidth);
|
assertTrue(0 != frameWidth);
|
||||||
@ -35,8 +39,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testGetSupportedPreviewSizes() {
|
public void testGetSupportedPreviewSizes() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
List<Size> sizes = capture.getSupportedPreviewSizes();
|
List<Size> sizes = capture.getSupportedPreviewSizes();
|
||||||
assertNotNull(sizes);
|
assertNotNull(sizes);
|
||||||
@ -47,12 +54,20 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testGrab() {
|
public void testGrab() {
|
||||||
|
if (!isEnabled) {
|
||||||
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
capture = new VideoCapture();
|
capture = new VideoCapture();
|
||||||
isSucceed = capture.grab();
|
isSucceed = capture.grab();
|
||||||
assertFalse(isSucceed);
|
assertFalse(isSucceed);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGrabFromRealCamera() {
|
public void testGrabFromRealCamera() {
|
||||||
|
if (!isEnabled) {
|
||||||
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
isSucceed = capture.grab();
|
isSucceed = capture.grab();
|
||||||
@ -63,13 +78,20 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testIsOpened() {
|
public void testIsOpened() {
|
||||||
|
if (!isEnabled) {
|
||||||
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
capture = new VideoCapture();
|
capture = new VideoCapture();
|
||||||
assertFalse(capture.isOpened());
|
assertFalse(capture.isOpened());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIsOpenedRealCamera() {
|
public void testIsOpenedRealCamera() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
isOpened = capture.isOpened();
|
isOpened = capture.isOpened();
|
||||||
assertTrue(isOpened);
|
assertTrue(isOpened);
|
||||||
@ -79,8 +101,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testOpen() {
|
public void testOpen() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture();
|
capture = new VideoCapture();
|
||||||
capture.open(Highgui.CV_CAP_ANDROID);
|
capture.open(Highgui.CV_CAP_ANDROID);
|
||||||
isOpened = capture.isOpened();
|
isOpened = capture.isOpened();
|
||||||
@ -91,8 +116,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testRead() {
|
public void testRead() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
isSucceed = capture.read(dst);
|
isSucceed = capture.read(dst);
|
||||||
assertTrue(isSucceed);
|
assertTrue(isSucceed);
|
||||||
@ -104,8 +132,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testRelease() {
|
public void testRelease() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
capture.release();
|
capture.release();
|
||||||
assertFalse(capture.isOpened());
|
assertFalse(capture.isOpened());
|
||||||
@ -116,8 +147,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testRetrieveMat() {
|
public void testRetrieveMat() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
capture.grab();
|
capture.grab();
|
||||||
isSucceed = capture.retrieve(dst);
|
isSucceed = capture.retrieve(dst);
|
||||||
@ -130,8 +164,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testRetrieveMatInt() {
|
public void testRetrieveMatInt() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
capture.grab();
|
capture.grab();
|
||||||
isSucceed = capture.retrieve(dst, Highgui.CV_CAP_ANDROID_GREY_FRAME);
|
isSucceed = capture.retrieve(dst, Highgui.CV_CAP_ANDROID_GREY_FRAME);
|
||||||
@ -144,8 +181,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testSet() {
|
public void testSet() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640);
|
capture.set(Highgui.CV_CAP_PROP_FRAME_WIDTH, 640);
|
||||||
capture.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, 480);
|
capture.set(Highgui.CV_CAP_PROP_FRAME_HEIGHT, 480);
|
||||||
@ -165,8 +205,11 @@ public class VideoCaptureTest extends OpenCVTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testVideoCaptureInt() {
|
public void testVideoCaptureInt() {
|
||||||
try
|
if (!isEnabled) {
|
||||||
{
|
fail("Not yet implemented");
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
capture = new VideoCapture(Highgui.CV_CAP_ANDROID);
|
||||||
assertNotNull(capture);
|
assertNotNull(capture);
|
||||||
assertTrue(capture.isOpened());
|
assertTrue(capture.isOpened());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user