Add embedder test for fix to bug_452455.
[pdfium.git] / fpdfsdk / src / fpdfview_embeddertest.cpp
index ee32727..f9b611b 100644 (file)
@@ -27,14 +27,12 @@ TEST_F(FPDFViewEmbeddertest, Document) {
 
 TEST_F(FPDFViewEmbeddertest, Page) {
   EXPECT_TRUE(OpenDocument("testing/resources/about_blank.pdf"));
-  FPDF_FORMHANDLE form_handle = SetFormFillEnvironment();
-  FPDF_PAGE page = LoadPage(0, form_handle);
+  FPDF_PAGE page = LoadPage(0);
   EXPECT_NE(nullptr, page);
   EXPECT_EQ(612.0, FPDF_GetPageWidth(page));
   EXPECT_EQ(792.0, FPDF_GetPageHeight(page));
-  UnloadPage(page, form_handle);
-  EXPECT_EQ(nullptr, LoadPage(1, form_handle));
-  ClearFormFillEnvironment(form_handle);
+  UnloadPage(page);
+  EXPECT_EQ(nullptr, LoadPage(1));
 }
 
 TEST_F(FPDFViewEmbeddertest, ViewerRef) {
@@ -177,3 +175,14 @@ TEST_F(FPDFViewEmbeddertest, NamedDestsByName) {
   dest = FPDF_GetNamedDestByName(document(), "Bogus");
   EXPECT_EQ(nullptr, dest);
 }
+
+// The following tests pass if the document opens without crashing.
+TEST_F(FPDFViewEmbeddertest, Crasher1) {
+  EXPECT_TRUE(OpenDocument("testing/resources/bug_451830.pdf"));
+}
+
+TEST_F(FPDFViewEmbeddertest, Crasher2) {
+  EXPECT_TRUE(OpenDocument("testing/resources/bug_452455.pdf"));
+  FPDF_PAGE page = LoadPage(0);
+  EXPECT_NE(nullptr, page);
+}