Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1196)

Unified Diff: core/fpdfdoc/cpdf_dest_unittest.cpp

Issue 2498223005: Make CPDF_Array take unique_ptrs (Closed)
Patch Set: nits Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_syntax_parser.cpp ('k') | core/fpdfdoc/cpdf_formfield.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_dest_unittest.cpp
diff --git a/core/fpdfdoc/cpdf_dest_unittest.cpp b/core/fpdfdoc/cpdf_dest_unittest.cpp
index d427ab66a0de7be14f958dd4e0e759e4d29f67f4..bc83ecacfc6a369082e54ac2a6478403c6f992d9 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);
« no previous file with comments | « core/fpdfapi/parser/cpdf_syntax_parser.cpp ('k') | core/fpdfdoc/cpdf_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698