[webkit-changes] cvs commit: WebCore/layout-tests/editing/selection fake-doubleclick-expected.checksum fake-doubleclick-expected.png fake-doubleclick-expected.txt fake-doubleclick.html fake-drag-expected.checksum fake-drag-expected.png fake-drag-expected.txt fake-drag.html

Darin darin at opensource.apple.com
Sat Sep 24 06:50:41 PDT 2005


darin       05/09/24 06:50:41

  Modified:    .        ChangeLog
               DumpRenderTree DumpRenderTree.m
               DumpRenderTree/DumpRenderTree.xcodeproj project.pbxproj
               Scripts  run-webkit-tests
               .        ChangeLog
  Added:       layout-tests/editing/selection
                        fake-doubleclick-expected.checksum
                        fake-doubleclick-expected.png
                        fake-doubleclick-expected.txt fake-doubleclick.html
                        fake-drag-expected.checksum fake-drag-expected.png
                        fake-drag-expected.txt fake-drag.html
  Log:
  WebCore:
  
          - patch for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4963>
            "Would like to simulate human interaction with webview"
  
          Test cases added:
          * layout-tests/editing/selection/fake-drag.html: Added.
          * layout-tests/editing/selection/fake-doubleclick: Added.
  
  WebKitTools:
  
          Reviewed by Maciej.
          Landed by Darin.
  
          - patch for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4963>
          "Would like to simulate human interaction with webview"
  
          * DumpRenderTree/DumpRenderTree.m:
          (-[WaitUntilDoneDelegate webView:windowScriptObjectAvailable:]):
          (+[EventSendingController isSelectorExcludedFromWebScript:]):
          (+[EventSendingController webScriptNameForSelector:]):
          (-[EventSendingController init]):
          (-[EventSendingController mouseDown]):
          (-[EventSendingController mouseUp]):
          (-[EventSendingController mouseMoveToX:Y:]):
          Add eventSender javascript object, that sends fake mouse events to the webview.
  
          * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
          link with Carbon.framework
  
  Revision  Changes    Path
  1.105     +21 -0     WebKitTools/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebKitTools/ChangeLog,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- ChangeLog	23 Sep 2005 03:31:45 -0000	1.104
  +++ ChangeLog	24 Sep 2005 13:50:38 -0000	1.105
  @@ -1,3 +1,24 @@
  +2005-09-22  Duncan Wilcox  <duncan at mclink.it>
  +
  +        Reviewed by Maciej.
  +        Landed by Darin.
  +
  +        - patch for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4963>
  +        "Would like to simulate human interaction with webview"
  +
  +        * DumpRenderTree/DumpRenderTree.m:
  +        (-[WaitUntilDoneDelegate webView:windowScriptObjectAvailable:]):
  +        (+[EventSendingController isSelectorExcludedFromWebScript:]):
  +        (+[EventSendingController webScriptNameForSelector:]):
  +        (-[EventSendingController init]):
  +        (-[EventSendingController mouseDown]):
  +        (-[EventSendingController mouseUp]):
  +        (-[EventSendingController mouseMoveToX:Y:]):
  +        Add eventSender javascript object, that sends fake mouse events to the webview.
  +
  +        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
  +        link with Carbon.framework
  +
   2005-09-22  Eric Seidel  <eseidel at apple.com>
   
           Reviewed by mjs.
  
  
  
  1.16      +85 -0     WebKitTools/DumpRenderTree/DumpRenderTree.m
  
  Index: DumpRenderTree.m
  ===================================================================
  RCS file: /cvs/root/WebKitTools/DumpRenderTree/DumpRenderTree.m,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DumpRenderTree.m	15 Sep 2005 05:13:52 -0000	1.15
  +++ DumpRenderTree.m	24 Sep 2005 13:50:39 -0000	1.16
  @@ -40,6 +40,8 @@
   #import <WebKit/WebPreferences.h>
   #import <WebKit/WebView.h>
   
  +#import <Carbon/Carbon.h> // for GetCurrentEventTime()
  +
   #define COMMON_DIGEST_FOR_OPENSSL
   #import <CommonCrypto/CommonDigest.h>
   #import <getopt.h>
  @@ -53,6 +55,16 @@
   @interface LayoutTestController : NSObject
   @end
   
  + at interface EventSendingController : NSObject
  +{
  +    NSPoint last;
  +    BOOL down;
  +    int clickCount;
  +    NSTimeInterval lastClick;
  +}
  +
  + at end
  +
   static void dumpRenderTree(const char *filename);
   static NSString *md5HashStringForBitmap(NSBitmapImageRep *bitmap);
   
  @@ -263,6 +275,9 @@
       LayoutTestController *ltc = [[LayoutTestController alloc] init];
       [(id)obj setValue:ltc forKey:@"layoutTestController"];
       [ltc release];
  +    EventSendingController *esc = [[EventSendingController alloc] init];
  +    [(id)obj setValue:esc forKey:@"eventSender"];
  +    [esc release];
   
   }
   
  @@ -443,6 +458,76 @@
   
   @end
   
  + at implementation EventSendingController
  +
  ++ (BOOL)isSelectorExcludedFromWebScript:(SEL)aSelector
  +{
  +    if (aSelector == @selector(mouseDown)
  +            || aSelector == @selector(mouseUp)
  +            || aSelector == @selector(mouseMoveToX:Y:))
  +        return NO;
  +    return YES;
  +}
  +
  ++ (NSString *)webScriptNameForSelector:(SEL)aSelector
  +{
  +    if(aSelector == @selector(mouseMoveToX:Y:))
  +        return @"mouseMoveTo";
  +    return nil;
  +}
  +
  +- (id)init
  +{
  +    last = NSMakePoint(0, 0);
  +    down = NO;
  +    clickCount = 0;
  +    lastClick = 0;
  +    return self;
  +}
  +
  +- (void)mouseDown
  +{
  +    if(GetCurrentEventTime() - lastClick >= 1)
  +        clickCount = 1;
  +    else
  +        clickCount++;
  +    NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown location:last modifierFlags:nil timestamp:GetCurrentEventTime() windowNumber:0 context:[NSGraphicsContext currentContext] eventNumber:nil clickCount:clickCount pressure:nil];
  +
  +    NSView *subView = [[frame webView] hitTest:[event locationInWindow]];
  +    if (subView) {
  +        [subView mouseDown:event];
  +        down = YES;
  +    }
  +}
  +
  +- (void)mouseUp
  +{
  +    NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseUp location:last modifierFlags:nil timestamp:GetCurrentEventTime() windowNumber:0 context:[NSGraphicsContext currentContext] eventNumber:nil clickCount:clickCount pressure:nil];
  +
  +    NSView *subView = [[frame webView] hitTest:[event locationInWindow]];
  +    if (subView) {
  +        [subView mouseUp:event];
  +        down = NO;
  +        lastClick = [event timestamp];
  +    }
  +}
  +
  +- (void)mouseMoveToX:(int)x Y:(int)y
  +{
  +    last = NSMakePoint(x, [[frame webView] frame].size.height - y);
  +    NSEvent *event = [NSEvent mouseEventWithType:(down ? NSLeftMouseDragged : NSMouseMoved) location:last modifierFlags:nil timestamp:GetCurrentEventTime() windowNumber:0 context:[NSGraphicsContext currentContext] eventNumber:nil clickCount:(down ? clickCount : 0) pressure:nil];
  +
  +    NSView *subView = [[frame webView] hitTest:[event locationInWindow]];
  +    if (subView) {
  +        if (down)
  +            [subView mouseDragged:event];
  +        else
  +            [subView mouseMoved:event];
  +    }
  +}
  +
  + at end
  +
   static void dumpRenderTree(const char *filename)
   {
       CFStringRef filenameString = CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);
  
  
  
  1.6       +6 -0      WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj
  
  Index: project.pbxproj
  ===================================================================
  RCS file: /cvs/root/WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- project.pbxproj	18 Aug 2005 05:59:07 -0000	1.5
  +++ project.pbxproj	24 Sep 2005 13:50:39 -0000	1.6
  @@ -42,6 +42,8 @@
   		A817090208B1643800CCB9FB /* WebCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090108B1643800CCB9FB /* WebCore.framework */; };
   		A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A817090308B164D300CCB9FB /* JavaScriptCore.framework */; };
   		A84F608A08B136DA00E9745F /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A84F608908B136DA00E9745F /* Cocoa.framework */; };
  +		AE8259F308D22463000507AB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
  +		AE8259F408D22463000507AB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AE8257EF08D22389000507AB /* Carbon.framework */; };
   		B5A752A008AF5CD400138E45 /* ImageDiff.m in Sources */ = {isa = PBXBuildFile; fileRef = B5A7525808AF4A3600138E45 /* ImageDiff.m */; };
   		B5A752A208AF5D1F00138E45 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5A752A108AF5D1F00138E45 /* QuartzCore.framework */; };
   /* End PBXBuildFile section */
  @@ -88,6 +90,7 @@
   		A817090108B1643800CCB9FB /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
   		A817090308B164D300CCB9FB /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
   		A84F608908B136DA00E9745F /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
  +		AE8257EF08D22389000507AB /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
   		B5A7525808AF4A3600138E45 /* ImageDiff.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ImageDiff.m; sourceTree = "<group>"; };
   		B5A7526708AF4A4A00138E45 /* ImageDiff */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ImageDiff; sourceTree = BUILT_PRODUCTS_DIR; };
   		B5A752A108AF5D1F00138E45 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
  @@ -102,6 +105,7 @@
   				A84F608A08B136DA00E9745F /* Cocoa.framework in Frameworks */,
   				A817090208B1643800CCB9FB /* WebCore.framework in Frameworks */,
   				A817090408B164D300CCB9FB /* JavaScriptCore.framework in Frameworks */,
  +				AE8259F308D22463000507AB /* Carbon.framework in Frameworks */,
   			);
   			runOnlyForDeploymentPostprocessing = 0;
   		};
  @@ -111,6 +115,7 @@
   			files = (
   				B5A752A208AF5D1F00138E45 /* QuartzCore.framework in Frameworks */,
   				A817090008B163EF00CCB9FB /* Cocoa.framework in Frameworks */,
  +				AE8259F408D22463000507AB /* Carbon.framework in Frameworks */,
   			);
   			runOnlyForDeploymentPostprocessing = 0;
   		};
  @@ -128,6 +133,7 @@
   				A817090108B1643800CCB9FB /* WebCore.framework */,
   				B5A752A108AF5D1F00138E45 /* QuartzCore.framework */,
   				A84F608908B136DA00E9745F /* Cocoa.framework */,
  +				AE8257EF08D22389000507AB /* Carbon.framework */,
   				9340995508540CAF007F3BC8 /* Products */,
   			);
   			name = DumpRenderTree;
  
  
  
  1.28      +1 -1      WebKitTools/Scripts/run-webkit-tests
  
  Index: run-webkit-tests
  ===================================================================
  RCS file: /cvs/root/WebKitTools/Scripts/run-webkit-tests,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- run-webkit-tests	23 Sep 2005 03:31:47 -0000	1.27
  +++ run-webkit-tests	24 Sep 2005 13:50:39 -0000	1.28
  @@ -502,7 +502,7 @@
               print HTML "<tr>\n";
               print HTML "<td><a href=\"$testDirectory/$test\">$base</a></td>\n";
               print HTML "<td><a href=\"$testDirectory/$base-expected.txt\">results</a></td>\n";
  -            if ($pixelTests) {
  +            if ($pixelTests && -f "$testDirectory/$base-expected.png") {
                   print HTML "<td><a href=\"$testDirectory/$base-expected.png\">image</a></td>\n";
               }
               print HTML "</tr>\n";
  
  
  
  1.162     +9 -0      WebCore/ChangeLog
  
  Index: ChangeLog
  ===================================================================
  RCS file: /cvs/root/WebCore/ChangeLog,v
  retrieving revision 1.161
  retrieving revision 1.162
  diff -u -r1.161 -r1.162
  --- ChangeLog	24 Sep 2005 13:39:15 -0000	1.161
  +++ ChangeLog	24 Sep 2005 13:50:39 -0000	1.162
  @@ -1,3 +1,12 @@
  +2005-09-24  Duncan Wilcox  <duncan at mclink.it>
  +
  +        - patch for <http://bugzilla.opendarwin.org/show_bug.cgi?id=4963>
  +          "Would like to simulate human interaction with webview"
  +
  +        Test cases added:
  +        * layout-tests/editing/selection/fake-drag.html: Added.
  +        * layout-tests/editing/selection/fake-doubleclick: Added.
  +
   2005-09-24  Darin Adler  <darin at apple.com>
   
           - added Mitz's test for flipped text rendering (using dragged links)
  
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-doubleclick-expected.checksum
  
  Index: fake-doubleclick-expected.checksum
  ===================================================================
  f10806736a89d35c18ea901cc56b98b9
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-doubleclick-expected.png
  
  	<<Binary file>>
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-doubleclick-expected.txt
  
  Index: fake-doubleclick-expected.txt
  ===================================================================
  EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
  EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > BODY > HTML > #document to 1 of #text > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > BODY > HTML > #document to 6 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (0,0) size 800x600
        RenderBlock {DIV} at (0,0) size 800x18
          RenderText {TEXT} at (0,0) size 193x18
            text run at (0,0) width 193: "Select me, select me, select me"
  selection start: position 0 of child 0 {TEXT} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  selection end:   position 6 of child 0 {TEXT} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-doubleclick.html
  
  Index: fake-doubleclick.html
  ===================================================================
  <html>
  <head>
  <style>
  body { margin: 0; padding: 0 }
  </style>
  <script type="text/javascript">
  function step4()
  {
      eventSender.mouseUp();
      layoutTestController.notifyDone();
  }
  
  function step3()
  {
      eventSender.mouseDown();
      window.setTimeout(step4, 1);
  }
  
  function step2()
  {
      eventSender.mouseUp();
      window.setTimeout(step3, 100);
  }
  
  function step1()
  {
      eventSender.mouseDown();
      window.setTimeout(step2, 1);
  }
  
  function step0()
  {
      eventSender.mouseMoveTo(10, 10);
      window.setTimeout(step1, 1);
  }
  
  step0();
  layoutTestController.waitUntilDone();
  </script>
  </head>
  <body>
  <div contenteditable>Select me, select me, select me</div>
  </body>
  </html>
  
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-drag-expected.checksum
  
  Index: fake-drag-expected.checksum
  ===================================================================
  06734032f401e576de7a4305ef712f5b
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-drag-expected.png
  
  	<<Binary file>>
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-drag-expected.txt
  
  Index: fake-drag-expected.txt
  ===================================================================
  EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 1 of DIV > BODY > HTML > #document
  EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > BODY > HTML > #document to 0 of DIV > BODY > HTML > #document toDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > DIV > BODY > HTML > #document to 4 of #text > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 5 of #text > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > BODY > HTML > #document to 8 of #text > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
  EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
  layer at (0,0) size 800x600
    RenderCanvas at (0,0) size 800x600
  layer at (0,0) size 800x600
    RenderBlock {HTML} at (0,0) size 800x600
      RenderBody {BODY} at (0,0) size 800x600
        RenderBlock {DIV} at (0,0) size 800x18
          RenderText {TEXT} at (0,0) size 193x18
            text run at (0,0) width 193: "Select me, select me, select me"
  selection start: position 5 of child 0 {TEXT} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  selection end:   position 8 of child 0 {TEXT} of child 1 {DIV} of child 1 {BODY} of child 0 {HTML} of document
  
  
  
  1.1                  WebCore/layout-tests/editing/selection/fake-drag.html
  
  Index: fake-drag.html
  ===================================================================
  <html>
  <head>
  <style>
  body { margin: 0; padding: 0 }
  </style>
  <script type="text/javascript">
  function step7()
  {
      eventSender.mouseUp();
      layoutTestController.notifyDone();
  }
  
  function step6()
  {
      eventSender.mouseMoveTo(50, 10);
      window.setTimeout(step7, 1);
  }
  
  function step5()
  {
      eventSender.mouseMoveTo(31, 10);
      window.setTimeout(step6, 1);
  }
  
  function step4()
  {
      eventSender.mouseDown();
      window.setTimeout(step5, 1);
  }
  
  function step3()
  {
      eventSender.mouseMoveTo(30, 10);
      window.setTimeout(step4, 1000);
  }
  
  function step2()
  {
      eventSender.mouseUp();
      window.setTimeout(step3, 1);
  }
  
  function step1()
  {
      eventSender.mouseDown();
      window.setTimeout(step2, 1);
  }
  
  function step0()
  {
      eventSender.mouseMoveTo(1, 10);
      window.setTimeout(step1, 1);
  }
  
  step0();
  layoutTestController.waitUntilDone();
  </script>
  </head>
  <body>
  <div contenteditable>Select me, select me, select me</div>
  </body>
  </html>
  
  
  



More information about the webkit-changes mailing list