several java tests added
authoritsyplen <no@email>
Sat, 2 Jul 2011 12:17:57 +0000 (12:17 +0000)
committeritsyplen <no@email>
Sat, 2 Jul 2011 12:17:57 +0000 (12:17 +0000)
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
modules/java/android_test/src/org/opencv/test/coreTest.java

index 2d41d02..dc8ef97 100644 (file)
@@ -19,6 +19,8 @@ public class OpenCVTestCase extends AndroidTestCase {
     static Mat gray128;
     static Mat gray255;
     
+    static Mat gray255_32f;
+    
     static Mat grayRnd;    
     static Mat grayRnd_32f;
     
@@ -49,6 +51,8 @@ public class OpenCVTestCase extends AndroidTestCase {
         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);
+        
         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);
         grayRnd = new Mat(matSize, matSize, Mat.CvType.CV_8UC1); core.randu(grayRnd, low, high);
index e2b7a6d..230ccfa 100644 (file)
@@ -63,11 +63,14 @@ public class coreTest extends OpenCVTestCase {
        }
 
        public void testAddWeightedMatDoubleMatDoubleDoubleMatInt() {
-               fail("Not yet implemented");
+               Mat dst = new Mat();
+               core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst, gray255_32f.depth());
+               assertTrue(gray255_32f.depth() == dst.depth());
        }
 
        public void testAddWeightedMatDoubleMatDoubleDoubleMat() {
-               fail("Not yet implemented");
+               core.addWeighted(gray1, 126.0, gray127, 1.0, 2.0, dst_gray);
+               assertMatEqual(gray255, dst_gray);              
        }
 
        public void testBitwise_andMatMatMatMat() {
@@ -164,6 +167,11 @@ public class coreTest extends OpenCVTestCase {
                
         core.compare(gray0, gray1, cmp, core.CMP_EQ);
         assertMatEqual(cmp, gray0);
+        
+        core.compare(gray0, grayRnd, cmp, core.CMP_EQ);
+        double nBlackPixels = core.countNonZero(cmp);
+        double nNonBlackpixels = core.countNonZero(grayRnd);
+        assertTrue((nBlackPixels+nNonBlackpixels) == grayRnd.rows()*grayRnd.cols());
        }
 
        public void testCompleteSymmMatBoolean() {
@@ -419,7 +427,8 @@ public class coreTest extends OpenCVTestCase {
        }
 
        public void testMulTransposedMatMatBooleanMat() {
-               fail("Not yet implemented");
+               core.mulTransposed(grayRnd_32f, dst_gray_32f, true, grayRnd_32f);
+               assertMatEqual(gray0_32f, dst_gray_32f);
        }
 
        public void testMulTransposedMatMatBoolean() {