Debian Codegraph @

podofo/test/unit/DeviceTest.cpp

raw symbols SCIP
1 /**
2 * Copyright (C) 2016 by Dominik Seichter <[email protected]>
3 * Copyright (C) 2021 by Francesco Pretto <[email protected]>
4 *
5 * Licensed under GNU Library General Public 2.0 or later.
6 * Some rights reserved. See COPYING, AUTHORS.
7 */
8
9 #include <PdfTest.h>
10
11 using namespace std;
12 using namespace PoDoFo;
13
14 TEST_CASE("testDevices")
15 {
16 string_view testString = "Hello World Buffer!";
17 charbuff buffer1;
18
19 // large appends
20 StringStreamDevice streamLarge(buffer1);
21 for (unsigned i = 0; i < 100; i++)
22 streamLarge.Write(testString);
23
24 if (buffer1.size() != testString.size() * 100)
25 FAIL(utls::Format("Buffer1 size is wrong after 100 attaches: {}", buffer1.size()));
26 }
27
28 TEST_CASE("testSaveIncremental")
29 {
30 PdfMemDocument doc;
31 auto testPath = TestUtils::GetTestOutputFilePath("testSaveIncremental.pdf");
32 doc.GetPages().CreatePage(PdfPage::CreateStandardPageSize(PdfPageSize::A4));
33 doc.Save(testPath);
34 doc.Load(testPath);
35 doc.SaveUpdate(testPath);
36 doc.Load(testPath);
37 }