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

Side by Side Diff: fpdfsdk/fsdk_baseform_embeddertest.cpp

Issue 2258333002: Fix page leaks in an embedder test (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: new approach Created 4 years, 3 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 | « fpdfsdk/fpdfformfill_embeddertest.cpp ('k') | testing/embedder_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 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 "fpdfsdk/include/cba_annotiterator.h" 5 #include "fpdfsdk/include/cba_annotiterator.h"
6 #include "fpdfsdk/include/fsdk_define.h" 6 #include "fpdfsdk/include/fsdk_define.h"
7 #include "fpdfsdk/include/fsdk_mgr.h" 7 #include "fpdfsdk/include/fsdk_mgr.h"
8 #include "testing/embedder_test.h" 8 #include "testing/embedder_test.h"
9 #include "testing/embedder_test_mock_delegate.h" 9 #include "testing/embedder_test_mock_delegate.h"
10 #include "testing/embedder_test_timer_handling_delegate.h" 10 #include "testing/embedder_test_timer_handling_delegate.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace { 14 namespace {
15 15
16 void CheckRect(const CFX_FloatRect& actual, const CFX_FloatRect& expected) { 16 void CheckRect(const CFX_FloatRect& actual, const CFX_FloatRect& expected) {
17 EXPECT_EQ(expected.left, actual.left); 17 EXPECT_EQ(expected.left, actual.left);
18 EXPECT_EQ(expected.bottom, actual.bottom); 18 EXPECT_EQ(expected.bottom, actual.bottom);
19 EXPECT_EQ(expected.right, actual.right); 19 EXPECT_EQ(expected.right, actual.right);
20 EXPECT_EQ(expected.top, actual.top); 20 EXPECT_EQ(expected.top, actual.top);
21 } 21 }
22 22
23 } // namespace 23 } // namespace
24 24
25 class FSDKBaseFormEmbeddertest : public EmbedderTest {}; 25 class FSDKBaseFormEmbeddertest : public EmbedderTest {};
26 26
27 TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) { 27 TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) {
28 EXPECT_TRUE(OpenDocument("annotiter.pdf")); 28 EXPECT_TRUE(OpenDocument("annotiter.pdf"));
29 EXPECT_TRUE(LoadPage(0)); 29 FPDF_PAGE page0 = LoadPage(0);
30 EXPECT_TRUE(LoadPage(1)); 30 FPDF_PAGE page1 = LoadPage(1);
31 EXPECT_TRUE(LoadPage(2)); 31 FPDF_PAGE page2 = LoadPage(2);
32 EXPECT_TRUE(page0);
33 EXPECT_TRUE(page1);
34 EXPECT_TRUE(page2);
32 35
33 CFX_FloatRect LeftBottom(200, 200, 220, 220); 36 CFX_FloatRect LeftBottom(200, 200, 220, 220);
34 CFX_FloatRect RightBottom(400, 201, 420, 221); 37 CFX_FloatRect RightBottom(400, 201, 420, 221);
35 CFX_FloatRect LeftTop(201, 400, 221, 420); 38 CFX_FloatRect LeftTop(201, 400, 221, 420);
36 CFX_FloatRect RightTop(401, 401, 421, 421); 39 CFX_FloatRect RightTop(401, 401, 421, 421);
37 40
38 CPDFSDK_Document* pSDKDoc = 41 CPDFSDK_Document* pSDKDoc =
39 CPDFSDK_Document::FromFPDFFormHandle(form_handle()); 42 CPDFSDK_Document::FromFPDFFormHandle(form_handle());
40 { 43 {
41 // Page 0 specifies "row order". 44 // Page 0 specifies "row order".
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 CheckRect(pAnnot->GetRect(), RightBottom); 108 CheckRect(pAnnot->GetRect(), RightBottom);
106 pAnnot = iter.GetPrevAnnot(pAnnot); 109 pAnnot = iter.GetPrevAnnot(pAnnot);
107 CheckRect(pAnnot->GetRect(), LeftTop); 110 CheckRect(pAnnot->GetRect(), LeftTop);
108 pAnnot = iter.GetPrevAnnot(pAnnot); 111 pAnnot = iter.GetPrevAnnot(pAnnot);
109 CheckRect(pAnnot->GetRect(), RightTop); 112 CheckRect(pAnnot->GetRect(), RightTop);
110 pAnnot = iter.GetPrevAnnot(pAnnot); 113 pAnnot = iter.GetPrevAnnot(pAnnot);
111 CheckRect(pAnnot->GetRect(), LeftBottom); 114 CheckRect(pAnnot->GetRect(), LeftBottom);
112 pAnnot = iter.GetPrevAnnot(pAnnot); 115 pAnnot = iter.GetPrevAnnot(pAnnot);
113 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); 116 EXPECT_EQ(iter.GetLastAnnot(), pAnnot);
114 } 117 }
118 UnloadPage(page2);
119 UnloadPage(page1);
120 UnloadPage(page0);
115 } 121 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfformfill_embeddertest.cpp ('k') | testing/embedder_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698