Skip to content

Commit 0885a79

Browse files
committed
imgcodecs(test): don't include png.h
1 parent 93783df commit 0885a79

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

modules/imgcodecs/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,8 @@ ocv_add_accuracy_tests()
149149
if(TARGET opencv_test_imgcodecs AND HAVE_JASPER AND "$ENV{OPENCV_IO_ENABLE_JASPER}")
150150
ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_ENABLE_JASPER_TESTS=1)
151151
endif()
152+
if(TARGET opencv_test_imgcodecs AND HAVE_PNG AND NOT (PNG_VERSION VERSION_LESS "1.6.31"))
153+
# details: https://github.com/glennrp/libpng/commit/68cb0aaee3de6371b81a4613476d9b33e43e95b1
154+
ocv_target_compile_definitions(opencv_test_imgcodecs PRIVATE OPENCV_IMGCODECS_PNG_WITH_EXIF=1)
155+
endif()
152156
ocv_add_perf_tests()

modules/imgcodecs/test/test_png.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@ namespace opencv_test { namespace {
77

88
#ifdef HAVE_PNG
99

10-
#ifdef HAVE_LIBPNG_PNG_H
11-
#include <libpng/png.h>
12-
#else
13-
#include <png.h>
14-
#endif
15-
1610
TEST(Imgcodecs_Png, write_big)
1711
{
1812
const string root = cvtest::TS::ptr()->get_data_path();
@@ -99,7 +93,6 @@ TEST(Imgcodecs_Png, read_color_palette_with_alpha)
9993
EXPECT_EQ(img.at<Vec3b>(0, 1), Vec3b(0, 0, 255));
10094
}
10195

102-
#ifdef PNG_eXIf_SUPPORTED
10396
/**
10497
* Test for check whether reading exif orientation tag was processed successfully or not
10598
* The test info is the set of 8 images named testExifRotate_{1 to 8}.png
@@ -144,7 +137,11 @@ TEST(Imgcodecs_Png, read_color_palette_with_alpha)
144137
typedef testing::TestWithParam<string> Imgcodecs_PNG_Exif;
145138

146139
// Solution to issue 16579: PNG read doesn't support Exif orientation data
140+
#ifdef OPENCV_IMGCODECS_PNG_WITH_EXIF
147141
TEST_P(Imgcodecs_PNG_Exif, exif_orientation)
142+
#else
143+
TEST_P(Imgcodecs_PNG_Exif, DISABLED_exif_orientation)
144+
#endif
148145
{
149146
const string root = cvtest::TS::ptr()->get_data_path();
150147
const string filename = root + GetParam();
@@ -188,7 +185,6 @@ const string exif_files[] =
188185

189186
INSTANTIATE_TEST_CASE_P(ExifFiles, Imgcodecs_PNG_Exif,
190187
testing::ValuesIn(exif_files));
191-
#endif // PNG_eXIf_SUPPORTED
192188

193189
#endif // HAVE_PNG
194190

0 commit comments

Comments
 (0)