2007-04-21 Mitz Pettel <mitz@webkit.org>
authorbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Apr 2007 08:17:09 +0000 (08:17 +0000)
committerbdash <bdash@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 21 Apr 2007 08:17:09 +0000 (08:17 +0000)
        Reviewed by Darin.

        - http://bugs.webkit.org/show_bug.cgi?id=13350
          Build Ahem into DumpRenderTree

        * DumpRenderTree/DumpRenderTree.m:
        (activateAhemFont): Added. Activates the copy of Ahem included in the
        DumpRenderTree binary.
        (dumpRenderTree): Replaced the check that Ahem is available with a call
        to activateAhemFont().
        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
          Added linker options to include Ahem in the data section of the
          DumpRenderTree binary.

2007-04-21  Mitz Pettel  <mitz@webkit.org>

        Reviewed by Darin.

        - http://bugs.webkit.org/show_bug.cgi?id=13350
          Build Ahem into DumpRenderTree

        * quality/testing.html: Removed the requirement to download and install
        Ahem for running the tests.
        * quality/testwriting.html: Added information about Ahem.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20994 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitSite/ChangeLog
WebKitSite/quality/testing.html
WebKitSite/quality/testwriting.html
WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj

index 515e34f32dcdfb4762bc111864fbf7a73cee92fc..bf6ca08e4bd2035dca3b8027b71d540936174cd3 100644 (file)
@@ -1,3 +1,14 @@
+2007-04-21  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Darin.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=13350
+          Build Ahem into DumpRenderTree
+
+        * quality/testing.html: Removed the requirement to download and install
+        Ahem for running the tests.
+        * quality/testwriting.html: Added information about Ahem.
+
 2007-04-09  Adele Peterson  <adele@apple.com>
 
         * blog/wp-content/chrome.jpg: Added.
index 6c72975e1ffe3b156be08f17e6b8206d66d1bb74..850aedcdd0161c48aed991a58c82bd11742939a4 100644 (file)
@@ -6,17 +6,9 @@
 
 <h3>The WebKit Tests</h3>
 
-<p>Before patches can land in any of the frameworks in the repository, the layout regression tests must be run. To run these tests, do the following:</p>
-
-<ol>
-<li><p>Download the <a href="Ahem.ttf">Ahem font</a>.</p>
-<p>This special simple font is used to construct certain types of predictable tests. <a href="http://www.hixie.ch/resources/fonts/">A page on Ian Hickson's site</a> has a more detailed explanation.</p></li>
-<li><p>Open the downloaded file in the Font Book application and click on the Install Font button to install it.</p></li>
-<li><p>Execute the <tt>run-webkit-tests</tt> script.</p>
+<p>Before patches can land in any of the frameworks in the repository, the layout regression tests must be run. To run these tests, execute the <tt>run-webkit-tests</tt> script.</p>
 <p class="code">WebKitTools/Scripts/run-webkit-tests</p>
-<p>It's handy to put the <tt>WebKitTools/Scripts</tt> directory in your shell path so you can type commands like <tt>build-webkit</tt> without specifying the path to the script.</p>
-</li>
-</ol>
+<p>It's handy to put the <tt>WebKitTools/Scripts</tt> directory in your shell path so you can type commands like <tt>run-webkit-tests</tt> without specifying the path to the script.</p>
 
 <p>The script will dump the render trees for all of the pages and diff the results against the expected correct results.  If no
 differences are found, then the patch has passed the tests.  If any tests fail, then the patch cannot be committed until the
index e3c3645c210b3bffaa250ce72eabc307333b6602..a2b5f0ae6133c93974443dda9d0c3481ba2ea26e 100644 (file)
@@ -14,7 +14,7 @@ if they do anything that changes the layout. Once we get a test rendering proper
 
 <ol>
 <li>The test should be the smallest possible code fragment that tests the feature.
-<li>The test should fit on one page (unless of course it's testing scrolling).
+<li>The test should fit on one page (unless of course it&rsquo;s testing scrolling).
 <li>The test should clearly describe what feature it is testing.
 <li>The test should clearly describe the expected result.  It should be possible through visual inspection alone to determine that the test has
 failed.
@@ -30,6 +30,12 @@ for the output to be written out as plain text rather than as a render tree dump
 This is useful for tests that are testing something other than layout. The event creation test mentioned above is a good example of 
 how to do this and when it makes sense.</p>
 
+<p><a href="http://www.hixie.ch/resources/fonts/">The Ahem font</a> is useful in testing text layout, since its
+glyphs&rsquo; metrics are well known, and it is always available to tests running
+in the layout test tool. However, if you want to view tests that use Ahem in Safari,
+you should <a href="Ahem.ttf">download Ahem</a>, open it in the Font Book
+application, and click on the Install Font button to install it.</p>
+
 <p>The CSS working group has an excellent document on <a href="http://www.w3.org/Style/CSS/Test/guidelines.html">test writing guidelines</a> for CSS tests.  <a href="http://trac.webkit.org/projects/webkit/wiki/Writing%20Layout%20Tests%20for%20DumpRenderTree">This wiki article</a> has more information on writing good tests and the DumpRenderTree tool.</p>
 
 <?php
index f95c0a3686cf6454b1df3077a93f96fa1ddd57c5..da20bd00e90d19a8cf38594b84c0f88e28101841 100644 (file)
@@ -1,3 +1,19 @@
+2007-04-21  Mitz Pettel  <mitz@webkit.org>
+
+        Reviewed by Darin.
+
+        - http://bugs.webkit.org/show_bug.cgi?id=13350
+          Build Ahem into DumpRenderTree
+
+        * DumpRenderTree/DumpRenderTree.m:
+        (activateAhemFont): Added. Activates the copy of Ahem included in the
+        DumpRenderTree binary.
+        (dumpRenderTree): Replaced the check that Ahem is available with a call
+        to activateAhemFont().
+        * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+          Added linker options to include Ahem in the data section of the
+          DumpRenderTree binary.
+
 2007-04-20  Adam Roben  <aroben@apple.com>
 
         Reviewed by Darin.
index 83e425c70987e63768c3964b9bb6d27666f808e9..7bad84c162fa61f00513da5d367cb95bf54a1676 100644 (file)
@@ -63,6 +63,7 @@
 #import <WebKit/WebViewPrivate.h>
 #import <JavaScriptCore/Assertions.h>
 #import <getopt.h>
+#import <mach-o/getsect.h>
 #import <malloc/malloc.h>
 #import <objc/objc-runtime.h>                       // for class_poseAs
 #import <pthread.h>
@@ -299,6 +300,24 @@ static void crashHandler(int sig)
     exit(128 + sig);
 }
 
+static void activateAhemFont(void)
+{    
+    unsigned long fontDataLength;
+    char* fontData = getsectdata("__DATA", "Ahem", &fontDataLength);
+    if (!fontData) {
+        fprintf(stderr, "Failed to locate the Ahem font.\n");
+        exit(1);
+    }
+
+    ATSFontContainerRef fontContainer;
+    OSStatus status = ATSFontActivateFromMemory(fontData, fontDataLength, kATSFontContextLocal, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault, &fontContainer);
+
+    if (status != noErr) {
+        fprintf(stderr, "Failed to activate the Ahem font.\n");
+        exit(1);
+    }
+}
+
 static void setDefaultColorProfileToRGB(void)
 {
     CMProfileRef genericProfile = [[NSColorSpace genericRGBColorSpace] colorSyncProfile];
@@ -451,12 +470,9 @@ void dumpRenderTree(int argc, const char *argv[])
                 exit(1);
                 break;
         }
-    
-    if ([[[NSFontManager sharedFontManager] availableMembersOfFontFamily:@"Ahem"] count] == 0) {
-        fprintf(stderr, "\nAhem font is not available. This special simple font is used to construct certain types of predictable tests.\n\nTo run regression tests, please get it from <http://webkit.org/quality/Ahem.ttf>.\n");
-        exit(1);
-    }
-    
+
+    activateAhemFont();
+
     if (dumpPixels) {
         setDefaultColorProfileToRGB();
         screenCaptureBuffer = malloc(maxViewHeight * maxViewWidth * 4);
index 1dc1bc2041e1f9f700c8bee2ba9e9d689bc821ac..0c226a6813b5bdc94ef36b589bf928f4c0c2b784 100644 (file)
                22181BCF09DC8C4B008342E8 /* ObjCPluginFunction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ObjCPluginFunction.h; sourceTree = "<group>"; };
                22181BD009DC8C4B008342E8 /* ObjCPluginFunction.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = ObjCPluginFunction.m; sourceTree = "<group>"; };
                32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
+               9345229C0BD12B710086EDA0 /* AHEM____.TTF */ = {isa = PBXFileReference; explicitFileType = file; name = AHEM____.TTF; path = DumpRenderTree.qtproj/fonts/AHEM____.TTF; sourceTree = "<group>"; };
                9335435F03D75502008635CE /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                9340995408540CAF007F3BC8 /* DumpRenderTree */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = DumpRenderTree; sourceTree = BUILT_PRODUCTS_DIR; };
                93442CF408F8BA4900BFE8CA /* TextInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInputController.h; sourceTree = "<group>"; };
                                32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */,
                                1422A2750AF6F4BD00E1A883 /* Delegates */,
                                1422A2690AF6F45200E1A883 /* Controllers */,
+                               9345229B0BD12B2C0086EDA0 /* Resources */,
                                141BF1F5096A439800E0753C /* TestNetscapePlugIn.subproj */,
                                A803FF7409CAAD08009B2A37 /* DumpRenderTree.h */,
                                08FB7796FE84155DC02AAC07 /* DumpRenderTree.m */,
                        name = Delegates;
                        sourceTree = "<group>";
                };
+               9345229B0BD12B2C0086EDA0 /* Resources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               9345229C0BD12B710086EDA0 /* AHEM____.TTF */,
+                       );
+                       name = Resources;
+                       sourceTree = "<group>";
+               };
                9340995508540CAF007F3BC8 /* Products */ = {
                        isa = PBXGroup;
                        children = (
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                GCC_PREFIX_HEADER = DumpRenderTreePrefix.h;
+                               OTHER_LDFLAGS = (
+                                       "-sectcreate",
+                                       __DATA,
+                                       Ahem,
+                                       DumpRenderTree.qtproj/fonts/AHEM____.TTF,
+                               );
                                PRODUCT_NAME = DumpRenderTree;
                        };
                        name = Debug;
                        isa = XCBuildConfiguration;
                        buildSettings = {
                                GCC_PREFIX_HEADER = DumpRenderTreePrefix.h;
+                               OTHER_LDFLAGS = (
+                                       "-sectcreate",
+                                       __DATA,
+                                       Ahem,
+                                       DumpRenderTree.qtproj/fonts/AHEM____.TTF,
+                               );
                                PRODUCT_NAME = DumpRenderTree;
                        };
                        name = Release;