Changeset 158290 in webkit


Ignore:
Timestamp:
Oct 30, 2013, 11:04:41 AM (12 years ago)
Author:
ap@apple.com
Message:

Mavericks: 128 tests are failing due to pixel differences
https://bugs.webkit.org/show_bug.cgi?id=123488

Reviewed by Simon Fraser.

Apple font preferences cannot be fully reset after they've been read, so we
need to set them using CFPreferences before initializing NSApplication.

In theory, this should be an issue on WebKit2 as well, but somehow it doesn't
appear to be. I guess we can figure out the reasons for this difference when/if
any observable problems start to occur.

  • DumpRenderTree/mac/DumpRenderTree.mm:

(setDefaultsToConsistentValuesForTesting): Only set defaults here, move other work
to prepareConsistentTestingEnvironment().
(main): Call setDefaultsToConsistentValuesForTesting before [NSApplication sharedApplication]
(which is unnecessary anyway since NSUserDefaults will implicitly call it, but seems
useful to keep in case we change out approach to defaults again).

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Tools/ChangeLog

    r158283 r158290  
     12013-10-30  Alexey Proskuryakov  <ap@apple.com>
     2
     3        Mavericks: 128 tests are failing due to pixel differences
     4        https://bugs.webkit.org/show_bug.cgi?id=123488
     5
     6        Reviewed by Simon Fraser.
     7
     8        Apple font preferences cannot be fully reset after they've been read, so we
     9        need to set them using CFPreferences before initializing NSApplication.
     10
     11        In theory, this should be an issue on WebKit2 as well, but somehow it doesn't
     12        appear to be. I guess we can figure out the reasons for this difference when/if
     13        any observable problems start to occur.
     14
     15        * DumpRenderTree/mac/DumpRenderTree.mm:
     16        (setDefaultsToConsistentValuesForTesting): Only set defaults here, move other work
     17        to prepareConsistentTestingEnvironment().
     18        (main): Call setDefaultsToConsistentValuesForTesting before [NSApplication sharedApplication]
     19        (which is unnecessary anyway since NSUserDefaults will implicitly call it, but seems
     20        useful to keep in case we change out approach to defaults again).
     21
    1222013-10-29  Andy Estes  <aestes@apple.com>
    223
  • TabularUnified trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r158256 r158290  
    677677static void setDefaultsToConsistentValuesForTesting()
    678678{
    679     // FIXME: We'd like to start with a clean state for every test, but this function can't be used more than once yet.
    680     [WebPreferences _switchNetworkLoaderToNewTestingSession];
    681 
    682679    static const int NoFontSmoothing = 0;
    683680    static const int BlueTintedAppearance = 1;
     681
     682    // These defaults are read at NSApplication initialization time, and there is no way to fully reset them afterwards.
     683    // We have to use CFPreferences, because [NSUserDefaults standardUserDefaults] indirectly initializes NSApplication.
     684    CFPreferencesSetAppValue(CFSTR("AppleFontSmoothing"), (CFNumberRef)@(NoFontSmoothing), kCFPreferencesCurrentApplication);
     685    CFPreferencesSetAppValue(CFSTR("AppleAntiAliasingThreshold"), (CFNumberRef)@4, kCFPreferencesCurrentApplication);
     686    CFPreferencesSetAppValue(CFSTR("AppleLanguages"), (CFArrayRef)@[ @"en" ], kCFPreferencesCurrentApplication);
    684687
    685688    NSString *libraryPath = libraryPathForDumpRenderTree();
     
    715718
    716719    [[NSUserDefaults standardUserDefaults] setVolatileDomain:dict forName:NSArgumentDomain];
    717 
    718     // Underlying frameworks have already read AppleAntiAliasingThreshold default before we changed it.
    719     // A distributed notification is delivered to all applications, but it should be harmless, and it's the only way to update all underlying frameworks anyway.
    720     [[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"AppleAquaAntiAliasingChanged" object:nil userInfo:nil deliverImmediately:YES];
    721 
    722     NSURLCache *sharedCache =
    723         [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024
    724                                       diskCapacity:0
    725                                           diskPath:[libraryPath stringByAppendingPathComponent:@"URLCache"]];
    726     [NSURLCache setSharedURLCache:sharedCache];
    727     [sharedCache release];
    728720}
    729721
     
    849841    poseAsClass("DumpRenderTreeEvent", "NSEvent");
    850842
    851     setDefaultsToConsistentValuesForTesting();
     843    // FIXME: We'd like to start with a clean state for every test, but this function can't be used more than once yet.
     844    [WebPreferences _switchNetworkLoaderToNewTestingSession];
     845
     846    NSURLCache *sharedCache =
     847        [[NSURLCache alloc] initWithMemoryCapacity:1024 * 1024
     848                                      diskCapacity:0
     849                                          diskPath:[libraryPathForDumpRenderTree() stringByAppendingPathComponent:@"URLCache"]];
     850    [NSURLCache setSharedURLCache:sharedCache];
     851    [sharedCache release];
     852
    852853    adjustFonts();
    853854    registerMockScrollbars();
     
    931932{
    932933    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
     934
     935    setDefaultsToConsistentValuesForTesting(); // Must be called before NSApplication initialization.
     936
    933937    [DumpRenderTreeApplication sharedApplication]; // Force AppKit to init itself
    934938
Note: See TracChangeset for help on using the changeset viewer.