summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorHossein <hossein@libreoffice.org>2021-11-29 14:43:36 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2021-11-30 11:25:04 +0100
commit20d5e320801606856c1d05c4f34d9fa82371aac8 (patch)
tree6dd924e1020c7c563b4abedaa1cf30a5100704c1 /vcl
parentcab4a0166a81749ba025be6e1ab39203bdee1e10 (diff)
tdf#145873 Fix FILEOPEN: EMF file not displayed #2
The previous patch 149bd802623d6d83ec9aa04514b938494f7f01f6 only partially fixed the problem, and the size of the graphical objects was wrongly calculated. This patch fixes this problem. The fix can be tested with: make CPPUNIT_TEST_NAME="testTdf145873" -sr \ CppunitTest_vcl_pdfexport This test exports the PPTX to PDF and checks the size of the objects. The previous test for this issue which exported to SVG is removed, as it could not test the current situation. Change-Id: I97bed99811eaf8236ded84ffe0c1a7d3d1b5bad5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125924 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek <gang65@poczta.onet.pl>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qa/cppunit/pdfexport/data/tdf145873.pptxbin0 -> 52342 bytes
-rw-r--r--vcl/qa/cppunit/pdfexport/pdfexport.cxx35
2 files changed, 35 insertions, 0 deletions
diff --git a/vcl/qa/cppunit/pdfexport/data/tdf145873.pptx b/vcl/qa/cppunit/pdfexport/data/tdf145873.pptx
new file mode 100644
index 000000000000..8a5eaa83824a
--- /dev/null
+++ b/vcl/qa/cppunit/pdfexport/data/tdf145873.pptx
Binary files differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 2ca8e3764a19..af5f396db14d 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -2837,6 +2837,41 @@ CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf144222)
#endif
}
+CPPUNIT_TEST_FIXTURE(PdfExportTest, testTdf145873)
+{
+ // Import the bugdoc and export as PDF.
+ aMediaDescriptor["FilterName"] <<= OUString("impress_pdf_Export");
+ saveAsPDF(u"tdf145873.pptx");
+
+ std::unique_ptr<vcl::pdf::PDFiumDocument> pPdfDocument = parseExport();
+ CPPUNIT_ASSERT(pPdfDocument);
+
+ // The document has one page.
+ CPPUNIT_ASSERT_EQUAL(1, pPdfDocument->getPageCount());
+
+ std::unique_ptr<vcl::pdf::PDFiumPage> pPdfPage = pPdfDocument->openPage(/*nIndex=*/0);
+ CPPUNIT_ASSERT(pPdfPage);
+ int nPageObjectCount = pPdfPage->getObjectCount();
+
+ // tdf#145873: Without the fix #1 in place, this test would have failed with
+ // - Expected: 318
+ // - Actual : 3
+ CPPUNIT_ASSERT_EQUAL(318, nPageObjectCount);
+
+ auto pObject = pPdfPage->getObject(4);
+ CPPUNIT_ASSERT_MESSAGE("no object", pObject != nullptr);
+
+ // tdf#145873: Without the fix #2 in place, this test would have failed with
+ // - Expected: 3.23
+ // - Actual : 3.57...
+ // - Delta : 0.1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.23, pObject->getBounds().getWidth(), 0.1);
+ // - Expected: 3.49
+ // - Actual : 3.74...
+ // - Delta : 0.1
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3.49, pObject->getBounds().getHeight(), 0.1);
+}
+
} // end anonymous namespace
CPPUNIT_PLUGIN_IMPLEMENT();