diff --git a/ext/cvmat.cpp b/ext/cvmat.cpp index 750acba..8d6aa88 100644 --- a/ext/cvmat.cpp +++ b/ext/cvmat.cpp @@ -1374,7 +1374,7 @@ rb_reshape(VALUE self, VALUE hash) VALUE rb_repeat(VALUE self, VALUE object) { - if (rb_obj_is_kind_of(object, rb_class())) + if (!rb_obj_is_kind_of(object, rb_class())) rb_raise(rb_eTypeError, "argument should be CvMat subclass."); cvRepeat(CVARR(self), CVARR(object)); return object; diff --git a/test/test_cvmat.rb b/test/test_cvmat.rb index 3836d75..73d4dfa 100755 --- a/test/test_cvmat.rb +++ b/test/test_cvmat.rb @@ -594,11 +594,11 @@ class TestCvMat < OpenCVTestCase end def test_repeat - m1 = create_cvmat(2, 3) + m1 = create_cvmat(2, 3, :cv8u, 3) assert_raise(TypeError) { m1.repeat(1) } - m2 = CvMat.new(6, 9) + m2 = CvMat.new(6, 9, :cv8u, 3) m2 = m1.repeat(m2) m2.height.times { |j| m2.width.times { |i|