Merge pull request #22594 from ZhaoChuyang:pr_test_for_22253

add test for PR #22253
This commit is contained in:
Alexander Smorkalov 2022-12-01 13:47:32 +03:00 committed by GitHub
commit 5696629b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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):