Changeset 35078 in webkit


Ignore:
Timestamp:
Jul 9, 2008 4:17:50 PM (16 years ago)
Author:
eric@webkit.org
Message:

Updated printing test patch

Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r35076 r35078  
     12008-07-09  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by aroben.
     4
     5        * platform/mac/printing: Added.
     6        * platform/mac/printing/media-queries-print-expected.txt: Added.
     7        * platform/qt/Skipped: skip printing and webarchives
     8        * platform/win/Skipped: skip printing tests
     9        * printing: Added.
     10        * printing/media-queries-print.html: Added.
     11
    1122008-07-09  Eric Seidel  <eric@webkit.org>
    213
  • trunk/LayoutTests/platform/gtk/Skipped

    r34776 r35078  
    88# Missing AccessibilityController implementation
    99accessibility
     10printing
  • trunk/LayoutTests/platform/qt/Skipped

    r34776 r35078  
    11# ------- missing features in DRT
    22accessibility
     3printing
    34editing/selection/4975120.html
    45editing/selection/5109817.html
     
    865866svg/hixie/viewbox/preserveAspectRatio/001.xml
    866867svg/hixie/viewbox/preserveAspectRatio/002.xml
    867 webarchive/archive-empty-frame-dom.html
    868 webarchive/archive-empty-frame-source.html
    869 webarchive/archive-with-unencoded-url.html
    870 webarchive/test-body-background.html
    871 webarchive/test-duplicate-resources.html
    872 webarchive/test-frameset.html
    873 webarchive/test-img-src.html
    874 webarchive/test-input-src.html
    875 webarchive/test-link-href.html
    876 webarchive/test-object-data.html
    877 webarchive/test-script-src.html
    878 webarchive/test-table-background.html
    879 webarchive/test-td-background.html
    880 webarchive/loading/test-loading-archive.html
    881868
    882869# ------- <video> support
  • trunk/LayoutTests/platform/win/Skipped

    r34794 r35078  
    408408# Still need to implement AccessibilityController for DumpRenderTree on Windows
    409409accessibility
     410
     411# No support for print-to-pdf in Windows DRT
     412printing
     413
  • trunk/WebKitTools/ChangeLog

    r35076 r35078  
     12008-07-09  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by aroben.
     4
     5        * DumpRenderTree/LayoutTestController.cpp:
     6        (LayoutTestController::LayoutTestController):
     7        (dumpAsPDFCallback):
     8        (LayoutTestController::staticFunctions):
     9        * DumpRenderTree/LayoutTestController.h:
     10        (LayoutTestController::dumpAsPDF):
     11        (LayoutTestController::setDumpAsPDF):
     12        * DumpRenderTree/mac/DumpRenderTree.mm:
     13        (dumpFrameAsPDF):
     14        (dump):
     15
    1162008-07-09  Eric Seidel  <eric@webkit.org>
    217
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.cpp

    r34972 r35078  
    3737LayoutTestController::LayoutTestController(bool testRepaintDefault, bool testRepaintSweepHorizontallyDefault)
    3838    : m_dumpAsText(false)
     39    , m_dumpAsPDF(false)
    3940    , m_dumpBackForwardList(false)
    4041    , m_dumpChildFrameScrollPositions(false)
     
    7172}
    7273
     74static JSValueRef dumpAsPDFCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
     75{
     76    LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
     77    controller->setDumpAsPDF(true);
     78    return JSValueMakeUndefined(context);
     79}
     80
    7381static JSValueRef dumpBackForwardListCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
    7482{
     
    670678        { "display", displayCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    671679        { "dumpAsText", dumpAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
     680        { "printToPDF", dumpAsPDFCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    672681        { "dumpBackForwardList", dumpBackForwardListCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
    673682        { "dumpChildFramesAsText", dumpChildFramesAsTextCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
  • trunk/WebKitTools/DumpRenderTree/LayoutTestController.h

    r34972 r35078  
    7373    void setDumpAsText(bool dumpAsText) { m_dumpAsText = dumpAsText; }
    7474
     75    bool dumpAsPDF() const { return m_dumpAsPDF; }
     76    void setDumpAsPDF(bool dumpAsPDF) { m_dumpAsPDF = dumpAsPDF; }
     77   
    7578    bool dumpBackForwardList() const { return m_dumpBackForwardList; }
    7679    void setDumpBackForwardList(bool dumpBackForwardList) { m_dumpBackForwardList = dumpBackForwardList; }
     
    141144private:
    142145    bool m_dumpAsText;
     146    bool m_dumpAsPDF;
    143147    bool m_dumpBackForwardList;
    144148    bool m_dumpChildFrameScrollPositions;
  • trunk/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm

    r35076 r35078  
    607607}
    608608
     609static NSData *dumpFrameAsPDF(WebFrame *frame)
     610{
     611    if (!frame)
     612        return nil;
     613
     614    // Sadly we have to dump to a file and then read from that file again
     615    // +[NSPrintOperation PDFOperationWithView:insideRect:] requires a rect and prints to a single page
     616    // likewise +[NSView dataWithPDFInsideRect:] also prints to a single continuous page
     617    // The goal of this function is to test "real" printing across multiple pages.
     618    // FIXME: It's possible there might be printing SPI to let us print a multi-page PDF to an NSData object
     619    NSString *path = @"/tmp/test.pdf";
     620
     621    NSMutableDictionary *printInfoDict = [NSMutableDictionary dictionaryWithDictionary:[[NSPrintInfo sharedPrintInfo] dictionary]];
     622    [printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition];
     623    [printInfoDict setObject:path forKey:NSPrintSavePath];
     624
     625    NSPrintInfo *printInfo = [[NSPrintInfo alloc] initWithDictionary:printInfoDict];
     626    [printInfo setHorizontalPagination:NSAutoPagination];
     627    [printInfo setVerticalPagination:NSAutoPagination];
     628    [printInfo setVerticallyCentered:NO];
     629
     630    NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:[frame frameView] printInfo:printInfo];
     631    [printOperation setShowPanels:NO];
     632    [printOperation runOperation];
     633
     634    [printInfo release];
     635
     636    NSData *pdfData = [NSData dataWithContentsOfFile:path];
     637    [[NSFileManager defaultManager] removeFileAtPath:path handler:nil];
     638
     639    return pdfData;
     640}
     641
    609642static void convertMIMEType(NSMutableString *mimeType)
    610643{
     
    831864        if (layoutTestController->dumpAsText()) {
    832865            resultString = dumpFramesAsText(mainFrame);
     866        } else if (layoutTestController->dumpAsPDF()) {
     867            resultData = dumpFrameAsPDF(mainFrame);
     868            resultMimeType = @"application/pdf";
    833869        } else if (layoutTestController->dumpDOMAsWebArchive()) {
    834870            WebArchive *webArchive = [[mainFrame DOMDocument] webArchive];
Note: See TracChangeset for help on using the changeset viewer.