1
0
Fork 0
mirror of https://github.com/ruby-opencv/ruby-opencv synced 2023-03-27 23:22:12 -04:00

fixed a bug (unexpected aborts of CvMat#to_CvMat)

This commit is contained in:
ser1zw 2011-05-15 02:08:02 +09:00
parent a1331c9fdc
commit 7b378e7608
2 changed files with 11 additions and 4 deletions

View file

@ -923,6 +923,10 @@ rb_square_q(VALUE self)
VALUE
rb_to_CvMat(VALUE self)
{
// CvMat#to_CvMat aborts when self's class is CvMat. (I don't know why...)
if (CLASS_OF(self) == rb_klass)
return self;
return DEPEND_OBJECT(rb_klass, cvGetMat(CVARR(self), RB_CVALLOC(CvMat)), self);
}

View file

@ -127,7 +127,6 @@ class TestCvMat < OpenCVTestCase
assert((not m1.has_parent?))
assert_nil(m1.parent)
flunk('FIXME: resolve unexpected ABORT of CvMat#to_CvMat')
m2 = m1.to_CvMat
assert(m2.has_parent?)
assert_same(m1, m2.parent)
@ -253,10 +252,14 @@ class TestCvMat < OpenCVTestCase
end
def test_to_CvMat
m1 = CvMat.new(2, 2)
flunk('FIXME: resolve unexpected ABORT of CvMat#to_CvMat')
m1 = CvMat.new(2, 3, :cv32f, 4)
m2 = m1.to_CvMat
assert_same(m1, m2.parent)
assert_equal(CvMat, m2.class)
assert_equal(m1.rows, m2.rows)
assert_equal(m1.cols, m2.cols)
assert_equal(m1.depth, m2.depth)
assert_equal(m1.channel, m2.channel)
assert_equal(m1.data, m2.data)
end
def test_sub_rect