libjxl

FORK: libjxl patches used on blog
git clone https://git.neptards.moe/blog/libjxl.git
Log | Files | Refs | Submodules | README | LICENSE

color_description_test.cc (1217B)


      1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 //
      3 // Use of this source code is governed by a BSD-style
      4 // license that can be found in the LICENSE file.
      5 
      6 #include "lib/extras/dec/color_description.h"
      7 
      8 #include "lib/jxl/color_encoding_internal.h"
      9 #include "lib/jxl/test_utils.h"
     10 #include "lib/jxl/testing.h"
     11 
     12 namespace jxl {
     13 
     14 // Verify ParseDescription(Description) yields the same ColorEncoding
     15 TEST(ColorDescriptionTest, RoundTripAll) {
     16   for (const auto& cdesc : test::AllEncodings()) {
     17     const ColorEncoding c_original = test::ColorEncodingFromDescriptor(cdesc);
     18     const std::string description = Description(c_original);
     19     printf("%s\n", description.c_str());
     20 
     21     JxlColorEncoding c_external = {};
     22     EXPECT_TRUE(ParseDescription(description, &c_external));
     23     ColorEncoding c_internal;
     24     EXPECT_TRUE(c_internal.FromExternal(c_external));
     25     EXPECT_TRUE(c_original.SameColorEncoding(c_internal))
     26         << "Where c_original=" << c_original
     27         << " and c_internal=" << c_internal;
     28   }
     29 }
     30 
     31 TEST(ColorDescriptionTest, NanGamma) {
     32   const std::string description = "Gra_2_Per_gnan";
     33   JxlColorEncoding c;
     34   EXPECT_FALSE(ParseDescription(description, &c));
     35 }
     36 
     37 }  // namespace jxl