Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpdf_colorspace_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2021 The PDFium Authors
2
// Use of this source code is governed by a BSD-style license that can be
3
// found in the LICENSE file.
4
5
#
include
"core/fpdfapi/page/cpdf_colorspace.h"
6
7
#
include
<
stddef
.
h
>
8
#
include
<
stdint
.
h
>
9
10
#
include
"core/fxcrt/retain_ptr.h"
11
#
include
"core/fxcrt/stl_util.h"
12
#
include
"testing/gmock/include/gmock/gmock.h"
13
#
include
"testing/gtest/include/gtest/gtest.h"
14
15
using
::testing::ElementsAre;
16
17
TEST
(
CPDF_CalGray
,
TranslateImageLine
) {
18
RetainPtr
<
CPDF_ColorSpace
> pCal = CPDF_ColorSpace::AllocateColorSpace(
"CalG"
);
19
ASSERT_TRUE(pCal);
20
21
const
uint8_t kSrc[12] = {255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128};
22
uint8_t dst[12];
23
fxcrt
::Fill(dst, 0xbd);
24
// `bTransMask` only applies to CYMK colorspaces.
25
pCal->TranslateImageLine(dst, kSrc, 4, 4, 1,
/*bTransMask=*/
false
);
26
EXPECT_THAT(dst, ElementsAre(255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0));
27
}
28
29
TEST
(
CPDF_CalRGB
,
TranslateImageLine
) {
30
RetainPtr
<
CPDF_ColorSpace
> pCal = CPDF_ColorSpace::AllocateColorSpace(
"CalR"
);
31
ASSERT_TRUE(pCal);
32
33
const
uint8_t kSrc[12] = {255, 0, 0, 0, 255, 0, 0, 0, 255, 128, 128, 128};
34
uint8_t dst[12];
35
fxcrt
::Fill(dst, 0xbd);
36
// `bTransMask` only applies to CYMK colorspaces.
37
pCal->TranslateImageLine(dst, kSrc, 4, 4, 1,
/*bTransMask=*/
false
);
38
EXPECT_THAT(dst, ElementsAre(0, 0, 255, 0, 255, 0, 255, 0, 0, 128, 128, 128));
39
}
CPDF_ColorSpace
Definition
cpdf_colorspace.h:53
fxcrt::RetainPtr
Definition
retain_ptr.h:28
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:50
fxcrt
Definition
stl_util.h:17
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
page
cpdf_colorspace_unittest.cpp
Generated on
for Qt by
1.18.0