Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cc/core/Mat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ NAN_METHOD(Mat::GetDataAsArray) {

NAN_METHOD(Mat::GetRegion) {
if (!FF_IS_INSTANCE(Rect::constructor, info[0])) {
Nan::ThrowError("Mat::GetRegion expected arg0 to be an instance of Rect");
return Nan::ThrowError("Mat::GetRegion expected arg0 to be an instance of Rect");
}
cv::Rect2d rect = FF_UNWRAP(info[0]->ToObject(), Rect)->rect;
FF_OBJ jsRegion = FF_NEW_INSTANCE(constructor);
Expand Down
14 changes: 13 additions & 1 deletion test/tests/core/Mat/Mat.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,5 +980,17 @@ describe('Mat', () => {
describe('Row average', makeTest(1, cv.REDUCE_AVG, cv.CV_32F, [ [ 1 ] ]));
describe('Row max', makeTest(1, cv.REDUCE_MAX, -1, [ [ 1 ] ]));
describe('Row min', makeTest(1, cv.REDUCE_MIN, -1, [ [ 1 ] ]));
})
});

describe('checking of non-instance arguments', () => {
it('should throw errors with correct error '
+ 'messages with non-instance arguments', () => {
const img = getTestImg().bgrToGray();

assertError(
() => img.getRegion(0, 1, 2, 3),
'Error: Mat::GetRegion expected arg0 to be an instance of Rect'
);
});
});
});