summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAron Budea <aron.budea@collabora.com>2018-07-09 00:54:53 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-07-11 10:59:08 +0200
commitb5035a5ec51e29851eaf6c195e7e12320baed36f (patch)
tree3e100c1da9a14cf9443b03d7939f936e9b571edc /vcl
parent6f89e62cb7d4d32ad321840bd1887e7226c62cce (diff)
tdf#112690: make page size of exported PDF closer to what is set
regression from 3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8 Change-Id: Ia0fddeb112fa0867ec367c085e3682eac078d5f8 Reviewed-on: https://gerrit.libreoffice.org/57166 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 9a7a419baf9a6aa9fc70d9e2a00dec3fbdeee565) Reviewed-on: https://gerrit.libreoffice.org/57184
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 849e87b90f4a..5d8214b898c3 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -772,6 +772,14 @@ void PdfExportTest::testTdf108963()
mpPdfPage = FPDF_LoadPage(mpPdfDocument, /*page_index=*/0);
CPPUNIT_ASSERT(mpPdfPage);
+ // Test page size (28x15.75 cm, was 1/100th mm off, tdf#112690)
+ // bad: MediaBox[0 0 793.672440944882 446.428346456693]
+ // good: MediaBox[0 0 793.700787401575 446.456692913386]
+ const double aWidth = FPDF_GetPageWidth(mpPdfPage);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(793.7, aWidth, 0.01);
+ const double aHeight = FPDF_GetPageHeight(mpPdfPage);
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(446.46, aHeight, 0.01);
+
// Make sure there is a filled rectangle inside.
int nPageObjectCount = FPDFPage_CountObjects(mpPdfPage);
int nYellowPathCount = 0;
@@ -795,35 +803,35 @@ void PdfExportTest::testTdf108963()
float fY = 0;
FPDFPathSegment_GetPoint(pSegment, &fX, &fY);
CPPUNIT_ASSERT_EQUAL(245395, static_cast<int>(round(fX * 1000)));
- CPPUNIT_ASSERT_EQUAL(244233, static_cast<int>(round(fY * 1000)));
+ CPPUNIT_ASSERT_EQUAL(244261, static_cast<int>(round(fY * 1000)));
CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment));
pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 1);
CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment));
FPDFPathSegment_GetPoint(pSegment, &fX, &fY);
CPPUNIT_ASSERT_EQUAL(275102, static_cast<int>(round(fX * 1000)));
- CPPUNIT_ASSERT_EQUAL(267590, static_cast<int>(round(fY * 1000)));
+ CPPUNIT_ASSERT_EQUAL(267618, static_cast<int>(round(fY * 1000)));
CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment));
pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 2);
CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment));
FPDFPathSegment_GetPoint(pSegment, &fX, &fY);
CPPUNIT_ASSERT_EQUAL(287518, static_cast<int>(round(fX * 1000)));
- CPPUNIT_ASSERT_EQUAL(251801, static_cast<int>(round(fY * 1000)));
+ CPPUNIT_ASSERT_EQUAL(251829, static_cast<int>(round(fY * 1000)));
CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment));
pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 3);
CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment));
FPDFPathSegment_GetPoint(pSegment, &fX, &fY);
CPPUNIT_ASSERT_EQUAL(257839, static_cast<int>(round(fX * 1000)));
- CPPUNIT_ASSERT_EQUAL(228444, static_cast<int>(round(fY * 1000)));
+ CPPUNIT_ASSERT_EQUAL(228472, static_cast<int>(round(fY * 1000)));
CPPUNIT_ASSERT(!FPDFPathSegment_GetClose(pSegment));
pSegment = FPDFPath_GetPathSegment(pPdfPageObject, 4);
CPPUNIT_ASSERT_EQUAL(FPDF_SEGMENT_LINETO, FPDFPathSegment_GetType(pSegment));
FPDFPathSegment_GetPoint(pSegment, &fX, &fY);
CPPUNIT_ASSERT_EQUAL(245395, static_cast<int>(round(fX * 1000)));
- CPPUNIT_ASSERT_EQUAL(244233, static_cast<int>(round(fY * 1000)));
+ CPPUNIT_ASSERT_EQUAL(244261, static_cast<int>(round(fY * 1000)));
CPPUNIT_ASSERT(FPDFPathSegment_GetClose(pSegment));
}
}