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
cfx_defaultrenderdevice_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2023 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/fxge/cfx_defaultrenderdevice.h"
6
7
#
include
"core/fxcrt/fx_coordinates.h"
8
#
include
"core/fxcrt/retain_ptr.h"
9
#
include
"core/fxge/cfx_fillrenderoptions.h"
10
#
include
"core/fxge/cfx_graphstatedata.h"
11
#
include
"core/fxge/cfx_path.h"
12
#
include
"core/fxge/dib/cfx_dibitmap.h"
13
#
include
"core/fxge/dib/fx_dib.h"
14
#
include
"testing/gtest/include/gtest/gtest.h"
15
16
TEST
(
CFX_DefaultRenderDeviceTest
,
GetClipBox_Default
) {
17
CFX_DefaultRenderDevice device;
18
ASSERT_TRUE(device
.
Create
(
/*width=*/
16
,
/*height=*/
16
,
FXDIB_Format
::
kBgra
)
);
19
20
EXPECT_EQ(
FX_RECT
(
0
,
0
,
16
,
16
)
, device
.
GetClipBox
());
21
}
22
23
TEST
(
CFX_DefaultRenderDeviceTest
,
GetClipBox_PathFill
) {
24
// Matrix that transposes and translates by 1 unit on each axis.
25
const
CFX_Matrix
object_to_device
(
0
,
1
,
1
,
0
,
1
,
-1
)
;
26
27
// Fill type cannot be none.
28
const
CFX_FillRenderOptions
fill_options
(
29
CFX_FillRenderOptions
::
FillType
::
kEvenOdd
)
;
30
31
CFX_DefaultRenderDevice device;
32
ASSERT_TRUE(device
.
Create
(
/*width=*/
16
,
/*height=*/
16
,
FXDIB_Format
::
kBgra
)
);
33
34
CFX_Path
path;
35
path
.
AppendRect
(
2
,
4
,
14
,
12
)
;
36
EXPECT_TRUE(device
.
SetClip_PathFill
(path, &object_to_device, fill_options));
37
38
EXPECT_EQ(
FX_RECT
(
5
,
1
,
13
,
13
)
, device
.
GetClipBox
());
39
}
40
41
TEST
(
CFX_DefaultRenderDeviceTest
,
GetClipBox_PathStroke
) {
42
// Matrix that transposes and translates by 1 unit on each axis.
43
const
CFX_Matrix
object_to_device
(
0
,
1
,
1
,
0
,
1
,
-1
)
;
44
45
// Default line width is 1.
46
const
CFX_GraphStateData
graphics_state;
47
48
CFX_DefaultRenderDevice device;
49
ASSERT_TRUE(device
.
Create
(
/*width=*/
16
,
/*height=*/
16
,
FXDIB_Format
::
kBgra
)
);
50
51
CFX_Path
path;
52
path
.
AppendRect
(
2
,
4
,
14
,
12
)
;
53
EXPECT_TRUE(
54
device
.
SetClip_PathStroke
(path, &object_to_device, &graphics_state));
55
56
EXPECT_EQ(
FX_RECT
(
4
,
0
,
14
,
14
)
, device
.
GetClipBox
());
57
}
58
59
TEST
(
CFX_DefaultRenderDeviceTest
,
GetClipBox_Rect
) {
60
CFX_DefaultRenderDevice device;
61
ASSERT_TRUE(device
.
Create
(
/*width=*/
16
,
/*height=*/
16
,
FXDIB_Format
::
kBgra
)
);
62
63
EXPECT_TRUE(device
.
SetClip_Rect
({2, 4, 14, 12}));
64
65
EXPECT_EQ(
FX_RECT
(
2
,
4
,
14
,
12
)
, device
.
GetClipBox
());
66
}
67
68
TEST
(
CFX_DefaultRenderDeviceTest
,
GetClipBox_Empty
) {
69
CFX_DefaultRenderDevice device;
70
ASSERT_TRUE(device
.
Create
(
/*width=*/
16
,
/*height=*/
16
,
FXDIB_Format
::
kBgra
)
);
71
72
EXPECT_TRUE(device
.
SetClip_Rect
({2, 8, 14, 8}));
73
74
EXPECT_TRUE(device
.
GetClipBox
().IsEmpty());
75
}
CFX_DefaultRenderDevice::Create
bool Create(int width, int height, FXDIB_Format format)
Definition
cfx_defaultrenderdevice.cpp:80
CFX_GraphStateData
Definition
cfx_graphstatedata.h:16
CFX_Matrix
Definition
fx_coordinates.h:440
CFX_Matrix::CFX_Matrix
constexpr CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
Definition
fx_coordinates.h:444
CFX_Path
Definition
cfx_path.h:18
CFX_Path::AppendRect
void AppendRect(float left, float bottom, float right, float top)
Definition
cfx_path.cpp:310
CFX_RenderDevice::SetClip_Rect
bool SetClip_Rect(const FX_RECT &pRect)
Definition
cfx_renderdevice.cpp:584
CFX_RenderDevice::SetClip_PathFill
bool SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options)
Definition
cfx_renderdevice.cpp:562
CFX_RenderDevice::SetClip_PathStroke
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState)
Definition
cfx_renderdevice.cpp:573
CFX_RenderDevice::GetClipBox
const FX_RECT & GetClipBox() const
Definition
cfx_renderdevice.h:70
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:50
FXDIB_Format
FXDIB_Format
Definition
fx_dib.h:21
FXDIB_Format::kBgra
@ kBgra
Definition
fx_dib.h:29
CFX_FillRenderOptions
Definition
cfx_fillrenderoptions.h:11
CFX_FillRenderOptions::CFX_FillRenderOptions
constexpr CFX_FillRenderOptions(FillType fill_type)
Definition
cfx_fillrenderoptions.h:38
CFX_FillRenderOptions::FillType
FillType
Definition
cfx_fillrenderoptions.h:13
CFX_FillRenderOptions::FillType::kEvenOdd
@ kEvenOdd
Definition
cfx_fillrenderoptions.h:19
FX_RECT
Definition
fx_coordinates.h:144
FX_RECT::FX_RECT
constexpr FX_RECT(int l, int t, int r, int b)
Definition
fx_coordinates.h:146
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxge
cfx_defaultrenderdevice_unittest.cpp
Generated on
for Qt by
1.18.0