[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:34:44 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit a100fd7b6f70020dc1e0df8e6937791828a6fa3c
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Sep 26 17:51:12 2009 +0000

    2009-09-26  Zan Dobersek  <zandobersek at gmail.com>
    
            Reviewed by Gustavo Noronha.
    
            [Layout tests] [Gtk] Gtk DumpRenderTree should use WebKit test fonts
            https://bugs.webkit.org/show_bug.cgi?id=29689
    
            Load test fonts through FontConfig before each test.
            This ensures a more proper rendering of the tests.
    
            * DumpRenderTree/gtk/DumpRenderTree.cpp:
            (initializeFonts):
            (runTest):
            (main):
            * DumpRenderTree/gtk/fonts.conf: Copied from WebKitTools/DumpRenderTree/qt/fonts.conf.
            * GNUmakefile.am:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48791 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index a2ee849..f998226 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,20 @@
+2009-09-26  Zan Dobersek  <zandobersek at gmail.com>
+
+        Reviewed by Gustavo Noronha.
+
+        [Layout tests] [Gtk] Gtk DumpRenderTree should use WebKit test fonts
+        https://bugs.webkit.org/show_bug.cgi?id=29689
+
+        Load test fonts through FontConfig before each test.
+        This ensures a more proper rendering of the tests.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (initializeFonts):
+        (runTest):
+        (main):
+        * DumpRenderTree/gtk/fonts.conf: Copied from WebKitTools/DumpRenderTree/qt/fonts.conf.
+        * GNUmakefile.am:
+
 2009-09-25  David Kilzer  <ddkilzer at apple.com>
 
         <http://webkit.org/b/29718> mark-bug-fixed: add -u|--update-only switch
diff --git a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
index 5339ccf..5468a4f 100644
--- a/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
@@ -44,6 +44,10 @@
 
 #include <wtf/Assertions.h>
 
+#if PLATFORM(X11)
+#include <fontconfig/fontconfig.h>
+#endif
+
 #include <cassert>
 #include <getopt.h>
 #include <stdlib.h>
@@ -126,6 +130,41 @@ static void appendString(gchar*& target, gchar* string)
     g_free(oldString);
 }
 
+#if PLATFORM(X11)
+static void initializeFonts()
+{
+    static int numFonts = -1;
+
+    // Some tests may add or remove fonts via the @font-face rule.
+    // If that happens, font config should be re-created to suppress any unwanted change.
+    FcFontSet* appFontSet = FcConfigGetFonts(0, FcSetApplication);
+    if (appFontSet && numFonts >= 0 && appFontSet->nfont == numFonts)
+        return;
+
+    const char* fontDirEnv = g_getenv("WEBKIT_TESTFONTS");
+    if (!fontDirEnv)
+        g_error("WEBKIT_TESTFONTS environment variable is not set, but it should point to the directory "
+                "containing the fonts you can clone from git://gitorious.org/qtwebkit/testfonts.git\n");
+
+    GFile* fontDir = g_file_new_for_path(fontDirEnv);
+    if (!fontDir || !g_file_query_exists(fontDir, NULL))
+        g_error("WEBKIT_TESTFONTS environment variable is not set correctly - it should point to the directory "
+                "containing the fonts you can clone from git://gitorious.org/qtwebkit/testfonts.git\n");
+
+    FcConfig *config = FcConfigCreate();
+    if (!FcConfigParseAndLoad (config, (FcChar8*) FONTS_CONF_FILE, true))
+        g_error("Couldn't load font configuration file");
+    if (!FcConfigAppFontAddDir (config, (FcChar8*) g_file_get_path(fontDir)))
+        g_error("Couldn't add font dir!");
+    FcConfigSetCurrent(config);
+
+    g_object_unref(fontDir);
+
+    appFontSet = FcConfigGetFonts(config, FcSetApplication);
+    numFonts = appFontSet->nfont;
+}
+#endif
+
 static gchar* dumpFramesAsText(WebKitWebFrame* frame)
 {
     gchar* result = 0;
@@ -430,6 +469,10 @@ static void runTest(const string& testPathOrURL)
     if (prevTestBFItem)
         g_object_ref(prevTestBFItem);
 
+#if PLATFORM(X11)
+    initializeFonts();
+#endif
+
     // Focus the web view before loading the test to avoid focusing problems
     gtk_widget_grab_focus(GTK_WIDGET(webView));
     webkit_web_view_open(webView, url);
@@ -707,6 +750,11 @@ int main(int argc, char* argv[])
     g_thread_init(NULL);
     gtk_init(&argc, &argv);
 
+#if PLATFORM(X11)
+    FcInit();
+    initializeFonts();
+#endif
+
     struct option options[] = {
         {"notree", no_argument, &dumpTree, false},
         {"pixel-tests", no_argument, &dumpPixels, true},
diff --git a/WebKitTools/DumpRenderTree/qt/fonts.conf b/WebKitTools/DumpRenderTree/gtk/fonts.conf
similarity index 100%
copy from WebKitTools/DumpRenderTree/qt/fonts.conf
copy to WebKitTools/DumpRenderTree/gtk/fonts.conf
diff --git a/WebKitTools/GNUmakefile.am b/WebKitTools/GNUmakefile.am
index daf7068..6cd8afa 100644
--- a/WebKitTools/GNUmakefile.am
+++ b/WebKitTools/GNUmakefile.am
@@ -107,7 +107,8 @@ noinst_LTLIBRARIES += \
 	TestNetscapePlugin/libtestnetscapeplugin.la
 
 dumprendertree_cppflags += \
-	-DTEST_PLUGIN_DIR=\"${shell pwd}/${top_builddir}/TestNetscapePlugin/.libs\"
+	-DTEST_PLUGIN_DIR=\"${shell pwd}/${top_builddir}/TestNetscapePlugin/.libs\" \
+	-DFONTS_CONF_FILE=\"${shell pwd}/${srcdir}/WebKitTools/DumpRenderTree/gtk/fonts.conf\"
 
 TestNetscapePlugin_libtestnetscapeplugin_la_CPPFLAGS = \
 	-I$(srcdir)/WebKitTools/DumpRenderTree \

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list