[webkit-qt] printing unit tests

Simon Hausmann simon.hausmann at nokia.com
Thu Apr 12 00:49:18 PDT 2012

On Wednesday, April 11, 2012 08:05:39 PM ext Milian Wolff wrote:
> Hey all,
> I'm interested in improving the printing support of the QtWebKit port.

> I notice that a lot of unit tests are skipped and that apparently
> isPrinting() is not implemented/handled at all yet.
> For quite some time now I'm trying to figure out what exactly would be
> required to get this done but it seems to be far from easy... Is there any
> documentation besides the chromium spagetthi test code on how the output
> should look like or when to output what (image, text, both, ...)?

AFAICS most of the tests (LayoutTests/printing/*-expected* files) verify page 
breaks and margins using LayoutTestController hooks. I do see two PDFs as 
expected output, but I don't think we can make Qt output exactly those :)

> As far as I can see, I will probably have to handle the isPrinting() mode in
> DumpRenderTreeQt.cpp ~ ::dump() in the if(m_dumpPixels) branch. Currently,
> that only paints the viewportSize() to an image. If I'm not mistaken, one
> needs to create a copy or QWebFrame::print, similar to chromiums'
> WebViewHost::paintPagesWithBoundaries. But what are the requirements on the
> output? Is there *any* documentation on what the tests should output?
> Also, is it correct that such tests should be run with "--pixel-tests"?
> If I run e.g.
> python Tools/Scripts/new-run-webkit-tests LayoutTests/printing \
>   --child-processes=1 --qt --verbose -p
> this creates also images for tests which are not expected to create any
> images (like e.g. LayoutTests/printing/page-break-widows.html). How is this
> supposed to be handled, do the test bots know which test to run with with
> arguments? If I look at the TestShell.cpp code from chromium, I'm guessing
> that tests which output text should not output images (TestShell::dump ->
> shouldGeneratePixelResults) - do I interpret this correctly?

Ahh, now I see. Well, currently we don't generally work with pixel tests to be 
honest, largely because they require a lot of effort to maintain.

On a bigger scale, what would you like to improve with regards to printing? 
Any work towards improving our test coverage would be great IMHO, I believe we 
do skip some tests. There might be low-hanging fruit. 

Along the same lines WebKitTestRunner is missing printing support, causing us 
to skip all printing tests with WebKit2. See also



More information about the webkit-qt mailing list