summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdftext_embeddertest.cpp
blob: 3198fe0f86b66565887a49844c803c5a6f35f6eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Copyright 2015 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "../../testing/embedder_test.h"
#include "../../fpdfsdk/include/fpdfview.h"
#include "../../fpdfsdk/include/fpdftext.h"
#include "testing/gtest/include/gtest/gtest.h"

class FPDFTextEmbeddertest : public EmbedderTest {
};

// Test that the page has characters despite a bad stream length.
TEST_F(FPDFTextEmbeddertest, StreamLengthPastEndOfFile) {
  EXPECT_TRUE(OpenDocument("testing/resources/bug_57.pdf"));
  FPDF_FORMHANDLE form_handle = SetFormFillEnvironment();
  FPDF_PAGE page = LoadPage(0, form_handle);
  EXPECT_NE(nullptr, page);
  FPDF_TEXTPAGE textpage = FPDFText_LoadPage(page);
  EXPECT_NE(nullptr, textpage);
  EXPECT_EQ(13, FPDFText_CountChars(textpage));
  ClearFormFillEnvironment(form_handle);
}