diff --git a/ext/opencv/cvmat.cpp b/ext/opencv/cvmat.cpp index dc174f9..fbc98c9 100644 --- a/ext/opencv/cvmat.cpp +++ b/ext/opencv/cvmat.cpp @@ -705,7 +705,7 @@ rb_clone(VALUE self) VALUE rb_copy(int argc, VALUE *argv, VALUE self) { - VALUE value, copied, tmp; + VALUE value, copied; CvMat *src = CVMAT(self); rb_scan_args(argc, argv, "01", &value); if (argc == 0) { @@ -724,7 +724,7 @@ rb_copy(int argc, VALUE *argv, VALUE self) if (n > 0) { copied = rb_ary_new2(n); for (int i = 0; i < n; i++) { - tmp = new_object(src->rows, src->cols, cvGetElemType(src)); + VALUE tmp = new_object(src->rows, src->cols, cvGetElemType(src)); cvCopy(src, CVMAT(tmp)); rb_ary_store(copied, i, tmp); } @@ -733,8 +733,9 @@ rb_copy(int argc, VALUE *argv, VALUE self) else { return Qnil; } - }else - rb_raise(rb_eArgError, ""); + } + else + rb_raise(rb_eArgError, "Argument should be CvMat or Fixnum"); } } diff --git a/test/test_cvmat.rb b/test/test_cvmat.rb index 2621863..5e798be 100755 --- a/test/test_cvmat.rb +++ b/test/test_cvmat.rb @@ -199,19 +199,8 @@ class TestCvMat < OpenCVTestCase } assert_nil(m1.copy(-1)) - flunk('FIXME: CvUnmatchedSizes and CvUnmatchedFormats are not implemented yet') - m2 = CvMat.new(1, 2, CV_32F, 1) - assert_raise(CvUnmatchedSizes) { - m1.copy(m2) - } - - m2 = CvMat.new(10, 20, CV_32F, 3) - assert_raise(CvUnmatchedFormats) { - m1.copy(m2) - } - m2 = CvMat.new(10, 20, CV_8U, 1) - assert_raise(CvUnmatchedFormats) { - m1.copy(m2) + assert_raise(ArgumentError) { + m1.copy('foobar') } end