2006-03-24 Mitz Pettel <opendarwin.org@mitzpettel.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Mar 2006 22:24:52 +0000 (22:24 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Mar 2006 22:24:52 +0000 (22:24 +0000)
        Reviewed by darin.  Landed by eseidel.

        - http://bugzilla.opendarwin.org/show_bug.cgi?id=7947
          Add repaint testing support to run-webkit-tests

        * DumpRenderTree/DumpRenderTree.m:
        (main): Added --repaint and --horizontal-sweep options.
        (dump): Repaint line-by-line or column-by-column when the appropriate option
        is selected.
        (+[LayoutTestController isSelectorExcludedFromWebScript:]): Added testRepaint()
        and repaintSweepHorizontally() methods to layoutTestController.
        (-[LayoutTestController testRepaint]):
        (-[LayoutTestController repaintSweepHorizontally]):
        (dumpRenderTree):
        * Scripts/run-webkit-tests: Added --repaint and --horizontal-sweep options
        to force these settings on tests that do not ask for them.

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/Scripts/run-webkit-tests

index 45d956e9b337ef81e38f3c782db3f941896bcc5a..cf5f7f5b0a9682fb9093c19eaadf1727205f25c9 100644 (file)
@@ -1,3 +1,22 @@
+2006-03-24  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by darin.  Landed by eseidel.
+
+        - http://bugzilla.opendarwin.org/show_bug.cgi?id=7947
+          Add repaint testing support to run-webkit-tests
+
+        * DumpRenderTree/DumpRenderTree.m:
+        (main): Added --repaint and --horizontal-sweep options.
+        (dump): Repaint line-by-line or column-by-column when the appropriate option
+        is selected.
+        (+[LayoutTestController isSelectorExcludedFromWebScript:]): Added testRepaint()
+        and repaintSweepHorizontally() methods to layoutTestController.
+        (-[LayoutTestController testRepaint]):
+        (-[LayoutTestController repaintSweepHorizontally]):
+        (dumpRenderTree):
+        * Scripts/run-webkit-tests: Added --repaint and --horizontal-sweep options
+        to force these settings on tests that do not ask for them.
+
 2006-03-24  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by mjs.
index 1bf7da92e131348398fadb9afdaad409df0203db..839aa0ce2e74e2513ecdfa321ff2f176e4664775 100644 (file)
@@ -80,6 +80,10 @@ static BOOL waitToDump;
 static BOOL dumpAsText;
 static BOOL dumpTitleChanges;
 static int dumpPixels = NO;
+static int testRepaintDefault = NO;
+static BOOL testRepaint = NO;
+static int repaintSweepHorizontallyDefault = NO;
+static BOOL repaintSweepHorizontally = NO;
 static int dumpTree = YES;
 static BOOL printSeparators;
 static NSString *currentTest = nil;
@@ -181,6 +185,8 @@ int main(int argc, const char *argv[])
         {"pixel-tests", no_argument, &dumpPixels, YES},
         {"tree", no_argument, &dumpTree, YES},
         {"notree", no_argument, &dumpTree, NO},
+        {"repaint", no_argument, &testRepaintDefault, YES},
+        {"horizontal-sweep", no_argument, &repaintSweepHorizontallyDefault, YES},
         {NULL, 0, NULL, 0}
     };
 
@@ -364,7 +370,21 @@ static void dump(void)
             NSGraphicsContext *nsContext = [NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:NO];
             [NSGraphicsContext saveGraphicsState];
             [NSGraphicsContext setCurrentContext:nsContext];
-            [view displayRectIgnoringOpacity:NSMakeRect(0, 0, webViewSize.width, webViewSize.height) inContext:nsContext];
+            if (!testRepaint)
+                [view displayRectIgnoringOpacity:NSMakeRect(0, 0, webViewSize.width, webViewSize.height) inContext:nsContext];
+            else if (!repaintSweepHorizontally) {
+                NSRect line = NSMakeRect(0, 0, webViewSize.width, 1);
+                while (line.origin.y < webViewSize.height) {
+                    [view displayRectIgnoringOpacity:line inContext:nsContext];
+                    line.origin.y++;
+                }
+            } else {
+                NSRect column = NSMakeRect(0, 0, 1, webViewSize.height);
+                while (column.origin.x < webViewSize.width) {
+                    [view displayRectIgnoringOpacity:column inContext:nsContext];
+                    column.origin.x++;
+                }
+            }
             [NSGraphicsContext restoreGraphicsState];
             
             // has the actual hash to compare to the expected image's hash
@@ -491,7 +511,9 @@ static void dump(void)
             || aSelector == @selector(dumpAsText)
             || aSelector == @selector(dumpTitleChanges)
             || aSelector == @selector(setWindowIsKey:)
-            || aSelector == @selector(setMainFrameIsFirstResponder:))
+            || aSelector == @selector(setMainFrameIsFirstResponder:)
+            || aSelector == @selector(testRepaint)
+            || aSelector == @selector(repaintSweepHorizontally))
         return NO;
     return YES;
 }
@@ -546,6 +568,16 @@ static void dump(void)
         [(WebHTMLView *)documentView _updateFocusState];
 }
 
+- (void)testRepaint
+{
+    testRepaint = YES;
+}
+
+- (void)repaintSweepHorizontally
+{
+    repaintSweepHorizontally = YES;
+}
+
 - (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
 {
     return nil;
@@ -578,6 +610,8 @@ static void dumpRenderTree(const char *pathOrURL)
     waitToDump = NO;
     dumpAsText = NO;
     dumpTitleChanges = NO;
+    testRepaint = testRepaintDefault;
+    repaintSweepHorizontally = repaintSweepHorizontallyDefault;
     if (currentTest != nil)
         CFRelease(currentTest);
     currentTest = (NSString *)pathOrURLString;
index 82da69084635e8a9ab39b475442049d3198e66da..e5e0c719280a6a36f26417cb862e5670bf751822 100755 (executable)
@@ -61,6 +61,8 @@ chdirWebKit();
 # Argument handling
 my $testOnlySVGs = '';
 my $pixelTests = '';
+my $repaintTests = '';
+my $repaintSweepHorizontally = '';
 my $checkLeaks = '';
 my $guardMalloc = '';
 my $verbose = 0;
@@ -74,6 +76,8 @@ my $testResultsDirectory = "/tmp/layout-test-results";
 
 GetOptions('svg' => \$testOnlySVGs, 
     'pixel-tests|p' => \$pixelTests,
+    'repaint-tests|r' => \$repaintTests,
+    'horizontal-sweep|h' => \$repaintSweepHorizontally,
     'leaks|l' => \$checkLeaks,
     'guard-malloc|g' => \$guardMalloc,
     'verbose|v' => \$verbose,
@@ -88,7 +92,11 @@ GetOptions('svg' => \$testOnlySVGs,
 my $dumpToolName = "DumpRenderTree";
 my $result = system "WebKitTools/Scripts/build-dumprendertree", @ARGV;
 exit $result if $result;
-if ($testOnlySVGs) {
+if ($repaintSweepHorizontally) {
+    $repaintTests = 1;
+}
+
+if ($testOnlySVGs || $repaintTests) {
     $pixelTests = 1; # Pixel tests are always on for SVG.
 }
 
@@ -166,6 +174,14 @@ if ($pixelTests) {
     push @toolArgs, "--pixel-tests";
 }
 
+if ($repaintTests) {
+    push @toolArgs, "--repaint";
+}
+
+if ($repaintSweepHorizontally) {
+    push @toolArgs, "--horizontal-sweep";
+}
+
 push @toolArgs, "-";
 
 $| = 1;