1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

core: fix adjustROI behavior on indexes overflow

This commit is contained in:
Vladislav Sovrasov
2017-02-22 14:00:22 +03:00
parent 526220a171
commit 14451f3f06
4 changed files with 42 additions and 4 deletions
+14
View File
@@ -1240,3 +1240,17 @@ protected:
};
TEST(Core_SparseMat, iterations) { CV_SparseMatTest test; test.safe_run(); }
TEST(MatTestRoi, adjustRoiOverflow)
{
Mat m(15, 10, CV_32S);
Mat roi(m, cv::Range(2, 10), cv::Range(3,6));
int rowsInROI = roi.rows;
roi.adjustROI(1, 0, 0, 0);
ASSERT_EQ(roi.rows, rowsInROI + 1);
roi.adjustROI(-m.rows, -m.rows, 0, 0);
ASSERT_EQ(roi.rows, m.rows);
}
+14
View File
@@ -496,6 +496,20 @@ TEST_P(UMatTestRoi, adjustRoi)
INSTANTIATE_TEST_CASE_P(UMat, UMatTestRoi, Combine(OCL_ALL_DEPTHS, OCL_ALL_CHANNELS, UMAT_TEST_SIZES ));
TEST(UMatTestRoi, adjustRoiOverflow)
{
UMat m(15, 10, CV_32S);
UMat roi(m, cv::Range(2, 10), cv::Range(3,6));
int rowsInROI = roi.rows;
roi.adjustROI(1, 0, 0, 0);
ASSERT_EQ(roi.rows, rowsInROI + 1);
roi.adjustROI(-m.rows, -m.rows, 0, 0);
ASSERT_EQ(roi.rows, m.rows);
}
/////////////////////////////////////////////////////////////// Size ////////////////////////////////////////////////////////////////////
PARAM_TEST_CASE(UMatTestSizeOperations, int, int, Size, bool)