Revert "Revert "Add type cast definitions for CPDF_Reference.""
[pdfium.git] / fpdfsdk / src / fpdfview_c_api_test.c
1 // Copyright 2015 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This "C" (not "C++") file ensures that the public headers compile
6 // and link for "C" (and not just "C++").
7
8 #include <stdio.h>
9
10 #include "fpdfview_c_api_test.h"
11
12 #include "../../public/fpdf_dataavail.h"
13 #include "../../public/fpdf_doc.h"
14 #include "../../public/fpdf_edit.h"
15 #include "../../public/fpdf_ext.h"
16 #include "../../public/fpdf_flatten.h"
17 #include "../../public/fpdf_formfill.h"
18 #include "../../public/fpdf_fwlevent.h"
19 #include "../../public/fpdf_ppo.h"
20 #include "../../public/fpdf_progressive.h"
21 #include "../../public/fpdf_save.h"
22 #include "../../public/fpdf_searchex.h"
23 #include "../../public/fpdf_sysfontinfo.h"
24 #include "../../public/fpdf_text.h"
25 #include "../../public/fpdf_transformpage.h"
26 #include "../../public/fpdfview.h"
27
28 // Scheme for avoiding LTO out of existence, warnings, etc.
29 typedef void (*fnptr)(void);  // Legal generic function type for casts.
30 fnptr g_c_api_test_fnptr = NULL;  // Extern, so can't know it doesn't change.
31 #define CHK(x) if ((fnptr)(x) == g_c_api_test_fnptr) return 0
32
33 // Function to call from gtest harness to ensure linker resolution.
34 int CheckPDFiumCApi() {
35     // fpdf_dataavail.h
36     CHK(FPDFAvail_Create);
37     CHK(FPDFAvail_Destroy);
38     CHK(FPDFAvail_IsDocAvail);
39     CHK(FPDFAvail_GetDocument);
40     CHK(FPDFAvail_GetFirstPageNum);
41     CHK(FPDFAvail_IsPageAvail);
42     CHK(FPDFAvail_IsFormAvail);
43     CHK(FPDFAvail_IsLinearized);
44
45     // fpdf_doc.h
46     CHK(FPDFBookmark_GetFirstChild);
47     CHK(FPDFBookmark_GetNextSibling);
48     CHK(FPDFBookmark_GetTitle);
49     CHK(FPDFBookmark_Find);
50     CHK(FPDFBookmark_GetDest);
51     CHK(FPDFBookmark_GetAction);
52     CHK(FPDFAction_GetType);
53     CHK(FPDFAction_GetDest);
54     CHK(FPDFAction_GetFilePath);
55     CHK(FPDFAction_GetURIPath);
56     CHK(FPDFDest_GetPageIndex);
57     CHK(FPDFLink_GetLinkAtPoint);
58     CHK(FPDFLink_GetLinkZOrderAtPoint);
59     CHK(FPDFLink_GetDest);
60     CHK(FPDFLink_GetAction);
61     CHK(FPDFLink_Enumerate);
62     CHK(FPDFLink_GetAnnotRect);
63     CHK(FPDFLink_CountQuadPoints);
64     CHK(FPDFLink_GetQuadPoints);
65     CHK(FPDF_GetMetaText);
66
67     // fpdf_edit.h
68     CHK(FPDF_CreateNewDocument);
69     CHK(FPDFPage_New);
70     CHK(FPDFPage_Delete);
71     CHK(FPDFPage_GetRotation);
72     CHK(FPDFPage_SetRotation);
73     CHK(FPDFPage_InsertObject);
74     CHK(FPDFPage_CountObject);
75     CHK(FPDFPage_GetObject);
76     CHK(FPDFPage_HasTransparency);
77     CHK(FPDFPage_GenerateContent);
78     CHK(FPDFPageObj_HasTransparency);
79     CHK(FPDFPageObj_Transform);
80     CHK(FPDFPage_TransformAnnots);
81     CHK(FPDFPageObj_NewImgeObj);
82     CHK(FPDFImageObj_LoadJpegFile);
83     CHK(FPDFImageObj_SetMatrix);
84     CHK(FPDFImageObj_SetBitmap);
85
86     // fpdf_ext.h
87     CHK(FSDK_SetUnSpObjProcessHandler);
88     CHK(FPDFDoc_GetPageMode);
89
90     // fpdf_flatten.h
91     CHK(FPDFPage_Flatten);
92
93     // fpdf_fwlevent.h - no exports.
94
95     // fpdf_formfill.h
96     CHK(FPDFDOC_InitFormFillEnvironment);
97     CHK(FPDFDOC_ExitFormFillEnvironment);
98     CHK(FORM_OnAfterLoadPage);
99     CHK(FORM_OnBeforeClosePage);
100     CHK(FORM_DoDocumentJSAction);
101     CHK(FORM_DoDocumentOpenAction);
102     CHK(FORM_DoDocumentAAction);
103     CHK(FORM_DoPageAAction);
104     CHK(FORM_OnMouseMove);
105     CHK(FORM_OnLButtonDown);
106     CHK(FORM_OnLButtonUp);
107     CHK(FORM_OnKeyDown);
108     CHK(FORM_OnKeyUp);
109     CHK(FORM_OnChar);
110     CHK(FORM_ForceToKillFocus);
111     CHK(FPDFPage_HasFormFieldAtPoint);
112     CHK(FPDPage_HasFormFieldAtPoint);  // DEPRECATED. Remove in the future.
113     CHK(FPDFPage_FormFieldZOrderAtPoint);
114     CHK(FPDF_SetFormFieldHighlightColor);
115     CHK(FPDF_SetFormFieldHighlightAlpha);
116     CHK(FPDF_RemoveFormFieldHighlight);
117     CHK(FPDF_FFLDraw);
118
119     // fpdf_ppo.h
120     CHK(FPDF_ImportPages);
121     CHK(FPDF_CopyViewerPreferences);
122
123     // fpdf_progressive.h
124     CHK(FPDF_RenderPageBitmap_Start);
125     CHK(FPDF_RenderPage_Continue);
126     CHK(FPDF_RenderPage_Close);
127
128     // fpdf_save.h
129     CHK(FPDF_SaveAsCopy);
130     CHK(FPDF_SaveWithVersion);
131
132     // fpdf_searchex.h
133     CHK(FPDFText_GetCharIndexFromTextIndex);
134
135     // fpdf_sysfontinfo.h
136     CHK(FPDF_GetDefaultTTFMap);
137     CHK(FPDF_AddInstalledFont);
138     CHK(FPDF_SetSystemFontInfo);
139     CHK(FPDF_GetDefaultSystemFontInfo);
140
141     // fpdf_text.h
142     CHK(FPDFText_LoadPage);
143     CHK(FPDFText_ClosePage);
144     CHK(FPDFText_CountChars);
145     CHK(FPDFText_GetUnicode);
146     CHK(FPDFText_GetFontSize);
147     CHK(FPDFText_GetCharBox);
148     CHK(FPDFText_GetCharIndexAtPos);
149     CHK(FPDFText_GetText);
150     CHK(FPDFText_CountRects);
151     CHK(FPDFText_GetRect);
152     CHK(FPDFText_GetBoundedText);
153     CHK(FPDFText_FindStart);
154     CHK(FPDFText_FindNext);
155     CHK(FPDFText_FindPrev);
156     CHK(FPDFText_GetSchResultIndex);
157     CHK(FPDFText_GetSchCount);
158     CHK(FPDFText_FindClose);
159     CHK(FPDFLink_LoadWebLinks);
160     CHK(FPDFLink_CountWebLinks);
161     CHK(FPDFLink_GetURL);
162     CHK(FPDFLink_CountRects);
163     CHK(FPDFLink_GetRect);
164     CHK(FPDFLink_CloseWebLinks);
165
166     // fpdf_transformpage.h
167     CHK(FPDFPage_SetMediaBox);
168     CHK(FPDFPage_SetCropBox);
169     CHK(FPDFPage_GetMediaBox);
170     CHK(FPDFPage_GetCropBox);
171     CHK(FPDFPage_TransFormWithClip);
172     CHK(FPDFPageObj_TransformClipPath);
173     CHK(FPDF_CreateClipPath);
174     CHK(FPDF_DestroyClipPath);
175     CHK(FPDFPage_InsertClipPath);
176
177     // fpdfview.h
178     CHK(FPDF_InitLibrary);
179     CHK(FPDF_InitLibraryWithConfig);
180     CHK(FPDF_DestroyLibrary);
181     CHK(FPDF_SetSandBoxPolicy);
182     CHK(FPDF_LoadDocument);
183     CHK(FPDF_LoadMemDocument);
184     CHK(FPDF_LoadCustomDocument);
185     CHK(FPDF_GetFileVersion);
186     CHK(FPDF_GetLastError);
187     CHK(FPDF_GetDocPermissions);
188     CHK(FPDF_GetSecurityHandlerRevision);
189     CHK(FPDF_GetPageCount);
190     CHK(FPDF_LoadPage);
191     CHK(FPDF_GetPageWidth);
192     CHK(FPDF_GetPageHeight);
193     CHK(FPDF_GetPageSizeByIndex);
194     CHK(FPDF_RenderPageBitmap);
195     CHK(FPDF_ClosePage);
196     CHK(FPDF_CloseDocument);
197     CHK(FPDF_DeviceToPage);
198     CHK(FPDF_PageToDevice);
199     CHK(FPDFBitmap_Create);
200     CHK(FPDFBitmap_CreateEx);
201     CHK(FPDFBitmap_FillRect);
202     CHK(FPDFBitmap_GetBuffer);
203     CHK(FPDFBitmap_GetWidth);
204     CHK(FPDFBitmap_GetHeight);
205     CHK(FPDFBitmap_GetStride);
206     CHK(FPDFBitmap_Destroy);
207     CHK(FPDF_VIEWERREF_GetPrintScaling);
208     CHK(FPDF_VIEWERREF_GetNumCopies);
209     CHK(FPDF_VIEWERREF_GetPrintPageRange);
210     CHK(FPDF_VIEWERREF_GetDuplex);
211     CHK(FPDF_CountNamedDests);
212     CHK(FPDF_GetNamedDestByName);
213     CHK(FPDF_GetNamedDest);
214
215     return 1;
216 }
217
218 #undef CHK