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

Side by Side Diff: fpdfsdk/src/fsdk_baseform_embeddertest.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. Created 4 years, 9 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/src/fsdk_baseform.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('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/fsdk_baseform.h" 5 #include "fpdfsdk/include/fsdk_baseform.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 CPDF_Rect& actual, const CPDF_Rect& 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 EXPECT_TRUE(LoadPage(0));
30 EXPECT_TRUE(LoadPage(1)); 30 EXPECT_TRUE(LoadPage(1));
31 EXPECT_TRUE(LoadPage(2)); 31 EXPECT_TRUE(LoadPage(2));
32 32
33 CPDF_Rect LeftBottom(200, 200, 220, 220); 33 CFX_FloatRect LeftBottom(200, 200, 220, 220);
34 CPDF_Rect RightBottom(400, 201, 420, 221); 34 CFX_FloatRect RightBottom(400, 201, 420, 221);
35 CPDF_Rect LeftTop(201, 400, 221, 420); 35 CFX_FloatRect LeftTop(201, 400, 221, 420);
36 CPDF_Rect RightTop(401, 401, 421, 421); 36 CFX_FloatRect RightTop(401, 401, 421, 421);
37 37
38 CPDFSDK_Document* pSDKDoc = 38 CPDFSDK_Document* pSDKDoc =
39 CPDFSDK_Document::FromFPDFFormHandle(form_handle()); 39 CPDFSDK_Document::FromFPDFFormHandle(form_handle());
40 { 40 {
41 // Page 0 specifies "row order". 41 // Page 0 specifies "row order".
42 CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), "Widget", ""); 42 CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), "Widget", "");
43 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); 43 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot();
44 CheckRect(pAnnot->GetRect(), RightTop); 44 CheckRect(pAnnot->GetRect(), RightTop);
45 pAnnot = iter.GetNextAnnot(pAnnot); 45 pAnnot = iter.GetNextAnnot(pAnnot);
46 CheckRect(pAnnot->GetRect(), LeftTop); 46 CheckRect(pAnnot->GetRect(), LeftTop);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 pAnnot = iter.GetPrevAnnot(pAnnot); 106 pAnnot = iter.GetPrevAnnot(pAnnot);
107 CheckRect(pAnnot->GetRect(), LeftTop); 107 CheckRect(pAnnot->GetRect(), LeftTop);
108 pAnnot = iter.GetPrevAnnot(pAnnot); 108 pAnnot = iter.GetPrevAnnot(pAnnot);
109 CheckRect(pAnnot->GetRect(), RightTop); 109 CheckRect(pAnnot->GetRect(), RightTop);
110 pAnnot = iter.GetPrevAnnot(pAnnot); 110 pAnnot = iter.GetPrevAnnot(pAnnot);
111 CheckRect(pAnnot->GetRect(), LeftBottom); 111 CheckRect(pAnnot->GetRect(), LeftBottom);
112 pAnnot = iter.GetPrevAnnot(pAnnot); 112 pAnnot = iter.GetPrevAnnot(pAnnot);
113 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); 113 EXPECT_EQ(iter.GetLastAnnot(), pAnnot);
114 } 114 }
115 } 115 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698