Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
85166360
Commit
85166360
authored
Jul 04, 2011
by
Kirill Kornyakov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java tests updated: now they independent from android, test methods are sorted alphabetically
parent
f301cda7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
136 additions
and
128 deletions
+136
-128
.classpath
modules/java/android_test/.classpath
+1
-1
MatTest.java
modules/java/android_test/src/org/opencv/test/MatTest.java
+56
-56
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+31
-50
coreTest.java
modules/java/android_test/src/org/opencv/test/coreTest.java
+0
-0
highguiTest.java
...es/java/android_test/src/org/opencv/test/highguiTest.java
+11
-19
imgprocTest.java
...es/java/android_test/src/org/opencv/test/imgprocTest.java
+0
-0
utils.java
modules/java/android_test/src/org/opencv/test/utils.java
+35
-0
videoTest.java
modules/java/android_test/src/org/opencv/test/videoTest.java
+2
-2
No files found.
modules/java/android_test/.classpath
View file @
85166360
...
...
@@ -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>
modules/java/android_test/src/org/opencv/test/MatTest.java
View file @
85166360
...
...
@@ -8,35 +8,39 @@ public class MatTest extends OpenCVTestCase {
super
.
test_1
(
"Mat"
);
}
public
void
test
Finalize
()
{
public
void
test
Channels
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
MatLong
()
{
public
void
test
Clone
()
{
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
test
MatIntIntCvTypeDoubleDoubleDoubleDoubl
e
()
{
public
void
test
ColRang
e
()
{
fail
(
"Not yet implemented"
);
}
public
void
testMatIntIntCvTypeDoubleDoubleDouble
()
{
public
void
testCols
()
{
assertEquals
(
matSize
,
gray0
.
rows
());
}
public
void
testCopyTo
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
MatIntIntCvTypeDoubleDouble
()
{
public
void
test
Cross
()
{
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
test
ToString
()
{
public
void
test
Dot
()
{
fail
(
"Not yet implemented"
);
}
public
void
testE
mpty
()
{
public
void
testE
lemSize
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Type
()
{
public
void
test
Empty
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Depth
()
{
public
void
test
Finalize
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Channels
()
{
public
void
test
GetIntIntByteArray
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
ElemSize
()
{
public
void
test
GetIntIntDoubleArray
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Rows
()
{
assertEquals
(
matSize
,
gray0
.
rows
()
);
public
void
test
GetIntIntFloatArray
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Height
()
{
public
void
test
GetIntIntIntArray
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Cols
()
{
assertEquals
(
matSize
,
gray0
.
rows
()
);
public
void
test
GetIntIntShortArray
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Width
()
{
public
void
test
GetNativeObjAddr
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Total
()
{
public
void
test
Height
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
DataAddr
()
{
public
void
test
Inv
()
{
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
test
RowRang
e
()
{
public
void
test
MatIntIntCvTypeDoubleDoubl
e
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Row
()
{
public
void
test
MatIntIntCvTypeDoubleDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
ColRang
e
()
{
public
void
test
MatIntIntCvTypeDoubleDoubleDoubleDoubl
e
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Col
()
{
public
void
test
MatLong
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Clone
()
{
public
void
test
PutIntIntByteArray
()
{
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
test
GetIntIntIntArray
()
{
public
void
test
RowRange
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
GetIntIntFloatArray
()
{
fail
(
"Not yet implemented"
);
public
void
test
Rows
()
{
assertEquals
(
matSize
,
gray0
.
rows
()
);
}
public
void
test
GetIntIntDoubleArray
()
{
public
void
test
SetToDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testSetToDoubleDouble
DoubleDouble
()
{
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
test
CopyTo
()
{
public
void
test
Submat
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Dot
()
{
public
void
test
ToString
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Cross
()
{
public
void
test
Total
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
Inv
()
{
public
void
test
Type
()
{
fail
(
"Not yet implemented"
);
}
public
void
test
GetNativeObjAddr
()
{
public
void
test
Width
()
{
fail
(
"Not yet implemented"
);
}
}
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
85166360
package
org
.
opencv
.
test
;
import
j
ava.io.FileOutputStream
;
import
j
unit.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
();
}
}
modules/java/android_test/src/org/opencv/test/coreTest.java
View file @
85166360
This diff is collapsed.
Click to expand it.
modules/java/android_test/src/org/opencv/test/highguiTest.java
View file @
85166360
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
testImreadString
Int
()
{
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
testImreadString
Int
()
{
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
testNamedWindowString
Int
()
{
public
void
testNamedWindowString
()
{
//XXX: do not export this function
fail
(
"Do not export this function"
);
}
public
void
testNamedWindowString
()
{
public
void
testNamedWindowString
Int
()
{
//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
testWaitKey
Int
()
{
public
void
testWaitKey
()
{
//XXX: we need this function if only imshow will be implemented
fail
(
"Not yet implemented"
);
}
public
void
testWaitKey
()
{
public
void
testWaitKey
Int
()
{
//XXX: we need this function if only imshow will be implemented
fail
(
"Not yet implemented"
);
}
...
...
modules/java/android_test/src/org/opencv/test/imgprocTest.java
View file @
85166360
This diff is collapsed.
Click to expand it.
modules/java/android_test/src/org/opencv/test/utils.java
0 → 100644
View file @
85166360
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
());
}
}
}
modules/java/android_test/src/org/opencv/test/videoTest.java
View file @
85166360
...
...
@@ -7,11 +7,11 @@ public class videoTest extends OpenCVTestCase {
fail
(
"Not yet implemented"
);
}
public
void
testCalcMotionGradientMatMatMatDoubleDouble
Int
()
{
public
void
testCalcMotionGradientMatMatMatDoubleDouble
()
{
fail
(
"Not yet implemented"
);
}
public
void
testCalcMotionGradientMatMatMatDoubleDouble
()
{
public
void
testCalcMotionGradientMatMatMatDoubleDouble
Int
()
{
fail
(
"Not yet implemented"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment