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_stream_acc_unittest.cpp
Go to the documentation of this file.
1
// Copyright 2018 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/parser/cpdf_stream_acc.h"
6
7
#
include
<
algorithm
>
8
#
include
<
utility
>
9
10
#
include
"core/fpdfapi/parser/cpdf_dictionary.h"
11
#
include
"core/fpdfapi/parser/cpdf_stream.h"
12
#
include
"core/fxcrt/fx_stream.h"
13
#
include
"testing/gtest/include/gtest/gtest.h"
14
#
include
"testing/invalid_seekable_read_stream.h"
15
16
TEST
(
StreamAccTest
,
ReadRawDataFailed
) {
17
auto
stream =
pdfium
::MakeRetain<CPDF_Stream>(
18
pdfium
::MakeRetain<InvalidSeekableReadStream>(1024),
19
pdfium
::MakeRetain<
CPDF_Dictionary
>());
20
auto
stream_acc =
pdfium
::MakeRetain<CPDF_StreamAcc>(
std
::move(stream));
21
stream_acc->LoadAllDataRaw();
22
EXPECT_TRUE(stream_acc->GetSpan().empty());
23
}
24
25
// Regression test for crbug.com/1361849. Should not trigger dangling pointer
26
// failure with UnownedPtr.
27
TEST
(
StreamAccTest
,
DataStreamLifeTime
) {
28
constexpr
uint8_t kData[] = {
'a'
,
'b'
,
'c'
};
29
auto
stream =
pdfium
::MakeRetain<CPDF_Stream>(kData);
30
auto
stream_acc =
pdfium
::MakeRetain<CPDF_StreamAcc>(stream);
31
stream_acc->LoadAllDataRaw();
32
stream.Reset();
33
auto
span = stream_acc->GetSpan();
34
EXPECT_TRUE(
35
std
::equal(
std
::begin(kData),
std
::end(kData), span.begin(), span.end()));
36
}
CPDF_Dictionary::DictMap
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
Definition
cpdf_dictionary.h:31
pdfium::CFDETextOutLargeBitmapTest
Definition
cfde_textout_unittest.cpp:117
TEST
TEST(FXCRYPT, MD5GenerateEmtpyData)
Definition
fx_crypt_unittest.cpp:50
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
parser
cpdf_stream_acc_unittest.cpp
Generated on
for Qt by
1.18.0