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

Side by Side Diff: fpdfsdk/fpdfdoc_embeddertest.cpp

Issue 1921033003: Fixup page removal for XFA documents. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "core/fxcrt/include/fx_string.h" 7 #include "core/fxcrt/include/fx_string.h"
8 #include "public/fpdf_doc.h" 8 #include "public/fpdf_doc.h"
9 #include "public/fpdf_edit.h"
9 #include "public/fpdfview.h" 10 #include "public/fpdfview.h"
10 #include "testing/embedder_test.h" 11 #include "testing/embedder_test.h"
11 #include "testing/fx_string_testhelpers.h" 12 #include "testing/fx_string_testhelpers.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "testing/test_support.h" 14 #include "testing/test_support.h"
14 15
15 class FPDFDocEmbeddertest : public EmbedderTest {}; 16 class FPDFDocEmbeddertest : public EmbedderTest {};
16 17
17 TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) { 18 TEST_F(FPDFDocEmbeddertest, DestGetPageIndex) {
18 EXPECT_TRUE(OpenDocument("named_dests.pdf")); 19 EXPECT_TRUE(OpenDocument("named_dests.pdf"));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 // Check circular bookmarks will not cause infinite loop. 132 // Check circular bookmarks will not cause infinite loop.
132 TEST_F(FPDFDocEmbeddertest, FindBookmarks_bug420) { 133 TEST_F(FPDFDocEmbeddertest, FindBookmarks_bug420) {
133 // Open a file with circular bookmarks. 134 // Open a file with circular bookmarks.
134 EXPECT_TRUE(OpenDocument("bookmarks_circular.pdf")); 135 EXPECT_TRUE(OpenDocument("bookmarks_circular.pdf"));
135 136
136 // Try to find a title. 137 // Try to find a title.
137 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title = 138 std::unique_ptr<unsigned short, pdfium::FreeDeleter> title =
138 GetFPDFWideString(L"anything"); 139 GetFPDFWideString(L"anything");
139 EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), title.get())); 140 EXPECT_EQ(nullptr, FPDFBookmark_Find(document(), title.get()));
140 } 141 }
142
143 TEST_F(FPDFDocEmbeddertest, DeletePage) {
144 EXPECT_TRUE(OpenDocument("hello_world.pdf"));
145 #if PDF_ENABLE_XFA
146 FPDF_LoadXFA(document());
Lei Zhang 2016/04/25 20:52:59 Check return value?
dsinclair 2016/04/25 21:01:13 Removed, left over from initially trying to make t
147 #endif // PDF_ENABLE_XFA
148 int count = FPDF_GetPageCount(document());
Lei Zhang 2016/04/25 20:52:59 Check |count| before continuing?
dsinclair 2016/04/25 21:01:13 Done.
149 FPDFPage_Delete(document(), 0);
150 EXPECT_EQ(count - 1, FPDF_GetPageCount(document()));
151 }
OLDNEW
« no previous file with comments | « no previous file | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('j') | fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698