19 auto stream = pdfium::MakeRetain<CFX_MemoryStream>();
20 for (
FX_FILESIZE offset = 0; offset <= 200000; offset += 100000) {
21 stream->WriteBlockAtOffset(
22 {
reinterpret_cast<
const uint8_t*>(kSomeText), kSomeTextLen}, offset);
24 EXPECT_EQ(200000 + kSomeTextLen,
static_cast<size_t>(stream->GetSize()));
28 auto stream = pdfium::MakeRetain<CFX_MemoryStream>();
29 for (
FX_FILESIZE offset = 0; offset <= 100; ++offset) {
30 stream->WriteBlockAtOffset(
31 {
reinterpret_cast<
const uint8_t*>(kSomeText), kSomeTextLen}, offset);
33 EXPECT_EQ(100 + kSomeTextLen,
static_cast<size_t>(stream->GetSize()));
37 auto stream = pdfium::MakeRetain<CFX_MemoryStream>();
38 const uint8_t kData1[] = {
'a',
'b',
'c'};
39 ASSERT_TRUE(stream->WriteBlock(kData1));
40 ASSERT_THAT(stream->GetSpan(), testing::ElementsAre(
'a',
'b',
'c'));
42 ASSERT_TRUE(stream->WriteBlockAtOffset(kData1, 5));
43 ASSERT_THAT(stream->GetSpan(),
44 testing::ElementsAre(
'a',
'b',
'c',
'\0',
'\0',
'a',
'b',
'c'));
47 ASSERT_TRUE(stream->ReadBlockAtOffset(buffer, 2));
48 ASSERT_THAT(buffer, testing::ElementsAre(
'c',
'\0',
'\0',
'a'));
52 auto stream = pdfium::MakeRetain<CFX_MemoryStream>();
53 const uint8_t kData1[] = {
'a',
'b',
'c'};
54 ASSERT_TRUE(stream->WriteBlock(kData1));
55 ASSERT_THAT(stream->GetSpan(), testing::ElementsAre(
'a',
'b',
'c'));
57 ASSERT_TRUE(stream->WriteBlock({}));
58 ASSERT_THAT(stream->GetSpan(), testing::ElementsAre(
'a',
'b',
'c'));