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
fe29080d
Commit
fe29080d
authored
Nov 22, 2016
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
java: skip test in case of missed classes from opencv_contrib
parent
8d662a1a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
3 deletions
+77
-3
OpenCVTestCase.java
...java/android_test/src/org/opencv/test/OpenCVTestCase.java
+38
-1
build.xml
modules/java/pure_test/build.xml
+1
-1
OpenCVTestCase.java
...es/java/pure_test/src/org/opencv/test/OpenCVTestCase.java
+38
-1
No files found.
modules/java/android_test/src/org/opencv/test/OpenCVTestCase.java
View file @
fe29080d
...
...
@@ -29,6 +29,11 @@ import static junit.framework.Assert.assertFalse;
import
static
junit
.
framework
.
Assert
.
assertTrue
;
public
class
OpenCVTestCase
extends
TestCase
{
public
static
class
TestSkipException
extends
RuntimeException
{
public
TestSkipException
()
{}
}
//change to 'true' to unblock fail on fail("Not yet implemented")
public
static
final
boolean
passNYI
=
true
;
...
...
@@ -188,12 +193,40 @@ public class OpenCVTestCase extends TestCase {
protected
void
runTest
()
throws
Throwable
{
// Do nothing if the precondition does not hold.
if
(
isTestCaseEnabled
)
{
super
.
runTest
();
try
{
super
.
runTest
();
}
catch
(
TestSkipException
ex
)
{
Log
.
w
(
TAG
,
"Test case \""
+
this
.
getClass
().
getName
()
+
"\" skipped!"
);
assertTrue
(
true
);
}
}
else
{
Log
.
e
(
TAG
,
"Test case \""
+
this
.
getClass
().
getName
()
+
"\" disabled!"
);
}
}
public
void
runBare
()
throws
Throwable
{
Throwable
exception
=
null
;
try
{
setUp
();
}
catch
(
TestSkipException
ex
)
{
Log
.
w
(
TAG
,
"Test case \""
+
this
.
getClass
().
getName
()
+
"\" skipped!"
);
assertTrue
(
true
);
return
;
}
try
{
runTest
();
}
catch
(
Throwable
running
)
{
exception
=
running
;
}
finally
{
try
{
tearDown
();
}
catch
(
Throwable
tearingDown
)
{
if
(
exception
==
null
)
exception
=
tearingDown
;
}
}
if
(
exception
!=
null
)
throw
exception
;
}
protected
Mat
getMat
(
int
type
,
double
...
vals
)
{
return
new
Mat
(
matSize
,
matSize
,
type
,
new
Scalar
(
vals
));
...
...
@@ -497,6 +530,10 @@ public class OpenCVTestCase extends TestCase {
}
}
catch
(
Exception
ex
)
{
if
(
cname
.
startsWith
(
XFEATURES2D
))
{
throw
new
TestSkipException
();
}
message
=
TAG
+
" :: "
+
"could not instantiate "
+
cname
+
"! Exception: "
+
ex
.
getMessage
();
}
...
...
modules/java/pure_test/build.xml
View file @
fe29080d
...
...
@@ -37,7 +37,7 @@
<target
name=
"test"
>
<mkdir
dir=
"${test.dir}"
/>
<junit
printsummary=
"true"
haltonfailure=
"false"
haltonerror=
"false"
showoutput=
"
fals
e"
logfailedtests=
"true"
maxmemory=
"256m"
>
<junit
printsummary=
"true"
haltonfailure=
"false"
haltonerror=
"false"
showoutput=
"
tru
e"
logfailedtests=
"true"
maxmemory=
"256m"
>
<sysproperty
key=
"java.library.path"
path=
"${opencv.lib.path}"
/>
<env
key=
"PATH"
path=
"${opencv.lib.path}"
/>
<classpath
refid=
"master-classpath"
/>
...
...
modules/java/pure_test/src/org/opencv/test/OpenCVTestCase.java
View file @
fe29080d
...
...
@@ -27,6 +27,11 @@ import org.opencv.core.KeyPoint;
import
org.opencv.imgcodecs.Imgcodecs
;
public
class
OpenCVTestCase
extends
TestCase
{
public
static
class
TestSkipException
extends
RuntimeException
{
public
TestSkipException
()
{}
}
//change to 'true' to unblock fail on fail("Not yet implemented")
public
static
final
boolean
passNYI
=
true
;
...
...
@@ -214,12 +219,40 @@ public class OpenCVTestCase extends TestCase {
protected
void
runTest
()
throws
Throwable
{
// Do nothing if the precondition does not hold.
if
(
isTestCaseEnabled
)
{
super
.
runTest
();
try
{
super
.
runTest
();
}
catch
(
TestSkipException
ex
)
{
OpenCVTestRunner
.
Log
(
TAG
+
" :: "
+
"Test case \""
+
this
.
getClass
().
getName
()
+
"\" skipped!"
);
assertTrue
(
true
);
}
}
else
{
OpenCVTestRunner
.
Log
(
TAG
+
" :: "
+
"Test case \""
+
this
.
getClass
().
getName
()
+
"\" disabled!"
);
}
}
public
void
runBare
()
throws
Throwable
{
Throwable
exception
=
null
;
try
{
setUp
();
}
catch
(
TestSkipException
ex
)
{
OpenCVTestRunner
.
Log
(
TAG
+
" :: "
+
"Test case \""
+
this
.
getClass
().
getName
()
+
"\" skipped!"
);
assertTrue
(
true
);
return
;
}
try
{
runTest
();
}
catch
(
Throwable
running
)
{
exception
=
running
;
}
finally
{
try
{
tearDown
();
}
catch
(
Throwable
tearingDown
)
{
if
(
exception
==
null
)
exception
=
tearingDown
;
}
}
if
(
exception
!=
null
)
throw
exception
;
}
protected
Mat
getMat
(
int
type
,
double
...
vals
)
{
return
new
Mat
(
matSize
,
matSize
,
type
,
new
Scalar
(
vals
));
...
...
@@ -523,6 +556,10 @@ public class OpenCVTestCase extends TestCase {
}
}
catch
(
Exception
ex
)
{
if
(
cname
.
startsWith
(
XFEATURES2D
))
{
throw
new
TestSkipException
();
}
message
=
TAG
+
" :: "
+
"could not instantiate "
+
cname
+
"! Exception: "
+
ex
.
getMessage
();
}
...
...
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