meson: fix tests when zlib is disabled

This sometimes shows up in CI if zlib is not found.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 2 years ago
parent 3633f8d2c2
commit cfc0ef0b65

@ -23,7 +23,6 @@ test_sources = files(
'test_image_int.cpp',
'test_jp2image.cpp',
'test_jp2image_int.cpp',
'test_pngimage.cpp',
'test_safe_op.cpp',
'test_slice.cpp',
'test_tiffheader.cpp',
@ -39,6 +38,12 @@ if get_option('video')
)
endif
if zlib_dep.found()
test_sources += files(
'test_pngimage.cpp',
)
endif
if host_machine.system() == 'windows' and get_option('default_library') != 'static'
test_sources += int_lib
endif

@ -22,7 +22,9 @@ TEST(TheImageFactory, createsInstancesForFewSupportedTypesInMemory) {
EXPECT_NO_THROW(ImageFactory::create(ImageType::jpeg));
EXPECT_NO_THROW(ImageFactory::create(ImageType::exv));
EXPECT_NO_THROW(ImageFactory::create(ImageType::pgf));
#ifdef EXV_HAVE_LIBZ
EXPECT_NO_THROW(ImageFactory::create(ImageType::png));
#endif
}
TEST(TheImageFactory, cannotCreateInstancesForMostTypesInMemory) {
@ -66,7 +68,9 @@ TEST(TheImageFactory, createsInstancesForFewSupportedTypesInFiles) {
EXPECT_NO_THROW(ImageFactory::create(ImageType::jpeg, filePath));
EXPECT_NO_THROW(ImageFactory::create(ImageType::exv, filePath));
EXPECT_NO_THROW(ImageFactory::create(ImageType::pgf, filePath));
#ifdef EXV_HAVE_LIBZ
EXPECT_NO_THROW(ImageFactory::create(ImageType::png, filePath));
#endif
EXPECT_TRUE(fs::remove(filePath));
}
@ -116,9 +120,11 @@ TEST(TheImageFactory, loadInstancesDifferentImageTypes) {
EXPECT_EQ(ImageType::tiff, ImageFactory::getType(imagePath));
EXPECT_NO_THROW(ImageFactory::open(imagePath, false));
#ifdef EXV_HAVE_LIBZ
imagePath = (testData / "exiv2-bug1074.png").string();
EXPECT_EQ(ImageType::png, ImageFactory::getType(imagePath));
EXPECT_NO_THROW(ImageFactory::open(imagePath, false));
#endif
imagePath = (testData / "BlueSquare.xmp").string();
EXPECT_EQ(ImageType::xmp, ImageFactory::getType(imagePath));

Loading…
Cancel
Save