mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
Added tests for Image2D
This commit is contained in:
parent
e40567eaee
commit
3a263c6326
@ -4624,6 +4624,9 @@ struct Image2D::Impl
|
||||
|
||||
static bool isFormatSupported(cl_image_format format)
|
||||
{
|
||||
if (!haveOpenCL())
|
||||
CV_Error(Error::OpenCLApiCallError, "OpenCL runtime not found!");
|
||||
|
||||
cl_context context = (cl_context)Context::getDefault().ptr();
|
||||
// Figure out how many formats are supported by this context.
|
||||
cl_uint numFormats = 0;
|
||||
|
43
modules/core/test/ocl/test_image2d.cpp
Normal file
43
modules/core/test/ocl/test_image2d.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
// This file is part of OpenCV project.
|
||||
// It is subject to the license terms in the LICENSE file found in the top-level directory
|
||||
// of this distribution and at http://opencv.org/license.html.
|
||||
|
||||
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
|
||||
#include "../test_precomp.hpp"
|
||||
#include "opencv2/ts/ocl_test.hpp"
|
||||
|
||||
#ifdef HAVE_OPENCL
|
||||
|
||||
namespace cvtest {
|
||||
namespace ocl {
|
||||
|
||||
PARAM_TEST_CASE(Image2DBasicTest, int, int)
|
||||
{
|
||||
int depth, ch;
|
||||
|
||||
|
||||
};
|
||||
|
||||
TEST(Image2D, turnOffOpenCL)
|
||||
{
|
||||
if (cv::ocl::haveOpenCL())
|
||||
{
|
||||
// save the current state
|
||||
bool useOCL = cv::ocl::useOpenCL();
|
||||
|
||||
cv::ocl::setUseOpenCL(true);
|
||||
UMat um(128, 128, CV_8UC1);
|
||||
|
||||
cv::ocl::setUseOpenCL(false);
|
||||
cv::ocl::Image2D image(um);
|
||||
|
||||
// reset state to the previous one
|
||||
cv::ocl::setUseOpenCL(useOCL);
|
||||
}
|
||||
}
|
||||
|
||||
} } // namespace cvtest::ocl
|
||||
|
||||
#endif // HAVE_OPENCL
|
Loading…
Reference in New Issue
Block a user