MCPcopy Create free account
hub / github.com/GDRETools/gdsdecomp / expect_image_decode_encode_match

Function expect_image_decode_encode_match

tests/test_variant_compat.h:667–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

665}
666
667void expect_image_decode_encode_match(const Ref<Image> &img, const String &expected_str, int ver_major, bool is_pcfg) {
668 int len;
669 bool p_full_objects = false;
670 Error err = VariantDecoderCompat::encode_variant_compat(ver_major, img, nullptr, len, p_full_objects);
671 CHECK(err == OK);
672
673 Vector<uint8_t> buff;
674 buff.resize(len);
675
676 uint8_t *w = buff.ptrw();
677 err = VariantDecoderCompat::encode_variant_compat(ver_major, img, &w[0], len, p_full_objects);
678 CHECK(err == OK);
679
680 Variant decoded;
681 err = VariantDecoderCompat::decode_variant_compat(ver_major, decoded, buff.ptr(), len, nullptr, p_full_objects);
682 CHECK(err == OK);
683 Ref<Image> decoded_img = decoded;
684 REQUIRE(decoded_img.is_valid());
685
686 compare_images(img, decoded_img);
687
688 expect_image_write_match(decoded_img, expected_str, ver_major, is_pcfg);
689}
690
691void test_image_variant(const String &test_name, const Ref<Image> &img, const String &expected_v2_str, const String &expected_v2_pcfg_str, bool compress_lossless = true) {
692 SUBCASE(vformat("%s write v2", test_name).utf8().get_data()) {

Callers 1

test_image_variantFunction · 0.85

Calls 4

compare_imagesFunction · 0.85
expect_image_write_matchFunction · 0.85
resizeMethod · 0.45
is_validMethod · 0.45

Tested by

no test coverage detected