Flutter Engine
The Flutter Engine
Functions
SkJpegXmpTest.cpp File Reference
#include "include/core/SkData.h"
#include "include/private/SkGainmapInfo.h"
#include "src/codec/SkJpegXmp.h"
#include "src/core/SkMD5.h"
#include "tests/Test.h"
#include <iomanip>
#include <iostream>
#include <regex>
#include <sstream>

Go to the source code of this file.

Functions

 DEF_TEST (SkJpegXmp_standardXmp, r)
 
 DEF_TEST (SkJpegXmp_defaultValues, r)
 
static std::string uint32_to_string (uint32_t v)
 
static std::string standard_xmp_with_header (const SkMD5::Digest &digest, const std::string &data)
 
static std::string extended_xmp_with_header (const SkMD5::Digest &digest, uint32_t size, uint32_t offset, const std::string &data)
 
 DEF_TEST (SkJpegXmp_readExtendedXmp, r)
 

Function Documentation

◆ DEF_TEST() [1/3]

DEF_TEST ( SkJpegXmp_defaultValues  ,
 
)

Definition at line 36 of file SkJpegXmpTest.cpp.

46 {
47 const char xmpData[] =
48 "http://ns.adobe.com/xap/1.0/\0"
49 R"(
50 <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
51 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
52 xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/">
53 <rdf:Description rdf:about="" hdrgm:Version="1.0">
54 </rdf:Description>
55 </rdf:RDF>
56 </x:xmpmeta>)";
57
58 std::vector<sk_sp<SkData>> app1Params;
59 app1Params.push_back(SkData::MakeWithoutCopy(xmpData, sizeof(xmpData) - 1));
60
61 auto xmp = SkJpegMakeXmp(app1Params);
62 REPORTER_ASSERT(r, xmp);
63
65 REPORTER_ASSERT(r, xmp->getGainmapInfoHDRGM(&info));
66 REPORTER_ASSERT(r, info.fGainmapRatioMin.fR == 1.f);
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
std::unique_ptr< SkXmp > SkJpegMakeXmp(const std::vector< sk_sp< SkData > > &decoderApp1Params)
Definition: SkJpegXmp.cpp:181
#define REPORTER_ASSERT(r, cond,...)
Definition: Test.h:286
static sk_sp< SkData > MakeWithoutCopy(const void *data, size_t length)
Definition: SkData.h:116

◆ DEF_TEST() [2/3]

DEF_TEST ( SkJpegXmp_readExtendedXmp  ,
 
)

Definition at line 90 of file SkJpegXmpTest.cpp.

◆ DEF_TEST() [3/3]

DEF_TEST ( SkJpegXmp_standardXmp  ,
 
)

Definition at line 19 of file SkJpegXmpTest.cpp.

19 {
20 const char xmpData[] =
21 "http://ns.adobe.com/xap/1.0/\0"
22 R"(
23 <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 6.0.0">
24 <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
25 xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/">
26 <rdf:Description rdf:about="">
27 <hdrgm:Version>1.0</hdrgm:Version>
28 <hdrgm:GainMapMax>3</hdrgm:GainMapMax>
29 <hdrgm:HDRCapacityMax>4</hdrgm:HDRCapacityMax>
30 </rdf:Description>
31 </rdf:RDF>
32 </x:xmpmeta>)";
33
34 std::vector<sk_sp<SkData>> app1Params;

◆ extended_xmp_with_header()

static std::string extended_xmp_with_header ( const SkMD5::Digest digest,
uint32_t  size,
uint32_t  offset,
const std::string &  data 
)
static

Definition at line 82 of file SkJpegXmpTest.cpp.

85 {
86 const char c[4] = {static_cast<char>((v >> 24) & 0xff),
87 static_cast<char>((v >> 16) & 0xff),
88 static_cast<char>((v >> 8) & 0xff),

◆ standard_xmp_with_header()

static std::string standard_xmp_with_header ( const SkMD5::Digest digest,
const std::string &  data 
)
static

Definition at line 76 of file SkJpegXmpTest.cpp.

◆ uint32_to_string()

static std::string uint32_to_string ( uint32_t  v)
static

Definition at line 68 of file SkJpegXmpTest.cpp.