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 "testing/embedder_test.h" | 5 #include "testing/embedder_test.h" |
6 | 6 |
7 #include <limits.h> | 7 #include <limits.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "public/fpdf_dataavail.h" | 14 #include "public/fpdf_dataavail.h" |
| 15 #include "public/fpdf_edit.h" |
15 #include "public/fpdf_text.h" | 16 #include "public/fpdf_text.h" |
16 #include "public/fpdfview.h" | 17 #include "public/fpdfview.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/test_support.h" | 19 #include "testing/test_support.h" |
19 #include "testing/utils/path_service.h" | 20 #include "testing/utils/path_service.h" |
20 | 21 |
21 #ifdef PDF_ENABLE_V8 | 22 #ifdef PDF_ENABLE_V8 |
22 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
23 #include "v8/include/v8-platform.h" | 24 #include "v8/include/v8-platform.h" |
24 #endif // PDF_ENABLE_V8 | 25 #endif // PDF_ENABLE_V8 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 if (!page) { | 207 if (!page) { |
207 return nullptr; | 208 return nullptr; |
208 } | 209 } |
209 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_OPEN); | 210 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_OPEN); |
210 return page; | 211 return page; |
211 } | 212 } |
212 | 213 |
213 FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) { | 214 FPDF_BITMAP EmbedderTest::RenderPage(FPDF_PAGE page) { |
214 int width = static_cast<int>(FPDF_GetPageWidth(page)); | 215 int width = static_cast<int>(FPDF_GetPageWidth(page)); |
215 int height = static_cast<int>(FPDF_GetPageHeight(page)); | 216 int height = static_cast<int>(FPDF_GetPageHeight(page)); |
216 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, 0); | 217 int alpha = FPDFPage_HasTransparency(page) ? 1 : 0; |
217 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, 0xFFFFFFFF); | 218 FPDF_BITMAP bitmap = FPDFBitmap_Create(width, height, alpha); |
| 219 FPDF_DWORD fill_color = alpha ? 0x00000000 : 0xFFFFFFFF; |
| 220 FPDFBitmap_FillRect(bitmap, 0, 0, width, height, fill_color); |
218 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); | 221 FPDF_RenderPageBitmap(bitmap, page, 0, 0, width, height, 0, 0); |
219 FPDF_FFLDraw(form_handle_, bitmap, page, 0, 0, width, height, 0, 0); | 222 FPDF_FFLDraw(form_handle_, bitmap, page, 0, 0, width, height, 0, 0); |
220 return bitmap; | 223 return bitmap; |
221 } | 224 } |
222 | 225 |
223 void EmbedderTest::UnloadPage(FPDF_PAGE page) { | 226 void EmbedderTest::UnloadPage(FPDF_PAGE page) { |
224 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_CLOSE); | 227 FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_CLOSE); |
225 FORM_OnBeforeClosePage(page, form_handle_); | 228 FORM_OnBeforeClosePage(page, form_handle_); |
226 FPDF_ClosePage(page); | 229 FPDF_ClosePage(page); |
227 } | 230 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 285 } |
283 | 286 |
284 // Can't use gtest-provided main since we need to stash the path to the | 287 // Can't use gtest-provided main since we need to stash the path to the |
285 // executable in order to find the external V8 binary data files. | 288 // executable in order to find the external V8 binary data files. |
286 int main(int argc, char** argv) { | 289 int main(int argc, char** argv) { |
287 g_exe_path_ = argv[0]; | 290 g_exe_path_ = argv[0]; |
288 testing::InitGoogleTest(&argc, argv); | 291 testing::InitGoogleTest(&argc, argv); |
289 testing::InitGoogleMock(&argc, argv); | 292 testing::InitGoogleMock(&argc, argv); |
290 return RUN_ALL_TESTS(); | 293 return RUN_ALL_TESTS(); |
291 } | 294 } |
OLD | NEW |