summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-05-03 17:19:53 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-03 17:19:53 +0000
commit525147a1f6d6cd736a407d1e189ac25d2f4726e8 (patch)
treebdc818c52d902a5a4e8ce8a4f0ba29bd11007b05 /fpdfsdk/fpdf_edit_embeddertest.cpp
parentccd9421589922b8f35ee5330d7fdac7edea081db (diff)
downloadpdfium-525147a1f6d6cd736a407d1e189ac25d2f4726e8.tar.xz
Use strict types in FPDF API, try #3
Rather than messing with actual inheritence, add type-checking wrappers and just blatantly cast to incomplete types. Along the way, this points out places where we would downcast without checking, which I fix. Change-Id: Ieb303eb46ad8522dfe082454f1f10f247ffd52d5 Reviewed-on: https://pdfium-review.googlesource.com/32030 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 0604cdbe71..a20faeba80 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -995,7 +995,7 @@ TEST_F(FPDFEditEmbeddertest, LoadSimpleType1Font) {
ScopedFPDFFont font(
FPDFText_LoadFont(document(), data, size, FPDF_FONT_TYPE1, false));
ASSERT_TRUE(font.get());
- CPDF_Font* typed_font = static_cast<CPDF_Font*>(font.get());
+ CPDF_Font* typed_font = CPDFFontFromFPDFFont(font.get());
EXPECT_TRUE(typed_font->IsType1Font());
CPDF_Dictionary* font_dict = typed_font->GetFontDict();
@@ -1024,7 +1024,7 @@ TEST_F(FPDFEditEmbeddertest, LoadSimpleTrueTypeFont) {
ScopedFPDFFont font(
FPDFText_LoadFont(document(), data, size, FPDF_FONT_TRUETYPE, false));
ASSERT_TRUE(font.get());
- CPDF_Font* typed_font = static_cast<CPDF_Font*>(font.get());
+ CPDF_Font* typed_font = CPDFFontFromFPDFFont(font.get());
EXPECT_TRUE(typed_font->IsTrueTypeFont());
CPDF_Dictionary* font_dict = typed_font->GetFontDict();
@@ -1054,7 +1054,7 @@ TEST_F(FPDFEditEmbeddertest, LoadCIDType0Font) {
ScopedFPDFFont font(
FPDFText_LoadFont(document(), data, size, FPDF_FONT_TYPE1, 1));
ASSERT_TRUE(font.get());
- CPDF_Font* typed_font = static_cast<CPDF_Font*>(font.get());
+ CPDF_Font* typed_font = CPDFFontFromFPDFFont(font.get());
EXPECT_TRUE(typed_font->IsCIDFont());
// Check font dictionary entries
@@ -1096,7 +1096,7 @@ TEST_F(FPDFEditEmbeddertest, LoadCIDType2Font) {
ScopedFPDFFont font(
FPDFText_LoadFont(document(), data, size, FPDF_FONT_TRUETYPE, 1));
ASSERT_TRUE(font.get());
- CPDF_Font* typed_font = static_cast<CPDF_Font*>(font.get());
+ CPDF_Font* typed_font = CPDFFontFromFPDFFont(font.get());
EXPECT_TRUE(typed_font->IsCIDFont());
// Check font dictionary entries