From ce8e51e6c444f6caaa160bf8b1decd5d7ec84e6f Mon Sep 17 00:00:00 2001 From: rbpotter Date: Fri, 28 Apr 2017 12:42:47 -0700 Subject: Fix rotations Normalize rotations read from PDF documents. Make FPDFPage_GetRotation always return a value 0 to 3 as specified in fpdf_edit.h instead of returning the page rotation / 90 (page rotation may be negative for some PDFs). BUG=chromium:713197 Change-Id: Ie477803f7d298b777a3ace89b21cfda8b7f6808b Reviewed-on: https://pdfium-review.googlesource.com/4532 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- fpdfsdk/fpdfedit_embeddertest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'fpdfsdk/fpdfedit_embeddertest.cpp') diff --git a/fpdfsdk/fpdfedit_embeddertest.cpp b/fpdfsdk/fpdfedit_embeddertest.cpp index 952564db49..d62f5ca85c 100644 --- a/fpdfsdk/fpdfedit_embeddertest.cpp +++ b/fpdfsdk/fpdfedit_embeddertest.cpp @@ -694,3 +694,13 @@ TEST_F(FPDFEditEmbeddertest, LoadCIDType2Font) { ASSERT_TRUE(widths_array); CheckCompositeFontWidths(widths_array, typed_font); } + +TEST_F(FPDFEditEmbeddertest, NormalizeNegativeRotation) { + // Load document with a -90 degree rotation + EXPECT_TRUE(OpenDocument("bug_713197.pdf")); + FPDF_PAGE page = LoadPage(0); + EXPECT_NE(nullptr, page); + + EXPECT_EQ(3, FPDFPage_GetRotation(page)); + UnloadPage(page); +} -- cgit v1.2.3