summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_dest_unittest.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-16 12:26:06 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-16 12:26:06 -0800
commit8a3aa459fc5284f51bcd7e98e95bf6214f47bb67 (patch)
tree13fb383936d679aded19054f4e7a0387dd52de76 /core/fpdfdoc/cpdf_dest_unittest.cpp
parent14a60c50b10de1d9e4edd3629ea210a816940a75 (diff)
downloadpdfium-8a3aa459fc5284f51bcd7e98e95bf6214f47bb67.tar.xz
Make CPDF_Array take unique_ptrs
BUG= Review-Url: https://codereview.chromium.org/2498223005
Diffstat (limited to 'core/fpdfdoc/cpdf_dest_unittest.cpp')
-rw-r--r--core/fpdfdoc/cpdf_dest_unittest.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/core/fpdfdoc/cpdf_dest_unittest.cpp b/core/fpdfdoc/cpdf_dest_unittest.cpp
index d427ab66a0..bc83ecacfc 100644
--- a/core/fpdfdoc/cpdf_dest_unittest.cpp
+++ b/core/fpdfdoc/cpdf_dest_unittest.cpp
@@ -4,6 +4,7 @@
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_null.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfdoc/cpdf_dest.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,16 +23,16 @@ TEST(cpdf_dest, GetXYZ) {
EXPECT_FALSE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
auto array = pdfium::MakeUnique<CPDF_Array>();
- array->AddInteger(0); // Page Index.
- array->AddName("XYZ");
- array->AddNumber(4); // X
+ array->AddNew<CPDF_Number>(0); // Page Index.
+ array->AddNew<CPDF_Name>("XYZ");
+ array->AddNew<CPDF_Number>(4); // X
// Not enough entries.
dest = pdfium::MakeUnique<CPDF_Dest>(array.get());
EXPECT_FALSE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
- array->AddNumber(5); // Y
- array->AddNumber(6); // Zoom.
+ array->AddNew<CPDF_Number>(5); // Y
+ array->AddNew<CPDF_Number>(6); // Zoom.
dest = pdfium::MakeUnique<CPDF_Dest>(array.get());
EXPECT_TRUE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
@@ -43,15 +44,15 @@ TEST(cpdf_dest, GetXYZ) {
EXPECT_EQ(6, zoom);
// Set zoom to 0.
- array->SetAt(4, new CPDF_Number(0));
+ array->SetNewAt<CPDF_Number>(4, 0);
dest = pdfium::MakeUnique<CPDF_Dest>(array.get());
EXPECT_TRUE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
EXPECT_FALSE(hasZoom);
// Set values to null.
- array->SetAt(2, new CPDF_Null);
- array->SetAt(3, new CPDF_Null);
- array->SetAt(4, new CPDF_Null);
+ array->SetNewAt<CPDF_Null>(2);
+ array->SetNewAt<CPDF_Null>(3);
+ array->SetNewAt<CPDF_Null>(4);
dest = pdfium::MakeUnique<CPDF_Dest>(array.get());
EXPECT_TRUE(dest->GetXYZ(&hasX, &hasY, &hasZoom, &x, &y, &zoom));
EXPECT_FALSE(hasX);