Commit 5780da88 for libheif
commit 5780da88104270ef316c764c2c2945e0c43af624
Author: Dirk Farin <dirk.farin@gmail.com>
Date: Mon May 25 14:27:48 2026 +0200
only run omaf and mini tests if codec plugins are available (thanks Petr G.)
diff --git a/tests/mini_decode.cc b/tests/mini_decode.cc
index 24768362..a23918ba 100644
--- a/tests/mini_decode.cc
+++ b/tests/mini_decode.cc
@@ -49,6 +49,10 @@ void check_image_handle_size(struct heif_context *&context) {
}
TEST_CASE("check image handle size") {
+ if (!heif_have_decoder_for_format(heif_compression_AV1)) {
+ SKIP("AV1 decoder not available, skipping test");
+ }
+
auto file = GENERATE(MINI_FILES);
auto context = get_context_for_test_file(file);
INFO("file name: " << file);
@@ -103,6 +107,10 @@ void check_image_size_heif_mini(struct heif_context *&context) {
}
TEST_CASE("check image size HEIF mini") {
+ if (!heif_have_decoder_for_format(heif_compression_HEVC)) {
+ SKIP("HEVC decoder not available, skipping test");
+ }
+
auto context = get_context_for_test_file("lightning_mini.heif");
check_image_size_heif_mini(context);
heif_context_free(context);
diff --git a/tests/omaf.cc b/tests/omaf.cc
index 36acd8a2..e82e93f9 100644
--- a/tests/omaf.cc
+++ b/tests/omaf.cc
@@ -47,10 +47,8 @@ static void do_encode(heif_image* input_image, const char* filename, heif_omaf_i
REQUIRE(input_image != nullptr);
heif_init(nullptr);
heif_context *ctx = heif_context_alloc();
- heif_encoder *encoder;
heif_error err;
- err = heif_context_get_encoder_for_format(ctx, heif_compression_HEVC, &encoder);
- REQUIRE(err.code == heif_error_Ok);
+ heif_encoder* encoder = get_encoder_or_skip_test(heif_compression_HEVC);
heif_encoding_options *options = set_encoding_options();
@@ -101,10 +99,8 @@ static void do_encode_via_image(heif_image* input_image, const char* filename, h
REQUIRE(heif_image_get_omaf_image_projection(input_image) == projection);
heif_context *ctx = heif_context_alloc();
- heif_encoder *encoder;
heif_error err;
- err = heif_context_get_encoder_for_format(ctx, heif_compression_HEVC, &encoder);
- REQUIRE(err.code == heif_error_Ok);
+ heif_encoder* encoder = get_encoder_or_skip_test(heif_compression_HEVC);
heif_encoding_options *options = set_encoding_options();