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_seekablestreamproxy_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2019 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/fxcrt/cfx_seekablestreamproxy.h"
6
7
#
include
<
iterator
>
8
9
#
include
"core/fxcrt/cfx_read_only_span_stream.h"
10
#
include
"core/fxcrt/retain_ptr.h"
11
#
include
"core/fxcrt/span.h"
12
#
include
"testing/gtest/include/gtest/gtest.h"
13
14
TEST
(
SeekableStreamProxyTest
,
NullStream
) {
15
auto
proxy_stream =
pdfium
::MakeRetain<CFX_SeekableStreamProxy>(
16
pdfium
::MakeRetain<CFX_ReadOnlySpanStream>(
17
pdfium::span<
const
uint8_t>()));
18
19
wchar_t
buffer[16];
20
EXPECT_EQ(0u, proxy_stream->ReadBlock(buffer));
21
}
22
23
TEST
(
SeekableStreamProxyTest
,
DefaultStreamBOMNotRecognized
) {
24
ByteStringView
data =
"abcd"
;
25
auto
proxy_stream =
pdfium
::MakeRetain<CFX_SeekableStreamProxy>(
26
pdfium
::MakeRetain<CFX_ReadOnlySpanStream>(data.unsigned_span()));
27
28
wchar_t
buffer[16];
29
EXPECT_EQ(0u, proxy_stream->ReadBlock(buffer));
30
}
31
32
TEST
(
SeekableStreamProxyTest
,
UTF8Stream
) {
33
ByteStringView
data =
"\xEF\xBB\xBF*\xC2\xA2*"
;
34
auto
proxy_stream =
pdfium
::MakeRetain<CFX_SeekableStreamProxy>(
35
pdfium
::MakeRetain<CFX_ReadOnlySpanStream>(data.unsigned_span()));
36
37
wchar_t
buffer[16];
38
EXPECT_EQ(3u, proxy_stream->ReadBlock(buffer));
39
EXPECT_EQ(L'*', buffer[0]);
40
EXPECT_EQ(L'\u00A2', buffer[1]);
41
EXPECT_EQ(L'*', buffer[2]);
42
}
43
44
TEST
(
SeekableStreamProxyTest
,
UTF16LEStream
) {
45
// Test embedded NUL not ending in NUL.
46
const
uint8_t data[] = {0xFF, 0xFE, 0x41, 0x00, 0x42, 0x01};
47
auto
proxy_stream =
pdfium
::MakeRetain<CFX_SeekableStreamProxy>(
48
pdfium
::MakeRetain<CFX_ReadOnlySpanStream>(data));
49
50
wchar_t
buffer[16];
51
EXPECT_EQ(2u, proxy_stream->ReadBlock(buffer));
52
EXPECT_EQ(L'A', buffer[0]);
53
EXPECT_EQ(L'\u0142', buffer[1]);
54
}
55
56
TEST
(
SeekableStreamProxyTest
,
UTF16BEStream
) {
57
const
uint8_t data[] = {0xFE, 0xFF, 0x00, 0x41, 0x01, 0x42};
58
auto
proxy_stream =
pdfium
::MakeRetain<CFX_SeekableStreamProxy>(
59
pdfium
::MakeRetain<CFX_ReadOnlySpanStream>(data));
60
61
wchar_t
buffer[16];
62
EXPECT_EQ(2u, proxy_stream->ReadBlock(buffer));
63
EXPECT_EQ(L'A', buffer[0]);
64
EXPECT_EQ(L'\u0142', buffer[1]);
65
}
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:50
ByteStringView
fxcrt::ByteStringView ByteStringView
Definition
string_view_template.h:325
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fxcrt
cfx_seekablestreamproxy_unittest.cpp
Generated on
for Qt by
1.18.0