Changeset 150851 in webkit


Ignore:
Timestamp:
May 28, 2013 4:18:04 PM (11 years ago)
Author:
Brent Fulgham
Message:

[Windows] Many CSS2.1 tests fail under NRWT.
https://bugs.webkit.org/show_bug.cgi?id=75707

Patch by Brent Fulgham <bfulgham@webkit.org> on 2013-05-28
Reviewed by Darin Adler.

  • DumpRenderTree/win/DumpRenderTree.cpp:

(findFontFallback): Added
(addFontFallbackIfPresent): Added
(removeFontFallbackIfPresent): Added
(runTest): Set up/remove font fallbacks when needed.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r150850 r150851  
     12013-05-28  Brent Fulgham  <bfulgham@webkit.org>
     2
     3        [Windows] Many CSS2.1 tests fail under NRWT.
     4        https://bugs.webkit.org/show_bug.cgi?id=75707
     5
     6        Reviewed by Darin Adler.
     7
     8        * DumpRenderTree/win/DumpRenderTree.cpp:
     9        (findFontFallback): Added
     10        (addFontFallbackIfPresent): Added
     11        (removeFontFallbackIfPresent): Added
     12        (runTest): Set up/remove font fallbacks when needed.
     13
    1142013-05-28  Brent Fulgham  <bfulgham@apple.com>
    215
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r150670 r150851  
    960960}
    961961
     962static String findFontFallback(const char* pathOrUrl)
     963{
     964    String pathToFontFallback = WebCore::directoryName(pathOrUrl);
     965
     966    wchar_t fullPath[_MAX_PATH];
     967    if (!_wfullpath(fullPath, pathToFontFallback.charactersWithNullTermination(), _MAX_PATH))
     968        return emptyString();
     969
     970    if (!::PathIsDirectoryW(fullPath))
     971        return emptyString();
     972
     973    String pathToCheck = fullPath;
     974
     975    static const String layoutTests = "LayoutTests";
     976
     977    // Find the layout test root on the current path:
     978    size_t location = pathToCheck.find(layoutTests);
     979    if (WTF::notFound == location)
     980        return emptyString();
     981
     982    String pathToTest = pathToCheck.substring(location + layoutTests.length() + 1);
     983    String possiblePathToLogue = WebCore::pathByAppendingComponent(pathToCheck.substring(0, location + layoutTests.length() + 1), "platform\\win");
     984
     985    Vector<String> possiblePaths;
     986    possiblePaths.append(WebCore::pathByAppendingComponent(possiblePathToLogue, pathToTest));
     987
     988    size_t nextCandidateEnd = pathToTest.reverseFind('\\');
     989    while (nextCandidateEnd && nextCandidateEnd != WTF::notFound) {
     990        pathToTest = pathToTest.substring(0, nextCandidateEnd);
     991        possiblePaths.append(WebCore::pathByAppendingComponent(possiblePathToLogue, pathToTest));
     992        nextCandidateEnd = pathToTest.reverseFind('\\');
     993    }
     994
     995    for (Vector<String>::iterator pos = possiblePaths.begin(); pos != possiblePaths.end(); ++pos) {
     996        pathToFontFallback = WebCore::pathByAppendingComponent(*pos, "resources\\");
     997
     998        if (::PathIsDirectoryW(pathToFontFallback.charactersWithNullTermination()))
     999            return pathToFontFallback;
     1000    }
     1001
     1002    return emptyString();
     1003}
     1004
     1005static void addFontFallbackIfPresent(const String& fontFallbackPath)
     1006{
     1007    if (fontFallbackPath.isEmpty())
     1008        return;
     1009
     1010    String fontFallback = WebCore::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css");
     1011
     1012    if (!::PathFileExistsW(fontFallback.charactersWithNullTermination()))
     1013        return;
     1014
     1015    ::setPersistentUserStyleSheetLocation(fontFallback.createCFString().get());
     1016}
     1017
     1018static void removeFontFallbackIfPresent(const String& fontFallbackPath)
     1019{
     1020    if (fontFallbackPath.isEmpty())
     1021        return;
     1022
     1023    String fontFallback = WebCore::pathByAppendingComponent(fontFallbackPath, "Mac-compatible-font-fallback.css");
     1024
     1025    if (!::PathFileExistsW(fontFallback.charactersWithNullTermination()))
     1026        return;
     1027
     1028    ::setPersistentUserStyleSheetLocation(0);
     1029}
     1030
    9621031static void runTest(const string& inputLine)
    9631032{
     
    9781047    CFRelease(str);
    9791048
     1049    String fallbackPath = findFontFallback(pathOrURL.c_str());
     1050
    9801051    str = CFURLGetString(url);
    9811052
     
    9921063    done = false;
    9931064    topLoadingFrame = 0;
     1065
     1066    addFontFallbackIfPresent(fallbackPath);
    9941067
    9951068    sizeWebViewForCurrentTest();
     
    10841157
    10851158exit:
     1159    removeFontFallbackIfPresent(fallbackPath);
    10861160    SysFreeString(urlBStr);
    10871161    ::gTestRunner.clear();
Note: See TracChangeset for help on using the changeset viewer.