blob: e032b99a4e0e1df19e369dd97155000d686943c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright (c) the JPEG XL Project Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include "lib/extras/codec.h"
#include "lib/jxl/image_test_utils.h"
#include "lib/jxl/test_utils.h"
#include "lib/jxl/testdata.h"
namespace jxl {
namespace {
using ::testing::SizeIs;
TEST(BlendingTest, Crops) {
ThreadPool* pool = nullptr;
const PaddedBytes compressed =
ReadTestData("jxl/blending/cropped_traffic_light.jxl");
CodecInOut decoded;
ASSERT_TRUE(test::DecodeFile({}, compressed, &decoded, pool));
ASSERT_THAT(decoded.frames, SizeIs(4));
int i = 0;
for (const ImageBundle& ib : decoded.frames) {
std::ostringstream filename;
filename << "jxl/blending/cropped_traffic_light_frame-" << i << ".png";
const PaddedBytes compressed_frame = ReadTestData(filename.str());
CodecInOut frame;
ASSERT_TRUE(SetFromBytes(Span<const uint8_t>(compressed_frame), &frame));
EXPECT_TRUE(SamePixels(ib.color(), *frame.Main().color()));
++i;
}
}
} // namespace
} // namespace jxl
|