| OLD | NEW |
| 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" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 CFX_FloatRect LeftBottom(200, 200, 220, 220); | 36 CFX_FloatRect LeftBottom(200, 200, 220, 220); |
| 37 CFX_FloatRect RightBottom(400, 201, 420, 221); | 37 CFX_FloatRect RightBottom(400, 201, 420, 221); |
| 38 CFX_FloatRect LeftTop(201, 400, 221, 420); | 38 CFX_FloatRect LeftTop(201, 400, 221, 420); |
| 39 CFX_FloatRect RightTop(401, 401, 421, 421); | 39 CFX_FloatRect RightTop(401, 401, 421, 421); |
| 40 | 40 |
| 41 CPDFSDK_Document* pSDKDoc = | 41 CPDFSDK_Document* pSDKDoc = |
| 42 CPDFSDK_Document::FromFPDFFormHandle(form_handle()); | 42 CPDFSDK_Document::FromFPDFFormHandle(form_handle()); |
| 43 { | 43 { |
| 44 // Page 0 specifies "row order". | 44 // Page 0 specifies "row order". |
| 45 CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), "Widget"); | 45 CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), |
| 46 CPDF_Annot::Subtype::WIDGET); |
| 46 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); | 47 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); |
| 47 CheckRect(pAnnot->GetRect(), RightTop); | 48 CheckRect(pAnnot->GetRect(), RightTop); |
| 48 pAnnot = iter.GetNextAnnot(pAnnot); | 49 pAnnot = iter.GetNextAnnot(pAnnot); |
| 49 CheckRect(pAnnot->GetRect(), LeftTop); | 50 CheckRect(pAnnot->GetRect(), LeftTop); |
| 50 pAnnot = iter.GetNextAnnot(pAnnot); | 51 pAnnot = iter.GetNextAnnot(pAnnot); |
| 51 CheckRect(pAnnot->GetRect(), RightBottom); | 52 CheckRect(pAnnot->GetRect(), RightBottom); |
| 52 pAnnot = iter.GetNextAnnot(pAnnot); | 53 pAnnot = iter.GetNextAnnot(pAnnot); |
| 53 CheckRect(pAnnot->GetRect(), LeftBottom); | 54 CheckRect(pAnnot->GetRect(), LeftBottom); |
| 54 pAnnot = iter.GetNextAnnot(pAnnot); | 55 pAnnot = iter.GetNextAnnot(pAnnot); |
| 55 EXPECT_EQ(iter.GetFirstAnnot(), pAnnot); | 56 EXPECT_EQ(iter.GetFirstAnnot(), pAnnot); |
| 56 | 57 |
| 57 pAnnot = iter.GetLastAnnot(); | 58 pAnnot = iter.GetLastAnnot(); |
| 58 CheckRect(pAnnot->GetRect(), LeftBottom); | 59 CheckRect(pAnnot->GetRect(), LeftBottom); |
| 59 pAnnot = iter.GetPrevAnnot(pAnnot); | 60 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 60 CheckRect(pAnnot->GetRect(), RightBottom); | 61 CheckRect(pAnnot->GetRect(), RightBottom); |
| 61 pAnnot = iter.GetPrevAnnot(pAnnot); | 62 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 62 CheckRect(pAnnot->GetRect(), LeftTop); | 63 CheckRect(pAnnot->GetRect(), LeftTop); |
| 63 pAnnot = iter.GetPrevAnnot(pAnnot); | 64 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 64 CheckRect(pAnnot->GetRect(), RightTop); | 65 CheckRect(pAnnot->GetRect(), RightTop); |
| 65 pAnnot = iter.GetPrevAnnot(pAnnot); | 66 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 66 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); | 67 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); |
| 67 } | 68 } |
| 68 { | 69 { |
| 69 // Page 1 specifies "column order" | 70 // Page 1 specifies "column order" |
| 70 CBA_AnnotIterator iter(pSDKDoc->GetPageView(1), "Widget"); | 71 CBA_AnnotIterator iter(pSDKDoc->GetPageView(1), |
| 72 CPDF_Annot::Subtype::WIDGET); |
| 71 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); | 73 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); |
| 72 CheckRect(pAnnot->GetRect(), RightTop); | 74 CheckRect(pAnnot->GetRect(), RightTop); |
| 73 pAnnot = iter.GetNextAnnot(pAnnot); | 75 pAnnot = iter.GetNextAnnot(pAnnot); |
| 74 CheckRect(pAnnot->GetRect(), RightBottom); | 76 CheckRect(pAnnot->GetRect(), RightBottom); |
| 75 pAnnot = iter.GetNextAnnot(pAnnot); | 77 pAnnot = iter.GetNextAnnot(pAnnot); |
| 76 CheckRect(pAnnot->GetRect(), LeftTop); | 78 CheckRect(pAnnot->GetRect(), LeftTop); |
| 77 pAnnot = iter.GetNextAnnot(pAnnot); | 79 pAnnot = iter.GetNextAnnot(pAnnot); |
| 78 CheckRect(pAnnot->GetRect(), LeftBottom); | 80 CheckRect(pAnnot->GetRect(), LeftBottom); |
| 79 pAnnot = iter.GetNextAnnot(pAnnot); | 81 pAnnot = iter.GetNextAnnot(pAnnot); |
| 80 EXPECT_EQ(iter.GetFirstAnnot(), pAnnot); | 82 EXPECT_EQ(iter.GetFirstAnnot(), pAnnot); |
| 81 | 83 |
| 82 pAnnot = iter.GetLastAnnot(); | 84 pAnnot = iter.GetLastAnnot(); |
| 83 CheckRect(pAnnot->GetRect(), LeftBottom); | 85 CheckRect(pAnnot->GetRect(), LeftBottom); |
| 84 pAnnot = iter.GetPrevAnnot(pAnnot); | 86 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 85 CheckRect(pAnnot->GetRect(), LeftTop); | 87 CheckRect(pAnnot->GetRect(), LeftTop); |
| 86 pAnnot = iter.GetPrevAnnot(pAnnot); | 88 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 87 CheckRect(pAnnot->GetRect(), RightBottom); | 89 CheckRect(pAnnot->GetRect(), RightBottom); |
| 88 pAnnot = iter.GetPrevAnnot(pAnnot); | 90 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 89 CheckRect(pAnnot->GetRect(), RightTop); | 91 CheckRect(pAnnot->GetRect(), RightTop); |
| 90 pAnnot = iter.GetPrevAnnot(pAnnot); | 92 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 91 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); | 93 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); |
| 92 } | 94 } |
| 93 { | 95 { |
| 94 // Page 2 specifies "struct order" | 96 // Page 2 specifies "struct order" |
| 95 CBA_AnnotIterator iter(pSDKDoc->GetPageView(2), "Widget"); | 97 CBA_AnnotIterator iter(pSDKDoc->GetPageView(2), |
| 98 CPDF_Annot::Subtype::WIDGET); |
| 96 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); | 99 CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); |
| 97 CheckRect(pAnnot->GetRect(), LeftBottom); | 100 CheckRect(pAnnot->GetRect(), LeftBottom); |
| 98 pAnnot = iter.GetNextAnnot(pAnnot); | 101 pAnnot = iter.GetNextAnnot(pAnnot); |
| 99 CheckRect(pAnnot->GetRect(), RightTop); | 102 CheckRect(pAnnot->GetRect(), RightTop); |
| 100 pAnnot = iter.GetNextAnnot(pAnnot); | 103 pAnnot = iter.GetNextAnnot(pAnnot); |
| 101 CheckRect(pAnnot->GetRect(), LeftTop); | 104 CheckRect(pAnnot->GetRect(), LeftTop); |
| 102 pAnnot = iter.GetNextAnnot(pAnnot); | 105 pAnnot = iter.GetNextAnnot(pAnnot); |
| 103 CheckRect(pAnnot->GetRect(), RightBottom); | 106 CheckRect(pAnnot->GetRect(), RightBottom); |
| 104 pAnnot = iter.GetNextAnnot(pAnnot); | 107 pAnnot = iter.GetNextAnnot(pAnnot); |
| 105 EXPECT_EQ(iter.GetFirstAnnot(), pAnnot); | 108 EXPECT_EQ(iter.GetFirstAnnot(), pAnnot); |
| 106 | 109 |
| 107 pAnnot = iter.GetLastAnnot(); | 110 pAnnot = iter.GetLastAnnot(); |
| 108 CheckRect(pAnnot->GetRect(), RightBottom); | 111 CheckRect(pAnnot->GetRect(), RightBottom); |
| 109 pAnnot = iter.GetPrevAnnot(pAnnot); | 112 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 110 CheckRect(pAnnot->GetRect(), LeftTop); | 113 CheckRect(pAnnot->GetRect(), LeftTop); |
| 111 pAnnot = iter.GetPrevAnnot(pAnnot); | 114 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 112 CheckRect(pAnnot->GetRect(), RightTop); | 115 CheckRect(pAnnot->GetRect(), RightTop); |
| 113 pAnnot = iter.GetPrevAnnot(pAnnot); | 116 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 114 CheckRect(pAnnot->GetRect(), LeftBottom); | 117 CheckRect(pAnnot->GetRect(), LeftBottom); |
| 115 pAnnot = iter.GetPrevAnnot(pAnnot); | 118 pAnnot = iter.GetPrevAnnot(pAnnot); |
| 116 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); | 119 EXPECT_EQ(iter.GetLastAnnot(), pAnnot); |
| 117 } | 120 } |
| 118 UnloadPage(page2); | 121 UnloadPage(page2); |
| 119 UnloadPage(page1); | 122 UnloadPage(page1); |
| 120 UnloadPage(page0); | 123 UnloadPage(page0); |
| 121 } | 124 } |
| OLD | NEW |