PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/google-toolbox-for-mac/AppKit/GTMNSImage+SearchCacheTest.m

http://macfuse.googlecode.com/
Objective C | 60 lines | 28 code | 14 blank | 18 comment | 0 complexity | af012910ea47632fce578286f54eea35 MD5 | raw file
 1//
 2//  GTMNSImage+SearchCacheTest.m
 3//
 4//  Copyright 2006-2008 Google Inc.
 5//
 6//  Licensed under the Apache License, Version 2.0 (the "License"); you may not
 7//  use this file except in compliance with the License.  You may obtain a copy
 8//  of the License at
 9// 
10//  http://www.apache.org/licenses/LICENSE-2.0
11// 
12//  Unless required by applicable law or agreed to in writing, software
13//  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14//  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
15//  License for the specific language governing permissions and limitations under
16//  the License.
17//
18
19#import <Cocoa/Cocoa.h>
20
21#import "GTMSenTestCase.h"
22
23#import "GTMNSImage+SearchCache.h"
24#import "GTMGeometryUtils.h"
25
26@interface GTMNSImage_SearchCacheTest : GTMTestCase
27@end
28
29@implementation GTMNSImage_SearchCacheTest
30
31- (void)testSearchCache {
32  NSImage *testImage = [NSImage gtm_imageNamed:@"NSApplicationIcon"];  
33  STAssertNotNil(testImage, nil);
34
35  testImage = [NSImage gtm_imageNamed:@"com.apple.Xcode"];
36  STAssertNotNil(testImage, nil);
37
38#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
39  // The stencil images only exist on 10.5+
40  testImage = [NSImage gtm_imageNamed:NSImageNameBonjour];
41  STAssertNotNil(testImage, nil);
42#endif  // MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5
43
44  testImage = [NSImage gtm_imageNamed:(NSString *)kUTTypeFolder];
45  STAssertNotNil(testImage, nil);
46  
47  testImage = [NSImage gtm_imageNamed:@"~/Library"];
48  STAssertNotNil(testImage, nil);
49  
50  testImage = [NSImage gtm_imageNamed:@"'APPL'"];
51  STAssertNotNil(testImage, nil);
52  
53  testImage = [NSImage gtm_imageNamed:@"ponies for sale"];
54  STAssertNil(testImage, nil);
55  
56  testImage = [NSImage gtm_imageNamed:@"/An/Invalid/Path"];
57  STAssertNil(testImage, nil);
58}
59
60@end