[webkit-qt] printing unit tests

Milian Wolff milian.wolff at kdab.com
Fri Apr 13 04:25:13 PDT 2012


On Thursday 12 April 2012 09:49:18 Simon Hausmann wrote:
> 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.
> 
> Excellent!
> 
> > 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
> :)

There are lots of expected images as well, but only for some ports, mostly mac 
and chromium under LayoutTests/platform/*/printing/

> > 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.

This would also explain why the Qt port has its own share of printing bugs ;-)

See below:

> 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.

Most importantly it's missing to pass the page height to PrintContext::begin 
in QWebFrame::print. This leads to e.g. improper layouting for all the page-
break-* css attributes - the unit tests are not run after all... So yeah that 
is a low-hanging fruit but just fixing it would imo not be enough. Instead, 
the unit tests should be run properly to find all the other outstanding bugs 
and missing functionality.

One thing that comes to mind is the CSS3 Paged Media module support. See e.g.:

https://bugs.webkit.org/show_bug.cgi?id=15548

As you can see, there is actually quite some stuff already in WebKit, but the 
Qt support does not handle any of these things yet.

The CSS3 Paged media module would also be something I'd like to work on in the 
long run. To get patches upstream though, I need to have unit tests. Since the 
Qt port is my port of choice, I need the test suite fully functional there...

> Along the same lines WebKitTestRunner is missing printing support, causing
> us to skip all printing tests with WebKit2. See also
> 
> 	https://bugs.webkit.org/show_bug.cgi?id=42693

Thanks

-- 
Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel. Germany +49-30-521325470, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120413/43414228/attachment.bin>


More information about the webkit-qt mailing list