chromium/pdf/pdfium/pdfium_page_unittest.cc

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#if defined(UNSAFE_BUFFERS_BUILD)
// TODO(crbug.com/40284755): Remove this and spanify to fix the errors.
#pragma allow_unsafe_buffers
#endif

#include "pdf/pdfium/pdfium_page.h"

#include <optional>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/files/file_path.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/test_discardable_memory_allocator.h"
#include "build/build_config.h"
#include "pdf/accessibility_structs.h"
#include "pdf/pdfium/pdfium_engine.h"
#include "pdf/pdfium/pdfium_test_base.h"
#include "pdf/test/test_client.h"
#include "pdf/test/test_helpers.h"
#include "pdf/ui/thumbnail.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/pdfium/public/fpdf_formfill.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkImageInfo.h"
#include "third_party/skia/include/core/SkPixmap.h"
#include "third_party/skia/include/core/SkRefCnt.h"
#include "ui/accessibility/accessibility_features.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size_f.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/gfx/geometry/test/geometry_util.h"
#include "ui/gfx/range/range.h"

namespace chrome_pdf {

namespace {

TEST(PDFiumPageHelperTest, ToPDFiumRotation) {}

TEST(PDFiumPageHelperTest, ScopedUnloadPreventer) {}

void CompareTextRuns(const AccessibilityTextRunInfo& expected_text_run,
                     const AccessibilityTextRunInfo& actual_text_run) {}

template <typename T>
void PopulateTextObjects(const std::vector<gfx::Range>& ranges,
                         std::vector<T>* text_objects) {}

// Returns the page size for a `PDFiumPage`. The caller must make sure that
// `pdfium_page` is available.
gfx::SizeF GetPageSizeHelper(PDFiumPage& pdfium_page) {}

base::FilePath GetThumbnailTestData(const std::string& expectation_file_prefix,
                                    size_t page_index,
                                    float device_pixel_ratio,
                                    bool use_skia) {}

}  // namespace

PDFiumPageTest;

TEST_P(PDFiumPageTest, Constructor) {}

TEST_P(PDFiumPageTest, IsCharInPageBounds) {}

TEST_P(PDFiumPageTest, GetBoundingBoxRotatedMultipage) {}

TEST_P(PDFiumPageTest, GetBoundingBoxAnnotations) {}

TEST_P(PDFiumPageTest, GetBoundingBoxBlankPage) {}

TEST_P(PDFiumPageTest, GetBoundingBoxCropped) {}

TEST_P(PDFiumPageTest, GetBoundingBoxRotatedMultipageCropped) {}

INSTANTIATE_TEST_SUITE_P();

class PDFiumPageLinkTest : public PDFiumTestBase {};

TEST_P(PDFiumPageLinkTest, LinkGeneration) {}

TEST_P(PDFiumPageLinkTest, AnnotLinkGeneration) {}

TEST_P(PDFiumPageLinkTest, GetLinkTarget) {}

// Regression test for crbug.com/1396248
TEST_P(PDFiumPageLinkTest, GetUTF8LinkTarget) {}

INSTANTIATE_TEST_SUITE_P();

PDFiumPageImageTest;

TEST_P(PDFiumPageImageTest, CalculateImages) {}

TEST_P(PDFiumPageImageTest, ImageAltText) {}

INSTANTIATE_TEST_SUITE_P();

class PDFiumPageImageForOcrTest : public PDFiumPageImageTest {};

TEST_P(PDFiumPageImageForOcrTest, LowResolutionImage) {}

TEST_P(PDFiumPageImageForOcrTest, HighResolutionImage) {}

TEST_P(PDFiumPageImageForOcrTest, RotatedPage) {}

TEST_P(PDFiumPageImageForOcrTest, NonImage) {}

INSTANTIATE_TEST_SUITE_P();

PDFiumPageTextTest;

TEST_P(PDFiumPageTextTest, TextRunBounds) {}

TEST_P(PDFiumPageTextTest, GetTextRunInfo) {}

TEST_P(PDFiumPageTextTest, HighlightTextRunInfo) {}

INSTANTIATE_TEST_SUITE_P();

PDFiumPageHighlightTest;

TEST_P(PDFiumPageHighlightTest, PopulateHighlights) {}

INSTANTIATE_TEST_SUITE_P();

PDFiumPageTextFieldTest;

TEST_P(PDFiumPageTextFieldTest, PopulateTextFields) {}

INSTANTIATE_TEST_SUITE_P();

PDFiumPageChoiceFieldTest;

TEST_P(PDFiumPageChoiceFieldTest, PopulateChoiceFields) {}

INSTANTIATE_TEST_SUITE_P();

PDFiumPageButtonTest;

TEST_P(PDFiumPageButtonTest, PopulateButtons) {}

INSTANTIATE_TEST_SUITE_P();

class PDFiumPageThumbnailTest : public PDFiumTestBase {};

TEST_P(PDFiumPageThumbnailTest, GenerateThumbnail) {}

// For crbug.com/1248455
TEST_P(PDFiumPageThumbnailTest, GenerateThumbnailForAnnotation) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace chrome_pdf