+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.
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;
{"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}
};
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
|| 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;
}
[(WebHTMLView *)documentView _updateFocusState];
}
+- (void)testRepaint
+{
+ testRepaint = YES;
+}
+
+- (void)repaintSweepHorizontally
+{
+ repaintSweepHorizontally = YES;
+}
+
- (id)invokeUndefinedMethodFromWebScript:(NSString *)name withArguments:(NSArray *)args
{
return nil;
waitToDump = NO;
dumpAsText = NO;
dumpTitleChanges = NO;
+ testRepaint = testRepaintDefault;
+ repaintSweepHorizontally = repaintSweepHorizontallyDefault;
if (currentTest != nil)
CFRelease(currentTest);
currentTest = (NSString *)pathOrURLString;
# Argument handling
my $testOnlySVGs = '';
my $pixelTests = '';
+my $repaintTests = '';
+my $repaintSweepHorizontally = '';
my $checkLeaks = '';
my $guardMalloc = '';
my $verbose = 0;
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,
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.
}
push @toolArgs, "--pixel-tests";
}
+if ($repaintTests) {
+ push @toolArgs, "--repaint";
+}
+
+if ($repaintSweepHorizontally) {
+ push @toolArgs, "--horizontal-sweep";
+}
+
push @toolArgs, "-";
$| = 1;