OLD | NEW |
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 <limits> | 5 #include <limits> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "fpdfsdk/fpdfview_c_api_test.h" | 8 #include "fpdfsdk/fpdfview_c_api_test.h" |
9 #include "public/fpdfview.h" | 9 #include "public/fpdfview.h" |
10 #include "testing/embedder_test.h" | 10 #include "testing/embedder_test.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 buffer_size = sizeof(fixed_buffer); | 173 buffer_size = sizeof(fixed_buffer); |
174 dest = FPDF_GetNamedDest(document(), -1, fixed_buffer, &buffer_size); | 174 dest = FPDF_GetNamedDest(document(), -1, fixed_buffer, &buffer_size); |
175 EXPECT_EQ(nullptr, dest); | 175 EXPECT_EQ(nullptr, dest); |
176 EXPECT_EQ(sizeof(fixed_buffer), | 176 EXPECT_EQ(sizeof(fixed_buffer), |
177 static_cast<size_t>(buffer_size)); // unmodified. | 177 static_cast<size_t>(buffer_size)); // unmodified. |
178 } | 178 } |
179 | 179 |
180 TEST_F(FPDFViewEmbeddertest, NamedDestsByName) { | 180 TEST_F(FPDFViewEmbeddertest, NamedDestsByName) { |
181 EXPECT_TRUE(OpenDocument("named_dests.pdf")); | 181 EXPECT_TRUE(OpenDocument("named_dests.pdf")); |
182 | 182 |
183 // Null pointer returns NULL. | 183 // Null pointer returns nullptr. |
184 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), nullptr); | 184 FPDF_DEST dest = FPDF_GetNamedDestByName(document(), nullptr); |
185 EXPECT_EQ(nullptr, dest); | 185 EXPECT_EQ(nullptr, dest); |
186 | 186 |
187 // Empty string returns NULL. | 187 // Empty string returns nullptr. |
188 dest = FPDF_GetNamedDestByName(document(), ""); | 188 dest = FPDF_GetNamedDestByName(document(), ""); |
189 EXPECT_EQ(nullptr, dest); | 189 EXPECT_EQ(nullptr, dest); |
190 | 190 |
191 // Item from Dests NameTree. | 191 // Item from Dests NameTree. |
192 dest = FPDF_GetNamedDestByName(document(), "First"); | 192 dest = FPDF_GetNamedDestByName(document(), "First"); |
193 EXPECT_NE(nullptr, dest); | 193 EXPECT_NE(nullptr, dest); |
194 | 194 |
195 long ignore_len = 0; | 195 long ignore_len = 0; |
196 FPDF_DEST dest_by_index = | 196 FPDF_DEST dest_by_index = |
197 FPDF_GetNamedDest(document(), 0, nullptr, &ignore_len); | 197 FPDF_GetNamedDest(document(), 0, nullptr, &ignore_len); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 // The test should pass when there is no infinite recursion in | 274 // The test should pass when there is no infinite recursion in |
275 // CPDF_SyntaxParser::GetString(). | 275 // CPDF_SyntaxParser::GetString(). |
276 TEST_F(FPDFViewEmbeddertest, Hang_355) { | 276 TEST_F(FPDFViewEmbeddertest, Hang_355) { |
277 EXPECT_FALSE(OpenDocument("bug_355.pdf")); | 277 EXPECT_FALSE(OpenDocument("bug_355.pdf")); |
278 } | 278 } |
279 // The test should pass even when the file has circular references to pages. | 279 // The test should pass even when the file has circular references to pages. |
280 TEST_F(FPDFViewEmbeddertest, Hang_360) { | 280 TEST_F(FPDFViewEmbeddertest, Hang_360) { |
281 EXPECT_FALSE(OpenDocument("bug_360.pdf")); | 281 EXPECT_FALSE(OpenDocument("bug_360.pdf")); |
282 } | 282 } |
OLD | NEW |