2010-07-12 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 01:36:57 +0000 (01:36 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 13 Jul 2010 01:36:57 +0000 (01:36 +0000)
        Reviewed by Anders Carlsson.

        Make WebKitTestRunner resize the view specially for the W3C SVG tests.
        https://bugs.webkit.org/show_bug.cgi?id=42126

        * WebKitTestRunner/PlatformWebView.h:
        * WebKitTestRunner/TestInvocation.cpp:
        (WTR::TestInvocation::TestInvocation): Store the path as a C
        string for later use.
        (WTR::TestInvocation::~TestInvocation):
        (WTR::sizeWebViewForCurrentTest): Resize the WebView to the proper
        size, depending on whether this is a W3C SVG test.
        (WTR::TestInvocation::invoke): Call the size function.
        * WebKitTestRunner/TestInvocation.h:
        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
        (WTR::PlatformWebView::resizeTo): Implement.
        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
        (WTR::PlatformWebView::resizeTo): Placeholder.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63155 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/WebKitTestRunner/PlatformWebView.h
WebKitTools/WebKitTestRunner/TestInvocation.cpp
WebKitTools/WebKitTestRunner/TestInvocation.h
WebKitTools/WebKitTestRunner/mac/PlatformWebViewMac.mm
WebKitTools/WebKitTestRunner/win/PlatformWebViewWin.cpp

index f87c9b7af884efc996b4f8e2e75e248320e9acf0..852bb05513dc8d1a71c19e9b80f733c9d3a1cbce 100644 (file)
@@ -1,3 +1,24 @@
+2010-07-12  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        Make WebKitTestRunner resize the view specially for the W3C SVG tests.
+        https://bugs.webkit.org/show_bug.cgi?id=42126
+
+        * WebKitTestRunner/PlatformWebView.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::TestInvocation): Store the path as a C
+        string for later use.
+        (WTR::TestInvocation::~TestInvocation):
+        (WTR::sizeWebViewForCurrentTest): Resize the WebView to the proper
+        size, depending on whether this is a W3C SVG test.
+        (WTR::TestInvocation::invoke): Call the size function.
+        * WebKitTestRunner/TestInvocation.h:
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::resizeTo): Implement.
+        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
+        (WTR::PlatformWebView::resizeTo): Placeholder.
+
 2010-07-12  Mario Sanchez Prada  <msanchez@igalia.com>
 
         Reviewed by Xan Lopez.
index 5506f3389f956c56777eab86e1b3d745833d20e5..6fc4509e5c695ecd6b4bd479ed53dfbd00be5139 100644 (file)
@@ -50,6 +50,7 @@ public:
 
     WKPageRef page();
     PlatformWKView platformView() { return m_view; }
+    void resizeTo(unsigned width, unsigned height);
 
 private:
     PlatformWKView m_view;
index 72d07aed81fdfaa9556ae5a45587276bf71d7e53..8da23916ac99ba57cd4870fac42bdddd5bc93168 100644 (file)
@@ -64,6 +64,7 @@ static std::auto_ptr<Vector<char> > WKStringToUTF8(WKStringRef wkStringRef)
 
 TestInvocation::TestInvocation(const char* pathOrURL)
     : m_url(AdoptWK, createWKURL(pathOrURL))
+    , m_pathOrURL(fastStrDup(pathOrURL))
     , m_gotInitialResponse(false)
     , m_gotFinalMessage(false)
     , m_error(false)
@@ -72,10 +73,27 @@ TestInvocation::TestInvocation(const char* pathOrURL)
 
 TestInvocation::~TestInvocation()
 {
+    fastFree(m_pathOrURL);
+}
+
+static const unsigned w3cSVGWidth = 480;
+static const unsigned w3cSVGHeight = 360;
+static const unsigned normalWidth = 800;
+static const unsigned normalHeight = 600;
+
+static void sizeWebViewForCurrentTest(char* pathOrURL)
+{
+    bool isSVGW3CTest = strstr(pathOrURL, "svg/W3C-SVG-1.1");
+
+    if (isSVGW3CTest)
+        TestController::shared().mainWebView()->resizeTo(w3cSVGWidth, w3cSVGHeight);
+    else
+        TestController::shared().mainWebView()->resizeTo(normalWidth, normalHeight);
 }
 
 void TestInvocation::invoke()
 {
+    sizeWebViewForCurrentTest(m_pathOrURL);
     WKRetainPtr<WKStringRef> message(AdoptWK, WKStringCreateWithCFString(CFSTR("BeginTest")));
     WKContextPostMessageToInjectedBundle(TestController::shared().context(), message.get());
 
index fb03150730742f7d03b035552f2d0da21d565af7..ea1e8406269938456ace1f62615bd598974adda2 100644 (file)
@@ -46,6 +46,7 @@ private:
     static void runUntil(bool& done);
 
     WKRetainPtr<WKURLRef> m_url;
+    char* m_pathOrURL;
 
     // Invocation state
     bool m_gotInitialResponse;
index 1a8696dc37715ac5215a3c7df18bd5a892085664..21db2eb56d76df6d39a2d85f11d18e8b85dbeadb 100644 (file)
@@ -40,6 +40,11 @@ PlatformWebView::PlatformWebView(WKPageNamespaceRef namespaceRef)
     [m_window setAutodisplay:NO];
 }
 
+void PlatformWebView::resizeTo(unsigned width, unsigned height)
+{
+    [m_view setFrame:NSMakeRect(0, 0, width, height)];
+}
+
 PlatformWebView::~PlatformWebView()
 {
     [m_window close];
index d4ebaf263ed2340db5f2db8e38f9c7a5f8796471..e55bcf732e7e157e2b2d8942ae5796aea476a4a5 100644 (file)
@@ -37,6 +37,11 @@ PlatformWebView::~PlatformWebView()
     // Implement
 }
 
+void PlatformWebView::resizeTo(unsigned width, unsigned height)
+{
+    // Implement
+}
+
 WKPageRef PlatformWebView::page()
 {
     // Implement