refactor: rework test to be more specific
This commit is contained in:
parent
f1055a7e91
commit
3a15152be5
@ -219,6 +219,11 @@ AsyncArray testAsyncException()
|
|||||||
return p.getArrayResult();
|
return p.getArrayResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CV_WRAP static inline
|
||||||
|
String dumpVec2i(const cv::Vec2i value = cv::Vec2i(42, 24)) {
|
||||||
|
return format("Vec2i(%d, %d)", value[0], value[1]);
|
||||||
|
}
|
||||||
|
|
||||||
namespace nested {
|
namespace nested {
|
||||||
CV_WRAP static inline bool testEchoBooleanFunction(bool flag) {
|
CV_WRAP static inline bool testEchoBooleanFunction(bool flag) {
|
||||||
return flag;
|
return flag;
|
||||||
|
|||||||
@ -4973,7 +4973,6 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//! @cond IGNORED
|
//! @cond IGNORED
|
||||||
CV_EXPORTS_W void testMatxPythonConverter(InputArray src, OutputArray dst, const Vec2d& defaultParam = Vec2d(-5, 5));
|
|
||||||
|
|
||||||
// === LineIterator implementation ===
|
// === LineIterator implementation ===
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
from __future__ import print_function
|
|
||||||
import cv2 as cv
|
|
||||||
from cv2 import testMatxPythonConverter
|
|
||||||
from tests_common import NewOpenCVTests
|
|
||||||
|
|
||||||
|
|
||||||
class MatxConverterTest(NewOpenCVTests):
|
|
||||||
def test_matxconverter(self):
|
|
||||||
samples = ['samples/data/lena.jpg', 'cv/cascadeandhog/images/mona-lisa.png']
|
|
||||||
|
|
||||||
for sample in samples:
|
|
||||||
img = self.get_sample(sample)
|
|
||||||
out = testMatxPythonConverter(img)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
NewOpenCVTests.bootstrap()
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
#include "precomp.hpp"
|
|
||||||
|
|
||||||
namespace cv{
|
|
||||||
void testMatxPythonConverter(InputArray _src, OutputArray _dst, const Vec2d& defaultParam){
|
|
||||||
printf("%f %f\n", defaultParam[0], defaultParam[1]);
|
|
||||||
Mat src = _src.getMat();
|
|
||||||
src.copyTo(_dst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -62,8 +62,9 @@ PyObject* pyopencv_from(const T& src) { return PyOpenCV_Converter<T>::from(src);
|
|||||||
template<typename _Tp, int m, int n>
|
template<typename _Tp, int m, int n>
|
||||||
bool pyopencv_to(PyObject* o, cv::Matx<_Tp, m, n>& mx, const ArgInfo& info)
|
bool pyopencv_to(PyObject* o, cv::Matx<_Tp, m, n>& mx, const ArgInfo& info)
|
||||||
{
|
{
|
||||||
if (!o || o == Py_None)
|
if (!o || o == Py_None) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
cv::Mat tmp;
|
cv::Mat tmp;
|
||||||
if (!pyopencv_to(o, tmp, info)) {
|
if (!pyopencv_to(o, tmp, info)) {
|
||||||
|
|||||||
@ -736,6 +736,13 @@ class CanUsePurePythonModuleFunction(NewOpenCVTests):
|
|||||||
res = cv.utils._native.testOverwriteNativeMethod(123)
|
res = cv.utils._native.testOverwriteNativeMethod(123)
|
||||||
self.assertEqual(res, 123, msg="Failed to call native method implementation")
|
self.assertEqual(res, 123, msg="Failed to call native method implementation")
|
||||||
|
|
||||||
|
def test_default_matx_argument(self):
|
||||||
|
res = cv.utils.dumpVec2i()
|
||||||
|
self.assertEqual(res, "Vec2i(42, 24)",
|
||||||
|
msg="Default argument is not properly handled")
|
||||||
|
res = cv.utils.dumpVec2i((12, 21))
|
||||||
|
self.assertEqual(res, "Vec2i(12, 21)")
|
||||||
|
|
||||||
|
|
||||||
class SamplesFindFile(NewOpenCVTests):
|
class SamplesFindFile(NewOpenCVTests):
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user