aboutsummaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_dest_unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_dest_unittest.cpp')
-rw-r--r--core/fpdfdoc/cpdf_dest_unittest.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/core/fpdfdoc/cpdf_dest_unittest.cpp b/core/fpdfdoc/cpdf_dest_unittest.cpp
index 07e46b334..ae2d9796f 100644
--- a/core/fpdfdoc/cpdf_dest_unittest.cpp
+++ b/core/fpdfdoc/cpdf_dest_unittest.cpp
@@ -1,15 +1,16 @@
-// Copyright 2016 PDFium Authors. All rights reserved.
+// Copyright 2016 The PDFium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "core/fpdfdoc/cpdf_dest.h"
+#include <memory>
+
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_null.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/base/ptr_util.h"
TEST(cpdf_dest, GetXYZ) {
bool hasX;
@@ -21,23 +22,23 @@ TEST(cpdf_dest, GetXYZ) {
// |array| must outlive |dest|.
auto array = pdfium::MakeRetain<CPDF_Array>();
- array->AddNew<CPDF_Number>(0); // Page Index.
- array->AddNew<CPDF_Name>("XYZ");
- array->AddNew<CPDF_Number>(4); // X
+ array->AppendNew<CPDF_Number>(0); // Page Index.
+ array->AppendNew<CPDF_Name>("XYZ");
+ array->AppendNew<CPDF_Number>(4); // X
{
- auto dest = pdfium::MakeUnique<CPDF_Dest>();
- EXPECT_FALSE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
+ CPDF_Dest dest(nullptr);
+ EXPECT_FALSE(dest.GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
}
{
// Not enough entries.
- auto dest = pdfium::MakeUnique<CPDF_Dest>(array.Get());
- EXPECT_FALSE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
+ CPDF_Dest dest(array);
+ EXPECT_FALSE(dest.GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
}
- array->AddNew<CPDF_Number>(5); // Y
- array->AddNew<CPDF_Number>(6); // Zoom.
+ array->AppendNew<CPDF_Number>(5); // Y
+ array->AppendNew<CPDF_Number>(6); // Zoom.
{
- auto dest = pdfium::MakeUnique<CPDF_Dest>(array.Get());
- EXPECT_TRUE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
+ CPDF_Dest dest(array);
+ EXPECT_TRUE(dest.GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
EXPECT_TRUE(hasX);
EXPECT_TRUE(hasY);
EXPECT_TRUE(hasZoom);
@@ -48,8 +49,8 @@ TEST(cpdf_dest, GetXYZ) {
// Set zoom to 0.
array->SetNewAt<CPDF_Number>(4, 0);
{
- auto dest = pdfium::MakeUnique<CPDF_Dest>(array.Get());
- EXPECT_TRUE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
+ CPDF_Dest dest(array);
+ EXPECT_TRUE(dest.GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
EXPECT_FALSE(hasZoom);
}
// Set values to null.
@@ -57,8 +58,8 @@ TEST(cpdf_dest, GetXYZ) {
array->SetNewAt<CPDF_Null>(3);
array->SetNewAt<CPDF_Null>(4);
{
- auto dest = pdfium::MakeUnique<CPDF_Dest>(array.Get());
- EXPECT_TRUE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
+ CPDF_Dest dest(array);
+ EXPECT_TRUE(dest.GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
EXPECT_FALSE(hasX);
EXPECT_FALSE(hasY);
EXPECT_FALSE(hasZoom);