Bug #: 4385
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Aug 2005 11:58:23 +0000 (11:58 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Aug 2005 11:58:23 +0000 (11:58 +0000)
Submitted by: Tobias Lidskog <tobiaslidskog@mac.com>
Reviewed by: eseidel
        * DrawTest/TestController.m:
        (-[TestController imagePathForSVGPath:]):
        Fixed support for using TextViewer with the layout-tests.
        http://bugzilla.opendarwin.org/show_bug.cgi?id=4385

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

WebKitTools/ChangeLog
WebKitTools/DrawTest/TestController.m

index 1d03714e15714c91a518196772c714895f471df2..1a9f5d5ea5aae77f67b350c0fd2be442e8bc1c98 100644 (file)
@@ -1,3 +1,13 @@
+2005-08-11  Eric Seidel  <eseidel@apple.com>
+        Fix by Tobias Lidskog <tobiaslidskog@mac.com>
+
+        Reviewed by eseidel.
+
+        * DrawTest/TestController.m:
+        (-[TestController imagePathForSVGPath:]):
+        Fixed support for using TextViewer with the layout-tests.
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=4385
+
 2005-08-11  Maciej Stachowiak  <mjs@apple.com>
 
         At Least Rougly Glanced At by Anders.
index 197528f88ce681376ffc2966edc2dcf374505e3f..5808256b73a59d48079d76afa7fa13f45ca0f24a 100644 (file)
@@ -172,33 +172,41 @@ static TestController *__sharedInstance = nil;
 {
     [[NSWorkspace sharedWorkspace] openFile:[_selectedTest svgPath]];
 }
-     
+
 - (NSString *)imagePathForSVGPath:(NSString *)svgPath
 {
     // eventually this code will build an array instead...
     
-    NSString *svgName = [svgPath lastPathComponent];
-    NSString *testName = [svgName stringByDeletingPathExtension];
-    NSString *imageName = [testName stringByAppendingPathExtension:@"png"];
     NSString *currentDirectory = [self currentPath];
     NSString *parentDirectory = [currentDirectory stringByDeletingLastPathComponent];
     
-    // first look for ../png/name.png -- SVG 1.1 baselines
-    NSString *imageDirectory = [parentDirectory stringByAppendingPathComponent:@"png"];
-    NSString *fullImageName = [@"full-" stringByAppendingString:imageName];
-    // The SVG 1.1 spec has various differnet pngs, we should allow the
+    NSString *testName = [[svgPath lastPathComponent] stringByDeletingPathExtension];
+    NSString *imageName, *imageDirectory, *imagePath;
+    
+    // first look in ../png/test.png -- SVG 1.1 baselines
+    // The SVG 1.1 spec has various different pngs, we should allow the
     // tester to choose...
-    NSString *imagePath = [imageDirectory stringByAppendingPathComponent:fullImageName];
+    imageName = [[@"full-" stringByAppendingString:testName] stringByAppendingPathExtension:@"png"];
+    imageDirectory = [parentDirectory stringByAppendingPathComponent:@"png"];
+    imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
     if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
     
     // then look for ../name.png -- openclipart.org
-    imagePath = [currentDirectory stringByAppendingPathComponent:imageName];
+    imageName = [testName stringByAppendingPathExtension:@"png"];
+    imageDirectory = parentDirectory;
+    imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
+    
+    // then look for ./name-w3c.png -- WebCore tests
+    imageName = [[testName stringByAppendingString:@"-w3c"] stringByAppendingPathExtension:@"png"];
+    imageDirectory = currentDirectory;
+    imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
     if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
     
     // finally try name-baseline.png -- ksvg regression baselines
-    testName = [testName stringByAppendingString:@"-baseline"];
-    imageName = [testName stringByAppendingPathExtension:@"png"];
-    imagePath = [currentDirectory stringByAppendingPathComponent:imageName];
+    imageName = [[testName stringByAppendingString:@"-baseline"] stringByAppendingPathExtension:@"png"];
+    imageDirectory = currentDirectory;
+    imagePath = [imageDirectory stringByAppendingPathComponent:imageName];
     if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
     
     return nil;