mirror of
https://github.com/zebrajr/opencv.git
synced 2025-12-06 12:19:50 +01:00
Merge pull request #27504 from asmorkalov:as/optional_gdal
Made some GDAL specific tests optional
This commit is contained in:
commit
6b55ae0319
|
|
@ -8,10 +8,14 @@ namespace opencv_test { namespace {
|
||||||
|
|
||||||
#ifdef HAVE_GDAL
|
#ifdef HAVE_GDAL
|
||||||
|
|
||||||
static void test_gdal_read(const string filename) {
|
static void test_gdal_read(const string filename, bool required = true) {
|
||||||
const string path = cvtest::findDataFile(filename);
|
const string path = cvtest::findDataFile(filename);
|
||||||
Mat img;
|
Mat img;
|
||||||
ASSERT_NO_THROW(img = imread(path, cv::IMREAD_LOAD_GDAL | cv::IMREAD_ANYDEPTH | cv::IMREAD_ANYCOLOR));
|
ASSERT_NO_THROW(img = imread(path, cv::IMREAD_LOAD_GDAL | cv::IMREAD_ANYDEPTH | cv::IMREAD_ANYCOLOR));
|
||||||
|
if(!required && img.empty())
|
||||||
|
{
|
||||||
|
throw SkipTestException("GDAL is built wihout required back-end support");
|
||||||
|
}
|
||||||
ASSERT_FALSE(img.empty());
|
ASSERT_FALSE(img.empty());
|
||||||
EXPECT_EQ(3, img.cols);
|
EXPECT_EQ(3, img.cols);
|
||||||
EXPECT_EQ(5, img.rows);
|
EXPECT_EQ(5, img.rows);
|
||||||
|
|
@ -26,13 +30,12 @@ TEST(Imgcodecs_gdal, read_envi)
|
||||||
test_gdal_read("../cv/gdal/envi_test.raw");
|
test_gdal_read("../cv/gdal/envi_test.raw");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TEST(Imgcodecs_gdal, read_fits)
|
TEST(Imgcodecs_gdal, read_fits)
|
||||||
{
|
{
|
||||||
test_gdal_read("../cv/gdal/fits_test.fit");
|
// .fit test is optional because GDAL may be built wihtout CFITSIO library support
|
||||||
|
test_gdal_read("../cv/gdal/fits_test.fit", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // HAVE_GDAL
|
#endif // HAVE_GDAL
|
||||||
|
|
||||||
}} // namespace
|
}} // namespace
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user