[Libreoffice-commits] core.git: Branch 'libreoffice-6-2' - 2 commits - vcl/qa vcl/unx
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Sat Jan 26 10:44:34 UTC 2019
vcl/qa/cppunit/pdfexport/data/softhyphen_pdf.odt |binary
vcl/qa/cppunit/pdfexport/pdfexport.cxx | 61 +++++++++++++++++++++++
vcl/unx/generic/printer/printerinfomanager.cxx | 3 +
3 files changed, 64 insertions(+)
New commits:
commit 897c6db9c88b9c60bec9be04026f0a0798f2207e
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jan 23 16:25:09 2019 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Jan 26 11:44:24 2019 +0100
tdf#96892 vcl: add unit test for misplaced soft-hyphen ...
... due to incorrectly exported font size.
Change-Id: If06dccc000530427be767fc7a5031f5ebe6fd431
Reviewed-on: https://gerrit.libreoffice.org/66803
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
(cherry picked from commit fddd956c0cf3b2c22a152bbb30554def1336b466)
Reviewed-on: https://gerrit.libreoffice.org/66853
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/vcl/qa/cppunit/pdfexport/data/softhyphen_pdf.odt b/vcl/qa/cppunit/pdfexport/data/softhyphen_pdf.odt
new file mode 100644
index 000000000000..ecd779537788
Binary files /dev/null and b/vcl/qa/cppunit/pdfexport/data/softhyphen_pdf.odt differ
diff --git a/vcl/qa/cppunit/pdfexport/pdfexport.cxx b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
index 04b7309b5cd4..325b07ae8aa5 100644
--- a/vcl/qa/cppunit/pdfexport/pdfexport.cxx
+++ b/vcl/qa/cppunit/pdfexport/pdfexport.cxx
@@ -88,6 +88,7 @@ public:
void testForcePoint71();
void testTdf106972();
void testTdf106972Pdf17();
+ void testSofthyphenPos();
void testTdf107013();
void testTdf107018();
void testTdf107089();
@@ -128,6 +129,7 @@ public:
CPPUNIT_TEST(testForcePoint71);
CPPUNIT_TEST(testTdf106972);
CPPUNIT_TEST(testTdf106972Pdf17);
+ CPPUNIT_TEST(testSofthyphenPos);
CPPUNIT_TEST(testTdf107013);
CPPUNIT_TEST(testTdf107018);
CPPUNIT_TEST(testTdf107089);
@@ -599,6 +601,65 @@ void PdfExportTest::testTdf106972Pdf17()
CPPUNIT_ASSERT(pXObject->Lookup("Resources"));
}
+void PdfExportTest::testSofthyphenPos()
+{
+ // No need to run it on Windows, since it would use GDI printing, and not
+ // trigger PDF export which is the intent of the test.
+ // FIXME: Why does this fail on macOS?
+#if !defined MACOSX && !defined _WIN32
+ // Import the bugdoc and print to PDF.
+ OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "softhyphen_pdf.odt";
+ mxComponent = loadFromDesktop(aURL);
+ CPPUNIT_ASSERT(mxComponent.is());
+
+ uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
+ uno::Reference<view::XPrintable> xPrintable(mxComponent, uno::UNO_QUERY);
+ CPPUNIT_ASSERT(xPrintable.is());
+ uno::Sequence<beans::PropertyValue> aOptions(comphelper::InitPropertySequence(
+ {
+ {"FileName", uno::makeAny(maTempFile.GetURL())},
+ {"Wait", uno::makeAny(true)}
+ }));
+ xPrintable->print(aOptions);
+
+ // Parse the export result with pdfium.
+ SvFileStream aFile(maTempFile.GetURL(), StreamMode::READ);
+ SvMemoryStream aMemory;
+ aMemory.WriteStream(aFile);
+ if (aFile.bad())
+ {
+ // Printing to PDF failed in a non-interesting way, e.g. CUPS is not
+ // running, there is no printer defined, etc.
+ return;
+ }
+ DocumentHolder pPdfDocument(FPDF_LoadMemDocument(aMemory.GetData(), aMemory.GetSize(), /*password=*/nullptr));
+ CPPUNIT_ASSERT(pPdfDocument);
+
+ // The document has one page.
+ CPPUNIT_ASSERT_EQUAL(1, FPDF_GetPageCount(pPdfDocument.get()));
+ PageHolder pPdfPage(FPDF_LoadPage(pPdfDocument.get(), /*page_index=*/0));
+ CPPUNIT_ASSERT(pPdfPage.get());
+
+ // tdf#96892 incorrect fractional part of font size caused soft-hyphen to
+ // be positioned inside preceding text (incorrect = 11.1, correct = 11.05)
+
+ // there are 3 texts currently, for line 1, soft-hyphen, line 2
+ bool haveText(false);
+
+ int nPageObjectCount = FPDFPage_CountObjects(pPdfPage.get());
+ for (int i = 0; i < nPageObjectCount; ++i)
+ {
+ FPDF_PAGEOBJECT pPdfPageObject = FPDFPage_GetObject(pPdfPage.get(), i);
+ CPPUNIT_ASSERT_EQUAL(FPDF_PAGEOBJ_TEXT, FPDFPageObj_GetType(pPdfPageObject));
+ haveText = true;
+ double const size(FPDFTextObj_GetFontSize(pPdfPageObject));
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(11.05, size, 1E-06);
+ }
+
+ CPPUNIT_ASSERT(haveText);
+#endif
+}
+
void PdfExportTest::testTdf107013()
{
vcl::filter::PDFDocument aDocument;
commit 15bc758d0eff24610867e2905236c4241305e2ed
Author: Michael Stahl <Michael.Stahl at cib.de>
AuthorDate: Wed Jan 23 16:23:18 2019 +0100
Commit: Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Sat Jan 26 11:44:14 2019 +0100
vcl: unx: apply configuration to "Generic Printer" so it's PDF ...
... by default, instead of leaving it with
m_nPSLevel == 0 && m_nPDFDevice == 0.
Change-Id: I44059ac39791442602cbc48582670d98edc578ee
Reviewed-on: https://gerrit.libreoffice.org/66802
Tested-by: Jenkins
Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
(cherry picked from commit c8dd1c22d7512d4922461350c6cb804cd0864e0b)
Reviewed-on: https://gerrit.libreoffice.org/66850
Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx
index 9c1007cdcd09..087289d2b301 100644
--- a/vcl/unx/generic/printer/printerinfomanager.cxx
+++ b/vcl/unx/generic/printer/printerinfomanager.cxx
@@ -460,6 +460,9 @@ void PrinterInfoManager::initialize()
setDefaultPaper( aPrinter.m_aInfo.m_aContext );
+ // if it's a "Generic Printer", apply defaults from config...
+ aPrinter.m_aInfo.resolveDefaultBackend();
+
// finally insert printer
FileBase::getFileURLFromSystemPath( aFile.PathToFileName(), aPrinter.m_aFile );
aPrinter.m_aGroup = aConfig.GetGroupName( nGroup );
More information about the Libreoffice-commits
mailing list