From 08c7a0ca82e2146453061484655727614793cbef Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 17 Jul 2019 19:37:13 +0200 Subject: [PATCH] Hack to make wxHtmlPrintout unit test pass under wxGTK3 Set the "printer" PPI explicitly for wxMemoryDC used in the test to ensure that it's the same in all ports: currently wxGTK3 stands out because it uses 72 DPI unlike wxMSW and wxGTK2, which use 96. --- tests/html/htmprint.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 64ce4b144e..313e48bffd 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -70,6 +70,15 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") const wxFont fontFixedPixelSize(wxFontInfo(wxSize(10, 16))); pr.SetStandardFonts(fontFixedPixelSize.GetPointSize(), "Helvetica"); + // We currently have to do this with wxGTK3 which uses 72 DPI for its + // wxMemoryDC, resulting in 3/4 scaling (because screen DPI is hardcoded as + // 96 in src/html/htmprint.cpp), when rendering onto it. This makes the + // tests pass, but really shouldn't be necessary. Unfortunately it's not + // clear where and how should this be fixed. +#ifdef __WXGTK3__ + pr.SetPPIPrinter(wxSize(96, 96)); +#endif + wxBitmap bmp(1000, 1000); wxMemoryDC dc(bmp); pr.SetUp(dc);