Merge pull request #22594 from ZhaoChuyang:pr_test_for_22253
add test for PR #22253
This commit is contained in:
commit
5696629b13
@ -219,6 +219,11 @@ AsyncArray testAsyncException()
|
||||
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 {
|
||||
CV_WRAP static inline bool testEchoBooleanFunction(bool flag) {
|
||||
return flag;
|
||||
|
||||
@ -62,6 +62,10 @@ PyObject* pyopencv_from(const T& src) { return PyOpenCV_Converter<T>::from(src);
|
||||
template<typename _Tp, int m, int n>
|
||||
bool pyopencv_to(PyObject* o, cv::Matx<_Tp, m, n>& mx, const ArgInfo& info)
|
||||
{
|
||||
if (!o || o == Py_None) {
|
||||
return true;
|
||||
}
|
||||
|
||||
cv::Mat tmp;
|
||||
if (!pyopencv_to(o, tmp, info)) {
|
||||
return false;
|
||||
|
||||
@ -736,6 +736,13 @@ class CanUsePurePythonModuleFunction(NewOpenCVTests):
|
||||
res = cv.utils._native.testOverwriteNativeMethod(123)
|
||||
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):
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user