summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_formfield_unittest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/cpdf_formfield_unittest.cpp')
-rw-r--r--core/fpdfdoc/cpdf_formfield_unittest.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpdf_formfield_unittest.cpp b/core/fpdfdoc/cpdf_formfield_unittest.cpp
index 11cccf19b8..f69df1d064 100644
--- a/core/fpdfdoc/cpdf_formfield_unittest.cpp
+++ b/core/fpdfdoc/cpdf_formfield_unittest.cpp
@@ -12,15 +12,13 @@ TEST(cpdf_formfield, FPDF_GetFullName) {
EXPECT_TRUE(name.IsEmpty());
CPDF_IndirectObjectHolder obj_holder;
- CPDF_Dictionary* root = new CPDF_Dictionary();
- obj_holder.AddIndirectObject(root);
+ CPDF_Dictionary* root = obj_holder.NewIndirect<CPDF_Dictionary>();
root->SetNameFor("T", "foo");
name = FPDF_GetFullName(root);
EXPECT_STREQ("foo", name.UTF8Encode().c_str());
- CPDF_Dictionary* dict1 = new CPDF_Dictionary();
- root->SetReferenceFor("Parent", &obj_holder,
- obj_holder.AddIndirectObject(dict1));
+ CPDF_Dictionary* dict1 = obj_holder.NewIndirect<CPDF_Dictionary>();
+ root->SetReferenceFor("Parent", &obj_holder, dict1);
dict1->SetNameFor("T", "bar");
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
@@ -30,9 +28,9 @@ TEST(cpdf_formfield, FPDF_GetFullName) {
name = FPDF_GetFullName(root);
EXPECT_STREQ("bar.foo", name.UTF8Encode().c_str());
- CPDF_Dictionary* dict3 = new CPDF_Dictionary();
- dict2->SetReferenceFor("Parent", &obj_holder,
- obj_holder.AddIndirectObject(dict3));
+ CPDF_Dictionary* dict3 = obj_holder.NewIndirect<CPDF_Dictionary>();
+ dict2->SetReferenceFor("Parent", &obj_holder, dict3);
+
dict3->SetNameFor("T", "qux");
name = FPDF_GetFullName(root);
EXPECT_STREQ("qux.bar.foo", name.UTF8Encode().c_str());