Changeset 149087 in webkit


Ignore:
Timestamp:
Apr 24, 2013 7:09:22 PM (11 years ago)
Author:
Simon Fraser
Message:

Pixel tests in SVG are all broken in WK2
https://bugs.webkit.org/show_bug.cgi?id=114218

Reviewed by Darin Adler.

Window snapshots in WebKitTestRunner on Mac are window-sized
(800x600), which is wrong for the W3C SVG tests that require a
480x360 snapshot.

Fix by resizing the window, as well as the web view in
PlatformWebView::resizeTo() so that window snapshots are correctly
sized.

Also do some drive-by cleanup of the window size constants in both
DRT and WTR to remove magic numbers, and make the code more similar.

  • DumpRenderTree/TestRunner.cpp:

(TestRunner::setShouldPaintBrokenImage):

  • DumpRenderTree/TestRunner.h:
  • DumpRenderTree/efl/DumpRenderTree.cpp:
  • DumpRenderTree/gtk/DumpRenderTree.cpp:

(webInspectorShowWindow):

  • DumpRenderTree/mac/DumpRenderTree.mm:

(createWebViewAndOffscreenWindow):
(sizeWebViewForCurrentTest):

  • DumpRenderTree/mac/DumpRenderTreeMac.h:
  • DumpRenderTree/mac/PixelDumpSupportMac.mm:

(createPagedBitmapContext):

  • DumpRenderTree/qt/DumpRenderTreeQt.cpp:

(DumpRenderTree::DumpRenderTree):
(DumpRenderTree::open):

  • DumpRenderTree/qt/TestRunnerQt.cpp:
  • DumpRenderTree/qt/TestRunnerQt.h:
  • DumpRenderTree/win/DumpRenderTree.cpp:

(sizeWebViewForCurrentTest):

  • DumpRenderTree/wx/DumpRenderTreeWx.cpp:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::resetStateToConsistentValues):

  • WebKitTestRunner/TestController.h:
  • WebKitTestRunner/TestInvocation.cpp:

(WTR::sizeWebViewForCurrentTest):

  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

(WTR::PlatformWebView::PlatformWebView):
(WTR::PlatformWebView::resizeTo):

Location:
trunk/Tools
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r149073 r149087  
     12013-04-24  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Pixel tests in SVG are all broken in WK2
     4        https://bugs.webkit.org/show_bug.cgi?id=114218
     5
     6        Reviewed by Darin Adler.
     7       
     8        Window snapshots in WebKitTestRunner on Mac are window-sized
     9        (800x600), which is wrong for the W3C SVG tests that require a
     10        480x360 snapshot.
     11       
     12        Fix by resizing the window, as well as the web view in
     13        PlatformWebView::resizeTo() so that window snapshots are correctly
     14        sized.
     15       
     16        Also do some drive-by cleanup of the window size constants in both
     17        DRT and WTR to remove magic numbers, and make the code more similar.
     18       
     19        * DumpRenderTree/TestRunner.cpp:
     20        (TestRunner::setShouldPaintBrokenImage):
     21        * DumpRenderTree/TestRunner.h:
     22        * DumpRenderTree/efl/DumpRenderTree.cpp:
     23        * DumpRenderTree/gtk/DumpRenderTree.cpp:
     24        (webInspectorShowWindow):
     25        * DumpRenderTree/mac/DumpRenderTree.mm:
     26        (createWebViewAndOffscreenWindow):
     27        (sizeWebViewForCurrentTest):
     28        * DumpRenderTree/mac/DumpRenderTreeMac.h:
     29        * DumpRenderTree/mac/PixelDumpSupportMac.mm:
     30        (createPagedBitmapContext):
     31        * DumpRenderTree/qt/DumpRenderTreeQt.cpp:
     32        (DumpRenderTree::DumpRenderTree):
     33        (DumpRenderTree::open):
     34        * DumpRenderTree/qt/TestRunnerQt.cpp:
     35        * DumpRenderTree/qt/TestRunnerQt.h:
     36        * DumpRenderTree/win/DumpRenderTree.cpp:
     37        (sizeWebViewForCurrentTest):
     38        * DumpRenderTree/wx/DumpRenderTreeWx.cpp:
     39        * WebKitTestRunner/TestController.cpp:
     40        (WTR::TestController::resetStateToConsistentValues):
     41        * WebKitTestRunner/TestController.h:
     42        * WebKitTestRunner/TestInvocation.cpp:
     43        (WTR::sizeWebViewForCurrentTest):
     44        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     45        (WTR::PlatformWebView::PlatformWebView):
     46        (WTR::PlatformWebView::resizeTo):
     47
    1482013-04-24  Byungwoo Lee  <bw80.lee@samsung.com>
    249
  • trunk/Tools/DumpRenderTree/TestRunner.cpp

    r146291 r149087  
    4444#include <wtf/OwnArrayPtr.h>
    4545#include <wtf/RefPtr.h>
     46
     47const unsigned TestRunner::viewWidth = 800;
     48const unsigned TestRunner::viewHeight = 600;
     49
     50const unsigned TestRunner::w3cSVGViewWidth = 480;
     51const unsigned TestRunner::w3cSVGViewHeight = 360;
    4652
    4753TestRunner::TestRunner(const std::string& testPathOrURL, const std::string& expectedPixelHash)
     
    22372243    m_shouldPaintBrokenImage = shouldPaintBrokenImage;
    22382244}
    2239 
    2240 const unsigned TestRunner::maxViewWidth = 800;
    2241 const unsigned TestRunner::maxViewHeight = 600;
  • trunk/Tools/DumpRenderTree/TestRunner.h

    r146291 r149087  
    4242public:
    4343    static PassRefPtr<TestRunner> create(const std::string& testPathOrURL, const std::string& expectedPixelHash);
     44
     45    static const unsigned viewWidth;
     46    static const unsigned viewHeight;
     47
     48    static const unsigned w3cSVGViewWidth;
     49    static const unsigned w3cSVGViewHeight;
     50
    4451    ~TestRunner();
    4552
     
    331338    bool shouldPaintBrokenImage() const { return m_shouldPaintBrokenImage; }
    332339
    333     static const unsigned maxViewWidth;
    334     static const unsigned maxViewHeight;
    335 
    336340    void setTextDirection(JSStringRef);
    337341    const std::string& titleTextDirection() const { return m_titleTextDirection; }
  • trunk/Tools/DumpRenderTree/efl/DumpRenderTree.cpp

    r143708 r149087  
    281281
    282282    const bool isSVGW3CTest = testURL.contains("svg/W3C-SVG-1.1");
    283     const int width = isSVGW3CTest ? 480 : TestRunner::maxViewWidth;
    284     const int height = isSVGW3CTest ? 360 : TestRunner::maxViewHeight;
     283    const int width = isSVGW3CTest ? TestRunner::w3cSVGViewWidth : TestRunner::viewWidth;
     284    const int height = isSVGW3CTest ? TestRunner::w3cSVGViewHeight : TestRunner::viewHeight;
    285285    evas_object_resize(browser->mainView(), width, height);
    286286
  • trunk/Tools/DumpRenderTree/efl/DumpRenderTreeChrome.cpp

    r148025 r149087  
    159159    evas_object_smart_callback_add(mainFrame, "load,finished", onInspectorFrameLoadFinished, 0);
    160160
    161     evas_object_resize(inspectorView, TestRunner::maxViewWidth, TestRunner::maxViewHeight);
     161    evas_object_resize(inspectorView, TestRunner::viewWidth, TestRunner::viewHeight);
    162162    evas_object_show(inspectorView);
    163163    evas_object_focus_set(inspectorView, true);
     
    213213    evas_object_name_set(m_mainView, "m_mainView");
    214214    evas_object_move(m_mainView, 0, 0);
    215     evas_object_resize(m_mainView, 800, 600);
     215    evas_object_resize(m_mainView, TestRunner::viewWidth, TestRunner::viewHeight);
    216216    evas_object_layer_set(m_mainView, EVAS_LAYER_MAX);
    217217    evas_object_show(m_mainView);
  • trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp

    r148210 r149087  
    748748    GtkAllocation size;
    749749    size.x = size.y = 0;
    750     size.width = isSVGW3CTest ? 480 : TestRunner::maxViewWidth;
    751     size.height = isSVGW3CTest ? 360 : TestRunner::maxViewHeight;
     750    size.width = isSVGW3CTest ? TestRunner::w3cSVGViewWidth : TestRunner::viewWidth;
     751    size.height = isSVGW3CTest ? TestRunner::w3cSVGViewHeight : TestRunner::viewHeight;
    752752    gtk_window_resize(GTK_WINDOW(window), size.width, size.height);
    753753    gtk_widget_size_allocate(container, &size);
     
    10681068static gboolean webInspectorShowWindow(WebKitWebInspector*, gpointer data)
    10691069{
    1070     gtk_window_set_default_size(GTK_WINDOW(webInspectorWindow), 800, 600);
     1070    gtk_window_set_default_size(GTK_WINDOW(webInspectorWindow), TestRunner::viewWidth, TestRunner::viewHeight);
    10711071    gtk_widget_show_all(webInspectorWindow);
    10721072    return TRUE;
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r148306 r149087  
    523523WebView *createWebViewAndOffscreenWindow()
    524524{
    525     NSRect rect = NSMakeRect(0, 0, TestRunner::maxViewWidth, TestRunner::maxViewHeight);
     525    NSRect rect = NSMakeRect(0, 0, TestRunner::viewWidth, TestRunner::viewHeight);
    526526    WebView *webView = [[WebView alloc] initWithFrame:rect frameName:nil groupName:@"org.webkit.DumpRenderTree"];
    527527       
     
    11061106    bool isSVGW3CTest = (gTestRunner->testPathOrURL().find("svg/W3C-SVG-1.1") != string::npos);
    11071107    if (isSVGW3CTest)
    1108         [[mainFrame webView] setFrameSize:NSMakeSize(480, 360)];
     1108        [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::w3cSVGViewWidth, TestRunner::w3cSVGViewHeight)];
    11091109    else
    1110         [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::maxViewWidth, TestRunner::maxViewHeight)];
     1110        [[mainFrame webView] setFrameSize:NSMakeSize(TestRunner::viewWidth, TestRunner::viewHeight)];
    11111111}
    11121112
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTreeMac.h

    r104902 r149087  
    5959extern StorageTrackerDelegate* storageDelegate;
    6060
    61 extern const unsigned maxViewHeight;
    62 extern const unsigned maxViewWidth;
    63 
    6461void setWaitToDumpWatchdog(CFRunLoopTimerRef);
    6562bool shouldSetWaitToDumpWatchdog();
  • trunk/Tools/DumpRenderTree/mac/PixelDumpSupportMac.mm

    r131564 r149087  
    185185PassRefPtr<BitmapContext> createPagedBitmapContext()
    186186{
    187     int pageWidthInPixels = TestRunner::maxViewWidth;
    188     int pageHeightInPixels = TestRunner::maxViewHeight;
     187    int pageWidthInPixels = TestRunner::viewWidth;
     188    int pageHeightInPixels = TestRunner::viewHeight;
    189189    int numberOfPages = [mainFrame numberOfPagesWithPageWidth:pageWidthInPixels pageHeight:pageHeightInPixels];
    190190    size_t rowBytes = 0;
  • trunk/Tools/DumpRenderTree/qt/DumpRenderTreeQt.cpp

    r147563 r149087  
    428428
    429429    m_mainView->setContextMenuPolicy(Qt::NoContextMenu);
    430     m_mainView->resize(QSize(TestRunnerQt::maxViewWidth, TestRunnerQt::maxViewHeight));
     430    m_mainView->resize(QSize(TestRunner::viewWidth, TestRunner::viewHeight));
    431431
    432432    // clean up cache by resetting quota.
     
    626626    // W3C SVG tests expect to be 480x360
    627627    bool isW3CTest = url.toString().contains("svg/W3C-SVG-1.1");
    628     int width = isW3CTest ? 480 : TestRunnerQt::maxViewWidth;
    629     int height = isW3CTest ? 360 : TestRunnerQt::maxViewHeight;
     628    int width = isW3CTest ? TestRunner::w3cSVGViewWidth : TestRunner::viewWidth;
     629    int height = isW3CTest ? TestRunner::w3cSVGViewHeight : TestRunner::viewHeight;
    630630    m_mainView->resize(QSize(width, height));
    631631    m_page->setPreferredContentsSize(QSize());
  • trunk/Tools/DumpRenderTree/qt/TestRunnerQt.cpp

    r147563 r149087  
    775775}
    776776
    777 const unsigned TestRunnerQt::maxViewWidth = 800;
    778 const unsigned TestRunnerQt::maxViewHeight = 600;
    779 
    780777// --- JSC C API stubs
    781778
  • trunk/Tools/DumpRenderTree/qt/TestRunnerQt.h

    r147563 r149087  
    6868
    6969    void reset();
    70 
    71     static const unsigned int maxViewWidth;
    72     static const unsigned int maxViewHeight;
    7370
    7471    void setTimeout(int timeout) { m_timeout = timeout; }
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r145849 r149087  
    932932    unsigned height;
    933933    if (isSVGW3CTest) {
    934         width = 480;
    935         height = 360;
     934        width = TestRunner::w3cSVGViewWidth;
     935        height = TestRunner::w3cSVGViewHeight;
    936936    } else {
    937         width = TestRunner::maxViewWidth;
    938         height = TestRunner::maxViewHeight;
     937        width = TestRunner::viewWidth;
     938        height = TestRunner::viewHeight;
    939939    }
    940940
     
    11911191IWebView* createWebViewAndOffscreenWindow(HWND* webViewWindow)
    11921192{
    1193     unsigned maxViewWidth = TestRunner::maxViewWidth;
    1194     unsigned maxViewHeight = TestRunner::maxViewHeight;
     1193    unsigned maxViewWidth = TestRunner::viewWidth;
     1194    unsigned maxViewHeight = TestRunner::viewHeight;
    11951195    HWND hostWindow = CreateWindowEx(WS_EX_TOOLWINDOW, kDumpRenderTreeClassName, TEXT("DumpRenderTree"), WS_POPUP,
    11961196      -maxViewWidth, -maxViewHeight, maxViewWidth, maxViewHeight, 0, 0, GetModuleHandle(0), 0);
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r149027 r149087  
    6363
    6464namespace WTR {
     65
     66const unsigned TestController::viewWidth = 800;
     67const unsigned TestController::viewHeight = 600;
     68
     69const unsigned TestController::w3cSVGViewWidth = 480;
     70const unsigned TestController::w3cSVGViewHeight = 360;
    6571
    6672// defaultLongTimeout + defaultShortTimeout should be less than 80,
     
    590596    // In EFL, we need to resize the window to the original size after calls to window.resizeTo.
    591597    WKRect rect = m_mainWebView->windowFrame();
    592     m_mainWebView->setWindowFrame(WKRectMake(rect.origin.x, rect.origin.y, 800, 600));
     598    m_mainWebView->setWindowFrame(WKRectMake(rect.origin.x, rect.origin.y, TestController::viewWidth, TestController::viewHeight));
    593599#endif
    594600
  • trunk/Tools/WebKitTestRunner/TestController.h

    r143988 r149087  
    4747    static TestController& shared();
    4848
     49    static const unsigned viewWidth;
     50    static const unsigned viewHeight;
     51
     52    static const unsigned w3cSVGViewWidth;
     53    static const unsigned w3cSVGViewHeight;
     54
    4955    TestController(int argc, const char* argv[]);
    5056    ~TestController();
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r141011 r149087  
    128128}
    129129
    130 static const unsigned w3cSVGWidth = 480;
    131 static const unsigned w3cSVGHeight = 360;
    132 static const unsigned normalWidth = 800;
    133 static const unsigned normalHeight = 600;
    134 
    135130static void sizeWebViewForCurrentTest(const char* pathOrURL)
    136131{
     
    138133
    139134    if (isSVGW3CTest)
    140         TestController::shared().mainWebView()->resizeTo(w3cSVGWidth, w3cSVGHeight);
     135        TestController::shared().mainWebView()->resizeTo(TestController::w3cSVGViewWidth, TestController::w3cSVGViewHeight);
    141136    else
    142         TestController::shared().mainWebView()->resizeTo(normalWidth, normalHeight);
    143 }
     137        TestController::shared().mainWebView()->resizeTo(TestController::viewWidth, TestController::viewHeight);
     138}
     139
    144140static bool shouldLogFrameLoadDelegates(const char* pathOrURL)
    145141{
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r146650 r149087  
    125125    bool useTiledDrawing = useTiledDrawingValue && WKBooleanGetValue(static_cast<WKBooleanRef>(useTiledDrawingValue));
    126126
    127     NSRect rect = NSMakeRect(0, 0, 800, 600);
     127    NSRect rect = NSMakeRect(0, 0, TestController::viewWidth, TestController::viewHeight);
    128128    m_view = [[TestRunnerWKView alloc] initWithFrame:rect contextRef:contextRef pageGroupRef:pageGroupRef useTiledDrawing:useTiledDrawing];
    129129    [m_view setWindowOcclusionDetectionEnabled:NO];
     
    142142void PlatformWebView::resizeTo(unsigned width, unsigned height)
    143143{
     144    NSRect windowFrame = [m_window frame];
     145    windowFrame.size.width = width;
     146    windowFrame.size.height = height;
     147    [m_window setFrame:windowFrame display:YES];
    144148    [m_view setFrame:NSMakeRect(0, 0, width, height)];
    145149}
Note: See TracChangeset for help on using the changeset viewer.