vcl/qa/cppunit/pdfexport/pdfexport.cxx | 81 --------------------------------- 1 file changed, 81 deletions(-)
New commits: commit 29be4aa8c8ff24a33503f5d626a6e001a1f6ae78 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Wed Dec 23 22:11:05 2020 +0300 Commit: Vasily Melenchuk <vasily.melenc...@cib.de> CommitDate: Tue Dec 29 10:28:33 2020 +0300 vcl: removed unit test added during pdfium update Testcase was modified during pdfium update to 4021, but corresponding feature is not implemented in 6.3 yet, so better to remove that testcase completely as in original 6.3. Change-Id: Ia26c5717385fc95227d1d46f8df4a8b333ed7a05 diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx index 9714cb621b26..28b9fc9f3bcc 100644 --- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx +++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx @@ -1818,87 +1818,6 @@ void PdfExportTest::testTocLink() CPPUNIT_ASSERT(FPDFLink_Enumerate(pPdfPage.get(), &nStartPos, &pLinkAnnot)); } -void PdfExportTest::testPdfImageResourceInlineXObjectRef() -{ - // Create an empty document. - mxComponent = loadFromDesktop("private:factory/swriter"); - CPPUNIT_ASSERT(mxComponent.is()); - uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<text::XText> xText = xTextDocument->getText(); - uno::Reference<text::XTextCursor> xCursor = xText->createTextCursor(); - - // Insert the PDF image. - uno::Reference<lang::XMultiServiceFactory> xFactory(mxComponent, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xGraphicObject( - xFactory->createInstance("com.sun.star.text.TextGraphicObject"), uno::UNO_QUERY); - OUString aURL - = m_directories.getURLFromSrc(DATA_DIRECTORY) + "pdf-image-resource-inline-xobject-ref.pdf"; - xGraphicObject->setPropertyValue("GraphicURL", uno::makeAny(aURL)); - uno::Reference<drawing::XShape> xShape(xGraphicObject, uno::UNO_QUERY); - xShape->setSize(awt::Size(1000, 1000)); - uno::Reference<text::XTextContent> xTextContent(xGraphicObject, uno::UNO_QUERY); - xText->insertTextContent(xCursor->getStart(), xTextContent, /*bAbsorb=*/false); - - // Save as PDF. - uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); - utl::MediaDescriptor aMediaDescriptor; - aMediaDescriptor["FilterName"] <<= OUString("writer_pdf_Export"); - xStorable->storeToURL(maTempFile.GetURL(), aMediaDescriptor.getAsConstPropertyValueList()); - - // Init pdfium, vcl::ImportPDF() calls FPDF_DestroyLibrary after our setUp(). - FPDF_LIBRARY_CONFIG config; - config.version = 2; - config.m_pUserFontPaths = nullptr; - config.m_pIsolate = nullptr; - config.m_v8EmbedderSlot = 0; - FPDF_InitLibraryWithConfig(&config); - - // Parse the export result. - SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ); - maMemory.WriteStream(aFile); - DocumentHolder pPdfDocument( - FPDF_LoadMemDocument(maMemory.GetData(), maMemory.GetSize(), /*password=*/nullptr)); - CPPUNIT_ASSERT(pPdfDocument.get()); - CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get())); - - // Make sure that the page -> form -> form has a child image. - PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0)); - CPPUNIT_ASSERT(pPdfPage.get()); - CPPUNIT_ASSERT_EQUAL(1, FPDFPage_CountObjects(pPdfPage.get())); - FPDF_PAGEOBJECT pPageObject = FPDFPage_GetObject(pPdfPage.get(), 0); - CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pPageObject)); - CPPUNIT_ASSERT_EQUAL(1, FPDFFormObj_CountObjects(pPageObject)); - FPDF_PAGEOBJECT pFormObject = FPDFFormObj_GetObject(pPageObject, 0); - CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pFormObject)); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: 1 - // - Actual : 0 - // i.e. the sub-form was missing its image. - CPPUNIT_ASSERT_EQUAL(1, FPDFFormObj_CountObjects(pFormObject)); - - // Check if the inner form object (original page object in the pdf image) has the correct - // rotation. - FPDF_PAGEOBJECT pInnerFormObject = FPDFFormObj_GetObject(pFormObject, 0); - CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_FORM, FPDFPageObj_GetType(pInnerFormObject)); - CPPUNIT_ASSERT_EQUAL(1, FPDFFormObj_CountObjects(pInnerFormObject)); - FPDF_PAGEOBJECT pImage = FPDFFormObj_GetObject(pInnerFormObject, 0); - CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_IMAGE, FPDFPageObj_GetType(pImage)); - FS_MATRIX aMatrix; - FPDFFormObj_GetMatrix(pInnerFormObject, &aMatrix); - basegfx::B2DHomMatrix aMat{ aMatrix.a, aMatrix.c, aMatrix.e, aMatrix.b, aMatrix.d, aMatrix.f }; - basegfx::B2DTuple aScale; - basegfx::B2DTuple aTranslate; - double fRotate = 0; - double fShearX = 0; - aMat.decompose(aScale, aTranslate, fRotate, fShearX); - int nRotateDeg = basegfx::rad2deg(fRotate); - // Without the accompanying fix in place, this test would have failed with: - // - Expected: -90 - // - Actual : 0 - // i.e. rotation was lost on pdf export. - CPPUNIT_ASSERT_EQUAL(-90, nRotateDeg); -} - CPPUNIT_TEST_SUITE_REGISTRATION(PdfExportTest); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits