Skip to content

Commit 30156e9

Browse files
committed
Merge pull request #3168 from cudawarped:fix_gpumat_dataend_bug
2 parents d4719b2 + 55cbe76 commit 30156e9

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

modules/cudaarithm/test/test_gpumat.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,49 @@ INSTANTIATE_TEST_CASE_P(CUDA, GpuMat_ConvertTo, testing::Combine(
386386
ALL_DEPTH,
387387
WHOLE_SUBMAT));
388388

389+
////////////////////////////////////////////////////////////////////////////////
390+
// locateROI
391+
392+
PARAM_TEST_CASE(GpuMat_LocateROI, cv::cuda::DeviceInfo, cv::Size, MatDepth, UseRoi)
393+
{
394+
cv::cuda::DeviceInfo devInfo;
395+
cv::Size size;
396+
int depth;
397+
bool useRoi;
398+
399+
virtual void SetUp()
400+
{
401+
devInfo = GET_PARAM(0);
402+
size = GET_PARAM(1);
403+
depth = GET_PARAM(2);
404+
useRoi = GET_PARAM(3);
405+
406+
cv::cuda::setDevice(devInfo.deviceID());
407+
}
408+
};
409+
410+
CUDA_TEST_P(GpuMat_LocateROI, locateROI)
411+
{
412+
Point ofsGold;
413+
Size wholeSizeGold;
414+
GpuMat src = createMat(size, depth, wholeSizeGold, ofsGold, useRoi);
415+
416+
Point ofs;
417+
Size wholeSize;
418+
src.locateROI(wholeSize, ofs);
419+
ASSERT_TRUE(ofs == ofsGold && wholeSize == wholeSizeGold);
420+
421+
GpuMat srcPtr(src.size(), src.type(), src.data, src.step);
422+
src.locateROI(wholeSize, ofs);
423+
ASSERT_TRUE(ofs == ofsGold && wholeSize == wholeSizeGold);
424+
}
425+
426+
INSTANTIATE_TEST_CASE_P(CUDA, GpuMat_LocateROI, testing::Combine(
427+
ALL_DEVICES,
428+
DIFFERENT_SIZES,
429+
ALL_DEPTH,
430+
WHOLE_SUBMAT));
431+
389432
////////////////////////////////////////////////////////////////////////////////
390433
// ensureSizeIsEnough
391434

0 commit comments

Comments
 (0)