From 566e401a3fc345900cc7f0e876d08285a6d6ff0a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 20 Jun 2018 01:03:20 +0200 Subject: [PATCH 01/11] Add support for style="page-break-inside:avoid" to wxHTML Allow using this style to prevent page breaks inside the given
. --- docs/changes.txt | 1 + src/html/m_layout.cpp | 6 ++++ tests/html/htmprint.cpp | 68 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 75 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index 7936144c7b..39e2e4eb6a 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -102,6 +102,7 @@ All (GUI): - Add wxHtmlEasyPrinting::SetPromptMode() (pavel-t). - Fix possible infinite loop in wxHtmlWindow layout (trivia21). - Add "hint" property support to XRC for wxComboBox and wxSearchCtrl. +- Add support for style="page-break-inside:avoid" to
in wxHTML. wxGTK: diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index 95b0afbab2..e8f849b86f 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -187,6 +187,12 @@ TAG_HANDLER_BEGIN(DIV, "DIV") m_WParser->OpenContainer(); return false; } + else if(style.IsSameAs(wxT("PAGE-BREAK-INSIDE:AVOID"), false)) + { + m_WParser->CloseContainer(); + m_WParser->OpenContainer()->SetCanLiveOnPagebreak(false); + return false; + } else { // Treat other STYLE parameters here when they're supported. diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 34560d9cb8..2b7f6e561a 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -107,6 +107,74 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") "
" ); CHECK( CountPages(pr) == 2 ); + + // Also test that forbidding page breaks inside a paragraph works: it + // should move it entirely to the next page, resulting in one extra page + // compared to the version without "page-break-inside: avoid". + static const char* const text = +"Early in the morning on the fourteenth of the spring month of Nisan the " +"Procurator of Judea, Pontius Pilate, in a white cloak lined with blood red, " +"emerged with his shuffling cavalryman's walk into the arcade connecting the two " +"wings of the palace of Herod the Great. " +"\n" +"More than anything else in the world the Procurator hated the smell of attar of " +"roses. The omens for the day were bad, as this scent had been haunting him " +"since dawn. " +"\n" +"It seemed to the Procurator that the very cypresses and palms in the garden " +"were exuding the smell of roses, that this damned stench of roses was even " +"mingling with the smell of leather tackle and sweat from his mounted bodyguard. " +"\n" +"A haze of smoke was drifting toward the arcade across the upper courtyard of " +"the garden, coming from the wing at the rear of the palace, the quarters of the " +"first cohort of the XII Legion; known as the \"Lightning,\" it had been " +"stationed in Jerusalem since the Procurator's arrival. The same oily perfume " +"of roses was mixed with the acrid smoke that showed that the centuries' cooks " +"had started to prepare breakfast " +"\n" +"\"Oh, gods, what are you punishing me for?.. No, there's no doubt, I have it " +"again, this terrible incurable pain... hemicrania, when half the head aches... " +"There's no cure for it, nothing helps... I must try not to move my head...\" " +"\n" +"A chair had already been placed on the mosaic floor by the fountain; without a " +"glance around, the Procurator sat in it and stretched out his hand to one side. " +"His secretary deferentially laid a piece of parchment in his hand. Unable to " +"restrain a grimace of agony, the Procurator gave a fleeting sideways look at " +"its contents, returned the parchment to his secretary and said painfully, \"The " +"accused comes from Galilee, does he? Was the case sent to the tetrarch?\" " +"\n" +"\"Yes, Procurator,\" replied the secretary. \"He declined to confirm the " +"finding of the court and passed the Sanhedrin's sentence of death to you for " +"confirmation.\" " +"\n" +"The Procurator's cheek twitched, and he said quietly, \"Bring in the accused.\" " + ; + + pr.SetHtmlText + ( + wxString::Format + ( + "" + "
%s
" + "
" + "", + text + ) + ); + CHECK( CountPages(pr) == 2 ); + + pr.SetHtmlText + ( + wxString::Format + ( + "" + "
%s
" + "
" + "", + text + ) + ); + CHECK( CountPages(pr) == 3 ); } #endif //wxUSE_HTML From 905789485a02b425356d2c9d3b4331f78aaa368e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 20 Jun 2018 14:38:45 +0200 Subject: [PATCH 02/11] Fix the just added pagination test for high DPI systems Adjust the font size used by a DPI-dependent factor to ensure that the text takes the same amount of pixels independently of DPI. --- tests/html/htmprint.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 2b7f6e561a..9d805f4862 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -22,6 +22,9 @@ #include "wx/dcmemory.h" #endif // WX_PRECOMP +#include "wx/app.h" +#include "wx/window.h" + #include "wx/html/htmprint.h" namespace @@ -59,6 +62,12 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") // the DPI-dependent factor, but it doesn't seem to be worth doing it). pr.SetMargins(0, 0, 0, 0, 0); + // We do need to use DPI-proportional font sizes in order for the text used + // in the page-break-inside:avoid test to take the same amount of pixels + // for any DPI (12 being the font size used by wxHtmlDCRenderer by default). + const int adjFontSize = 12*wxTheApp->GetTopWindow()->GetContentScaleFactor(); + pr.SetStandardFonts(adjFontSize); + wxBitmap bmp(1000, 1000); wxMemoryDC dc(bmp); pr.SetUp(dc); @@ -174,6 +183,7 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") text ) ); + INFO("Using base font size " << adjFontSize); CHECK( CountPages(pr) == 3 ); } From 0393940033976973c76bab8997112a2c7383e459 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 20 Jun 2018 23:34:42 +0200 Subject: [PATCH 03/11] Add temporary debugging code for HTML pagination test failure --- .travis.yml | 1 - appveyor.yml | 19 ------------------- src/html/htmprint.cpp | 2 ++ 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 790f5aca76..aa86540a5e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,6 @@ matrix: branches: only: - - master - WX_3_0_BRANCH notifications: diff --git a/appveyor.yml b/appveyor.yml index 5b3d335e05..1361fa8a23 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,25 +17,6 @@ environment: CONFIGURATION: DLL Release ARCH: x64 wxUSE_STL: 1 - - TOOLSET: nmake - VS: '9.0' - BUILD: release - ARCH: x86 - wxUSE_STL: 0 - - TOOLSET: nmake - VS: '14.0' - BUILD: debug - ARCH: amd64 - wxUSE_STL: 1 - - TOOLSET: mingw - wxUSE_STL: 0 - - TOOLSET: msys2 - MSYSTEM: MINGW32 - - TOOLSET: cygwin - - TOOLSET: cmake - GENERATOR: 'Visual Studio 12' - SHARED: ON - CONFIGURATION: Release clone_depth: 50 diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index ba1f31b016..4de883fc2c 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -33,6 +33,7 @@ #include "wx/wfstream.h" #include "wx/infobar.h" +#include "wx/crt.h" // default font size of normal text (HTML font size 0) for printing, in points: #define DEFAULT_PRINT_FONT_SIZE 12 @@ -159,6 +160,7 @@ int wxHtmlDCRenderer::FindNextPageBreak(int pos) const wxCHECK_MSG( posNext > pos, wxNOT_FOUND, "Bug in AdjustPagebreak()" ); } + wxPrintf("HTML-DEBUG: Next page break after %d is %d\n", pos, posNext); return posNext; } From 96cca103281f6e2615877df0e48ed959b63499b7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Jun 2018 01:39:04 +0200 Subject: [PATCH 04/11] Use fixed font name in the HTML pagination test --- tests/html/htmprint.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 9d805f4862..3ee81ca1d6 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -66,7 +66,7 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") // in the page-break-inside:avoid test to take the same amount of pixels // for any DPI (12 being the font size used by wxHtmlDCRenderer by default). const int adjFontSize = 12*wxTheApp->GetTopWindow()->GetContentScaleFactor(); - pr.SetStandardFonts(adjFontSize); + pr.SetStandardFonts(adjFontSize, "Helvetica"); wxBitmap bmp(1000, 1000); wxMemoryDC dc(bmp); From 1ce009e73ae605e57e84c61be865a59c124a43a2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 21 Jun 2018 16:50:59 +0200 Subject: [PATCH 05/11] Add even more debug output to the test --- tests/html/htmprint.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 3ee81ca1d6..c4a1812212 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -183,7 +183,9 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") text ) ); - INFO("Using base font size " << adjFontSize); + const wxSize ext = dc.GetTextExtent("Something"); + WARN("Using base font size " << adjFontSize + << ", text extent of \"Something\" is " << ext.x << "x" << ext.y); CHECK( CountPages(pr) == 3 ); } From 321854b5193b8025cce2ca76302aff9d96a105c8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 22 Jul 2018 00:54:05 +0200 Subject: [PATCH 06/11] Try using fixed font size in pixels in the test --- tests/html/htmprint.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index c4a1812212..11dcc10c7a 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -65,8 +65,8 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") // We do need to use DPI-proportional font sizes in order for the text used // in the page-break-inside:avoid test to take the same amount of pixels // for any DPI (12 being the font size used by wxHtmlDCRenderer by default). - const int adjFontSize = 12*wxTheApp->GetTopWindow()->GetContentScaleFactor(); - pr.SetStandardFonts(adjFontSize, "Helvetica"); + const wxFont fontFixedPixelSize(wxFontInfo(wxSize(10, 16))); + pr.SetStandardFonts(fontFixedPixelSize.GetPointSize(), "Helvetica"); wxBitmap bmp(1000, 1000); wxMemoryDC dc(bmp); @@ -184,7 +184,7 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") ) ); const wxSize ext = dc.GetTextExtent("Something"); - WARN("Using base font size " << adjFontSize + WARN("Using base font size " << fontFixedPixelSize.GetPointSize() << ", text extent of \"Something\" is " << ext.x << "x" << ext.y); CHECK( CountPages(pr) == 3 ); } From 542124aa95c8ce13559de0b54ff61daae01899f7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Jul 2018 02:23:02 +0200 Subject: [PATCH 07/11] Fix page-break-inside:avoid to work for nested tags too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The initial version was too naïve and didn't work correctly if the
with this style had nested elements. --- samples/html/printing/test.htm | 11 +++++ src/html/m_layout.cpp | 27 +++++++++++- tests/html/htmprint.cpp | 80 +++++++++++++++++----------------- 3 files changed, 76 insertions(+), 42 deletions(-) diff --git a/samples/html/printing/test.htm b/samples/html/printing/test.htm index 3bb5be3a20..c0518a8d00 100644 --- a/samples/html/printing/test.htm +++ b/samples/html/printing/test.htm @@ -55,6 +55,8 @@ is split into base and GUI libraries.

+ +

Release 2.1.11 (final)

    @@ -71,18 +73,22 @@ combined base/GUI library for GUI applications only.
  • Rewritten timer.cpp, possible wxChrono class.
  • Bug tracking system in place.
+

+

Release 2.1.12

  • Release date: January 9th, 2000
  • Miscellaneous fixes and small enhancements.
+

+

Release 2.1.13

    @@ -90,6 +96,7 @@ combined base/GUI library for GUI applications only.
  • Miscellaneous fixes and small enhancements.
  • wxDateTime class in beta.
+

@@ -102,6 +109,7 @@ combined base/GUI library for GUI applications only.

+

Release 2.2.x (final)

    @@ -109,15 +117,18 @@ combined base/GUI library for GUI applications only.
  • Unicode compilation working in wxGTK and wxMSW.
  • wxDateTime class.
+

+

Release 2.3.x (final)

  • Release date: unknown
  • WinCE port available.
+

diff --git a/src/html/m_layout.cpp b/src/html/m_layout.cpp index e8f849b86f..5556c34396 100644 --- a/src/html/m_layout.cpp +++ b/src/html/m_layout.cpp @@ -189,9 +189,32 @@ TAG_HANDLER_BEGIN(DIV, "DIV") } else if(style.IsSameAs(wxT("PAGE-BREAK-INSIDE:AVOID"), false)) { + // As usual, reuse the current container if it's empty. + wxHtmlContainerCell *c = m_WParser->GetContainer(); + if (c->GetFirstChild() != NULL) + { + // If not, open a new one. + m_WParser->CloseContainer(); + c = m_WParser->OpenContainer(); + } + + // Force this container to live entirely on the same page. + c->SetCanLiveOnPagebreak(false); + + // Use a nested container so that nested tags that close and + // reopen a container again close this one, but still remain + // inside the outer "unbreakable" container. + m_WParser->OpenContainer(); + + ParseInner(tag); + + // Close both the inner and the outer containers and reopen the + // new current one. m_WParser->CloseContainer(); - m_WParser->OpenContainer()->SetCanLiveOnPagebreak(false); - return false; + m_WParser->CloseContainer(); + m_WParser->OpenContainer(); + + return true; } else { diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 11dcc10c7a..72c33c6980 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -121,52 +121,52 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") // should move it entirely to the next page, resulting in one extra page // compared to the version without "page-break-inside: avoid". static const char* const text = -"Early in the morning on the fourteenth of the spring month of Nisan the " -"Procurator of Judea, Pontius Pilate, in a white cloak lined with blood red, " -"emerged with his shuffling cavalryman's walk into the arcade connecting the two " -"wings of the palace of Herod the Great. " -"\n" -"More than anything else in the world the Procurator hated the smell of attar of " -"roses. The omens for the day were bad, as this scent had been haunting him " -"since dawn. " -"\n" -"It seemed to the Procurator that the very cypresses and palms in the garden " -"were exuding the smell of roses, that this damned stench of roses was even " -"mingling with the smell of leather tackle and sweat from his mounted bodyguard. " -"\n" -"A haze of smoke was drifting toward the arcade across the upper courtyard of " -"the garden, coming from the wing at the rear of the palace, the quarters of the " -"first cohort of the XII Legion; known as the \"Lightning,\" it had been " -"stationed in Jerusalem since the Procurator's arrival. The same oily perfume " -"of roses was mixed with the acrid smoke that showed that the centuries' cooks " -"had started to prepare breakfast " -"\n" -"\"Oh, gods, what are you punishing me for?.. No, there's no doubt, I have it " -"again, this terrible incurable pain... hemicrania, when half the head aches... " -"There's no cure for it, nothing helps... I must try not to move my head...\" " -"\n" -"A chair had already been placed on the mosaic floor by the fountain; without a " -"glance around, the Procurator sat in it and stretched out his hand to one side. " -"His secretary deferentially laid a piece of parchment in his hand. Unable to " -"restrain a grimace of agony, the Procurator gave a fleeting sideways look at " -"its contents, returned the parchment to his secretary and said painfully, \"The " -"accused comes from Galilee, does he? Was the case sent to the tetrarch?\" " -"\n" -"\"Yes, Procurator,\" replied the secretary. \"He declined to confirm the " -"finding of the court and passed the Sanhedrin's sentence of death to you for " -"confirmation.\" " -"\n" -"The Procurator's cheek twitched, and he said quietly, \"Bring in the accused.\" " +"Early in the morning on the fourteenth of the spring month of Nisan the
" +"Procurator of Judea, Pontius Pilate, in a white cloak lined with blood red,
" +"emerged with his shuffling cavalryman's walk into the arcade connecting the two
" +"wings of the palace of Herod the Great.
" +"
" +"More than anything else in the world the Procurator hated the smell of attar of
" +"roses. The omens for the day were bad, as this scent had been haunting him
" +"since dawn.
" +"
" +"It seemed to the Procurator that the very cypresses and palms in the garden
" +"were exuding the smell of roses, that this damned stench of roses was even
" +"mingling with the smell of leather tackle and sweat from his mounted bodyguard.
" +"
" +"A haze of smoke was drifting toward the arcade across the upper courtyard of
" +"the garden, coming from the wing at the rear of the palace, the quarters of the
" +"first cohort of the XII Legion; known as the \"Lightning,\" it had been
" +"stationed in Jerusalem since the Procurator's arrival. The same oily perfume
" +"of roses was mixed with the acrid smoke that showed that the centuries' cooks
" +"had started to prepare breakfast
" +"
" +"\"Oh, gods, what are you punishing me for?.. No, there's no doubt, I have it
" +"again, this terrible incurable pain... hemicrania, when half the head aches...
" +"There's no cure for it, nothing helps... I must try not to move my head...\"
" +"
" +"A chair had already been placed on the mosaic floor by the fountain; without a
" +"glance around, the Procurator sat in it and stretched out his hand to one side.
" +"His secretary deferentially laid a piece of parchment in his hand. Unable to
" +"restrain a grimace of agony, the Procurator gave a fleeting sideways look at
" +"its contents, returned the parchment to his secretary and said painfully, \"The
" +"accused comes from Galilee, does he? Was the case sent to the tetrarch?\"
" +"
" +"\"Yes, Procurator,\" replied the secretary. \"He declined to confirm the
" +"finding of the court and passed the Sanhedrin's sentence of death to you for
" +"confirmation.\"
" +"
" +"The Procurator's cheek twitched, and he said quietly, \"Bring in the accused.\"
" ; pr.SetHtmlText ( wxString::Format ( - "" + "" "

%s
" "
" - "", + "", text ) ); @@ -176,10 +176,10 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") ( wxString::Format ( - "" + "" "
%s
" "
" - "", + "", text ) ); From 6acd663190592e0998c65fb1515a68eb57a28283 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Jul 2018 13:47:13 +0200 Subject: [PATCH 08/11] Revert "Add even more debug output to the test" This reverts commit 1ce009e73ae605e57e84c61be865a59c124a43a2 as AppVeyor test failures problem is fixed now. --- tests/html/htmprint.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 72c33c6980..05c27b42bf 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -183,9 +183,7 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") text ) ); - const wxSize ext = dc.GetTextExtent("Something"); - WARN("Using base font size " << fontFixedPixelSize.GetPointSize() - << ", text extent of \"Something\" is " << ext.x << "x" << ext.y); + INFO("Using base font size " << fontFixedPixelSize.GetPointSize()); CHECK( CountPages(pr) == 3 ); } From 78edf14c889ec4f22136af69886ccdbb4f716080 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Jul 2018 13:47:43 +0200 Subject: [PATCH 09/11] Revert "Add temporary debugging code for HTML pagination test failure" This reverts commit 0393940033976973c76bab8997112a2c7383e459 which is not needed any longer after fixing AppVeyor test failure. --- .travis.yml | 1 + appveyor.yml | 19 +++++++++++++++++++ src/html/htmprint.cpp | 2 -- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa86540a5e..790f5aca76 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,6 +33,7 @@ matrix: branches: only: + - master - WX_3_0_BRANCH notifications: diff --git a/appveyor.yml b/appveyor.yml index 1361fa8a23..5b3d335e05 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,6 +17,25 @@ environment: CONFIGURATION: DLL Release ARCH: x64 wxUSE_STL: 1 + - TOOLSET: nmake + VS: '9.0' + BUILD: release + ARCH: x86 + wxUSE_STL: 0 + - TOOLSET: nmake + VS: '14.0' + BUILD: debug + ARCH: amd64 + wxUSE_STL: 1 + - TOOLSET: mingw + wxUSE_STL: 0 + - TOOLSET: msys2 + MSYSTEM: MINGW32 + - TOOLSET: cygwin + - TOOLSET: cmake + GENERATOR: 'Visual Studio 12' + SHARED: ON + CONFIGURATION: Release clone_depth: 50 diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp index 4de883fc2c..ba1f31b016 100644 --- a/src/html/htmprint.cpp +++ b/src/html/htmprint.cpp @@ -33,7 +33,6 @@ #include "wx/wfstream.h" #include "wx/infobar.h" -#include "wx/crt.h" // default font size of normal text (HTML font size 0) for printing, in points: #define DEFAULT_PRINT_FONT_SIZE 12 @@ -160,7 +159,6 @@ int wxHtmlDCRenderer::FindNextPageBreak(int pos) const wxCHECK_MSG( posNext > pos, wxNOT_FOUND, "Bug in AdjustPagebreak()" ); } - wxPrintf("HTML-DEBUG: Next page break after %d is %d\n", pos, posNext); return posNext; } From 0338796847d28e547b2fd994275d23fa40ca6efa Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Jul 2018 13:49:00 +0200 Subject: [PATCH 10/11] Remove unnecessary headers from wxHtmlPrintout unit test These headers were added by 905789485a02b425356d2c9d3b4331f78aaa368e which was replaced with 321854b5193b8025cce2ca76302aff9d96a105c8 later and are not needed any more. --- tests/html/htmprint.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 05c27b42bf..0209ecfe4d 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -22,9 +22,6 @@ #include "wx/dcmemory.h" #endif // WX_PRECOMP -#include "wx/app.h" -#include "wx/window.h" - #include "wx/html/htmprint.h" namespace From 9e05eb42b5eb3bfa6c35e9469894fc2eeb4cbf9a Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 25 Jul 2018 13:52:49 +0200 Subject: [PATCH 11/11] Fix outdated comment in wxHtmlPrintout unit test This should have been part of 321854b5193b8025cce2ca76302aff9d96a105c8 which changed the code, but not the accompanying comment. --- tests/html/htmprint.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/html/htmprint.cpp b/tests/html/htmprint.cpp index 0209ecfe4d..64ce4b144e 100644 --- a/tests/html/htmprint.cpp +++ b/tests/html/htmprint.cpp @@ -59,9 +59,14 @@ TEST_CASE("wxHtmlPrintout::Pagination", "[html][print]") // the DPI-dependent factor, but it doesn't seem to be worth doing it). pr.SetMargins(0, 0, 0, 0, 0); - // We do need to use DPI-proportional font sizes in order for the text used - // in the page-break-inside:avoid test to take the same amount of pixels - // for any DPI (12 being the font size used by wxHtmlDCRenderer by default). + // Use font size in pixels to make it DPI-independent: if we just used a + // normal (say 12pt) font, it would have different height in pixels on 96 + // and 200 DPI systems, meaning that the text at the end of this test would + // take different number of (fixed to 1000px height) pages. + // + // We could also make the page height proportional to the DPI, but this + // would be more complicated as we also wouldn't be able to use hardcoded + // height attribute values in the HTML snippets below then. const wxFont fontFixedPixelSize(wxFontInfo(wxSize(10, 16))); pr.SetStandardFonts(fontFixedPixelSize.GetPointSize(), "Helvetica");