Commit 85166360 authored by Kirill Kornyakov's avatar Kirill Kornyakov

java tests updated: now they independent from android, test methods are sorted alphabetically

parent f301cda7
......@@ -3,7 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="src" path="OpenCV_src"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="src" path="OpenCV_src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
......@@ -8,35 +8,39 @@ public class MatTest extends OpenCVTestCase {
super.test_1("Mat");
}
public void testFinalize() {
public void testChannels() {
fail("Not yet implemented");
}
public void testMatLong() {
public void testClone() {
fail("Not yet implemented");
}
public void testMatIntIntCvType() {
Mat gray = new Mat(1, 1, Mat.CvType.CV_8UC1);
assertFalse(gray.empty());
Mat rgb = new Mat(1, 1, Mat.CvType.CV_8UC3);
assertFalse(rgb.empty());
public void testCol() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDoubleDoubleDoubleDouble() {
public void testColRange() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDoubleDoubleDouble() {
public void testCols() {
assertEquals(matSize, gray0.rows());
}
public void testCopyTo() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDoubleDouble() {
public void testCross() {
fail("Not yet implemented");
}
public void testMatIntIntCvTypeDouble() {
public void testDataAddr() {
fail("Not yet implemented");
}
public void testDepth() {
fail("Not yet implemented");
}
......@@ -44,51 +48,51 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testToString() {
public void testDot() {
fail("Not yet implemented");
}
public void testEmpty() {
public void testElemSize() {
fail("Not yet implemented");
}
public void testType() {
public void testEmpty() {
fail("Not yet implemented");
}
public void testDepth() {
public void testFinalize() {
fail("Not yet implemented");
}
public void testChannels() {
public void testGetIntIntByteArray() {
fail("Not yet implemented");
}
public void testElemSize() {
public void testGetIntIntDoubleArray() {
fail("Not yet implemented");
}
public void testRows() {
assertEquals(matSize, gray0.rows());
public void testGetIntIntFloatArray() {
fail("Not yet implemented");
}
public void testHeight() {
public void testGetIntIntIntArray() {
fail("Not yet implemented");
}
public void testCols() {
assertEquals(matSize, gray0.rows());
public void testGetIntIntShortArray() {
fail("Not yet implemented");
}
public void testWidth() {
public void testGetNativeObjAddr() {
fail("Not yet implemented");
}
public void testTotal() {
public void testHeight() {
fail("Not yet implemented");
}
public void testDataAddr() {
public void testInv() {
fail("Not yet implemented");
}
......@@ -100,27 +104,35 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testSubmat() {
public void testMatIntIntCvType() {
Mat gray = new Mat(1, 1, Mat.CvType.CV_8UC1);
assertFalse(gray.empty());
Mat rgb = new Mat(1, 1, Mat.CvType.CV_8UC3);
assertFalse(rgb.empty());
}
public void testMatIntIntCvTypeDouble() {
fail("Not yet implemented");
}
public void testRowRange() {
public void testMatIntIntCvTypeDoubleDouble() {
fail("Not yet implemented");
}
public void testRow() {
public void testMatIntIntCvTypeDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testColRange() {
public void testMatIntIntCvTypeDoubleDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testCol() {
public void testMatLong() {
fail("Not yet implemented");
}
public void testClone() {
public void testPutIntIntByteArray() {
fail("Not yet implemented");
}
......@@ -140,31 +152,23 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testPutIntIntByteArray() {
fail("Not yet implemented");
}
public void testGetIntIntByteArray() {
fail("Not yet implemented");
}
public void testGetIntIntShortArray() {
public void testRow() {
fail("Not yet implemented");
}
public void testGetIntIntIntArray() {
public void testRowRange() {
fail("Not yet implemented");
}
public void testGetIntIntFloatArray() {
fail("Not yet implemented");
public void testRows() {
assertEquals(matSize, gray0.rows());
}
public void testGetIntIntDoubleArray() {
public void testSetToDouble() {
fail("Not yet implemented");
}
public void testSetToDoubleDoubleDoubleDouble() {
public void testSetToDoubleDouble() {
fail("Not yet implemented");
}
......@@ -172,31 +176,27 @@ public class MatTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testSetToDoubleDouble() {
fail("Not yet implemented");
}
public void testSetToDouble() {
public void testSetToDoubleDoubleDoubleDouble() {
fail("Not yet implemented");
}
public void testCopyTo() {
public void testSubmat() {
fail("Not yet implemented");
}
public void testDot() {
public void testToString() {
fail("Not yet implemented");
}
public void testCross() {
public void testTotal() {
fail("Not yet implemented");
}
public void testInv() {
public void testType() {
fail("Not yet implemented");
}
public void testGetNativeObjAddr() {
public void testWidth() {
fail("Not yet implemented");
}
}
package org.opencv.test;
import java.io.FileOutputStream;
import junit.framework.TestCase;
import org.opencv.Mat;
import org.opencv.core;
import org.opencv.highgui;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap.CompressFormat;
import android.test.AndroidTestCase;
import android.util.Log;
public class OpenCVTestCase extends AndroidTestCase {
static String TAG = "OpenCV_JavaAPI_Tests";
public class OpenCVTestCase extends TestCase {
static String LENA = "/data/data/org.opencv.test/files/lena.jpg";
static int matSize = 10;
//Naming notation: channels_[type]_[dimension]_value
static Mat dst;
//Naming notation: <channels info>_[depth]_[dimensions]_value
//examples: gray0 - single channel 8U 2d Mat filled with 0
// grayRnd - single channel 8U 2d Mat filled with random numbers
// gray0_32f_1d - refactor ;)
......@@ -31,31 +26,30 @@ public class OpenCVTestCase extends AndroidTestCase {
static Mat gray3;
static Mat gray127;
static Mat gray128;
static Mat gray255;
static Mat gray255_32f;
static Mat grayRnd;
static Mat grayRnd_32f;
static Mat gray255;
static Mat grayRnd;
static Mat gray0_32f;
static Mat gray255_32f;
static Mat grayE_32f;
static Mat gray0_32f;
static Mat grayRnd_32f;
static Mat gray0_32f_1d;
static Mat gray0_64f;
static Mat gray0_64f_1d;
static Mat rgba0;
static Mat rgba128;
static Mat rgbLena;
static Mat dst;
static Mat rgba0;
static Mat rgba128;
@Override
protected void setUp() throws Exception {
super.setUp();
dst = new Mat();
assertTrue(dst.empty());
gray0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray0.setTo(0.0);
gray1 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray1.setTo(1.0);
......@@ -63,41 +57,26 @@ public class OpenCVTestCase extends AndroidTestCase {
gray3 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray3.setTo(3.0);
gray127 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray127.setTo(127.0);
gray128 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray128.setTo(128.0);
gray255 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray255.setTo(256.0);
gray255_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray255_32f.setTo(255.0);
gray255 = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); gray255.setTo(255.0);
Mat low = new Mat(1, 1, Mat.CvType.CV_16UC1); low.setTo(0);
Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1); high.setTo(256);
Mat low = new Mat(1, 1, Mat.CvType.CV_16UC1, 0.0);
Mat high = new Mat(1, 1, Mat.CvType.CV_16UC1, 256.0);
grayRnd = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); core.randu(grayRnd, low, high);
grayRnd_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); core.randu(grayRnd_32f, low, high);
gray0_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray0_32f.setTo(0.0);
gray255_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray255_32f.setTo(255.0);
grayE_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); grayE_32f = Mat.eye(matSize, matSize, Mat.CvType.CV_32FC1);
grayRnd_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); core.randu(grayRnd_32f, low, high);
gray0_32f = new Mat(matSize, matSize, Mat.CvType.CV_32FC1); gray0_32f.setTo(0.0);
gray0_32f_1d = new Mat(1, matSize, Mat.CvType.CV_32FC1); gray0_32f_1d.setTo(0.0);
gray0_64f = new Mat(matSize, matSize, Mat.CvType.CV_64FC1); gray0_64f.setTo(0.0);
gray0_64f_1d = new Mat(1, matSize, Mat.CvType.CV_64FC1); gray0_64f_1d.setTo(0.0);
rgbLena = highgui.imread(LENA);
rgba0 = new Mat(matSize, matSize, Mat.CvType.CV_8UC4); rgba0.setTo(0, 0, 0, 0);
rgba128 = new Mat(matSize, matSize, Mat.CvType.CV_8UC4); rgba128.setTo(128, 128, 128, 128);
try {
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.lena);
FileOutputStream fos = this.getContext().openFileOutput("lena.jpg", Context.MODE_WORLD_READABLE);
mBitmap.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
}
catch (Exception e) {
Log.e(TAG, "Tried to write lena.jpg, but: " + e.toString());
}
rgbLena = highgui.imread(LENA);
dst = new Mat();
assertTrue(dst.empty());
}
public static void assertMatEqual(Mat m1, Mat m2) {
......@@ -114,8 +93,10 @@ public class OpenCVTestCase extends AndroidTestCase {
}
public void test_1(String label) {
Log.e(TAG, "================================================");
Log.e(TAG, "=============== " + label);
Log.e(TAG, "================================================");
utils.Log("================================================");
utils.Log("=============== " + label);
utils.Log("================================================");
new utils().ExportLena();
}
}
package org.opencv.test;
import java.io.FileOutputStream;
import org.opencv.Mat;
import org.opencv.highgui;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.BitmapFactory;
import android.util.Log;
public class highguiTest extends OpenCVTestCase {
......@@ -39,32 +30,33 @@ public class highguiTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testImreadStringInt() {
dst = highgui.imread(LENA, 0);
public void testImreadString() {
dst = highgui.imread(LENA);
assertTrue(!dst.empty());
assertEquals(1, dst.channels());
assertEquals(3, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
}
public void testImreadString() {
dst = highgui.imread(LENA);
public void testImreadStringInt() {
dst = highgui.imread(LENA, 0);
assertTrue(!dst.empty());
assertEquals(3, dst.channels());
assertEquals(1, dst.channels());
assertTrue(512 == dst.cols());
assertTrue(512 == dst.rows());
}
public void testImshow() {
//XXX: do we need this function?
fail("Not yet implemented");
}
public void testNamedWindowStringInt() {
public void testNamedWindowString() {
//XXX: do not export this function
fail("Do not export this function");
}
public void testNamedWindowString() {
public void testNamedWindowStringInt() {
//XXX: do not export this function
fail("Do not export this function");
}
......@@ -84,12 +76,12 @@ public class highguiTest extends OpenCVTestCase {
fail("Do not export this function");
}
public void testWaitKeyInt() {
public void testWaitKey() {
//XXX: we need this function if only imshow will be implemented
fail("Not yet implemented");
}
public void testWaitKey() {
public void testWaitKeyInt() {
//XXX: we need this function if only imshow will be implemented
fail("Not yet implemented");
}
......
package org.opencv.test;
import java.io.FileOutputStream;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Bitmap.CompressFormat;
import android.test.AndroidTestCase;
import android.util.Log;
public class utils extends AndroidTestCase {
static String TAG = "opencv_test_java";
static public void Log(String message) {
Log.e(TAG, message);
}
public void ExportLena() {
//TODO: can we run this code just once, not for every test case?
try {
Bitmap mBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.lena);
FileOutputStream fos = this.getContext().openFileOutput("lena.jpg", Context.MODE_WORLD_READABLE);
mBitmap.compress(CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
}
catch (Exception e) {
Log.e(TAG, "Tried to write lena.jpg, but: " + e.toString());
}
}
}
......@@ -7,11 +7,11 @@ public class videoTest extends OpenCVTestCase {
fail("Not yet implemented");
}
public void testCalcMotionGradientMatMatMatDoubleDoubleInt() {
public void testCalcMotionGradientMatMatMatDoubleDouble() {
fail("Not yet implemented");
}
public void testCalcMotionGradientMatMatMatDoubleDouble() {
public void testCalcMotionGradientMatMatMatDoubleDoubleInt() {
fail("Not yet implemented");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment