Open Bug 967105 Opened 6 years ago Updated 6 years ago

No good way to test print renderings

Categories

(Testing :: Reftest, enhancement)

enhancement
Not set

Tracking

(Not tracked)

People

(Reporter: zwol, Unassigned, NeedInfo)

References

(Blocks 1 open bug)

Details

+++ This bug was initially created as a clone of Bug #844473 +++

It is difficult to write tests for details of the print rendering of a document, e.g. the presence or absence of margin boxes.  Quoting bug 844473 comment 11:

> Hmm, creating a test is quite complicate.
> 
> moznomarginboxes influences the print settings when Print or PrintPreview
> gets called. (in a very odd way, and only then)
> 
> Reftest assumes currently fixed settings, and directly uses
> setPageMode(true, ps).
> So header and footer would need to be enabled for the first part and
> PrintPreview mode somehow activated.
> For the reference page the settings would need to be reset to zero, and
> again PrintPreview mode activated, then comparing both. 
> 
> Not sure how to write such code...
If anyone has any idea how this ought to work it would be dbaron.
Flags: needinfo?(dbaron)
No longer blocks: 743252
No longer depends on: 844473
Maybe there could be a way to have a way to select different print output "drivers" in FF?

One could be a simple image writer driven by the printer code. There is technical already code in each platform to create PDF Surfaces, only that on win32 you still need a working printer driver, because the PrintSettings depends on DevModes.

nsIPrintSettings::kOutputFormatImage
And then creating a new gfxImageSurface 

I think the whole nsPrintingSettings concept is a bit wrong. nsPrintingSettings should be platform independent, and internally call specific printer platform depending code. Much like the GFX Subsystem. So you can select on each platform "image writer" driver for test and a pdf writer without needing Win32 Printer Subsystem or GTK on linux.

The image data then could used to test output with a reference image.
Severity: normal → enhancement
Component: Print Preview → Reftest
OS: Windows 7 → All
Product: Core → Testing
Hardware: x86 → All
You need to log in before you can comment on or make changes to this bug.