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.
This commit is contained in:
Vadim Zeitlin 2019-07-17 19:37:13 +02:00
parent 9ad8b6d6b7
commit 08c7a0ca82

View File

@ -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);