diff options
Diffstat (limited to 'AppKit/GTMNSColor+ThemeTest.m')
-rw-r--r-- | AppKit/GTMNSColor+ThemeTest.m | 199 |
1 files changed, 0 insertions, 199 deletions
diff --git a/AppKit/GTMNSColor+ThemeTest.m b/AppKit/GTMNSColor+ThemeTest.m deleted file mode 100644 index e7d2a77..0000000 --- a/AppKit/GTMNSColor+ThemeTest.m +++ /dev/null @@ -1,199 +0,0 @@ -// -// NSColor+ThemeTest.m -// -// Copyright 2006-2008 Google Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); you may not -// use this file except in compliance with the License. You may obtain a copy -// of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -// License for the specific language governing permissions and limitations under -// the License. -// - -#import <SenTestingKit/SenTestingKit.h> -#import "GTMNSColor+Theme.h" -#import "GTMNSWorkspace+Theme.h" -#import "GTMSystemVersion.h" - - -@interface GTMNSColor_ThemeTest : SenTestCase -@end - -@implementation GTMNSColor_ThemeTest - -//METHOD_CHECK(NSWorkspace, themeAppearance); - -- (void)testColorWithThemeTextColor { - float colorValues[][4] = { - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 0.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.449989, 0.449989, 0.449989, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.449989, 0.449989, 0.449989, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.599985, 0.599985, 0.599985, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.599985, 0.599985, 0.599985, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.499992, 0.499992, 0.499992, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 } - }; - - if ([GTMSystemVersion isLeopardOrGreater]) { - // kThemeTextColorRootMenuDisabled changed to white in Leopard. - colorValues[35][0] = 1.0; - colorValues[35][1] = 1.0; - colorValues[35][2] = 1.0; - } - for(int i = kThemeTextColorWhite; i < kThemeTextColorSystemDetail; i++) { - if (i == 0) continue; // There is no brush 0 - NSColor *textColor = [NSColor gtm_colorWithThemeTextColor:i]; - float nsComponents[5]; - [textColor getComponents: nsComponents]; - for(int j = 0; j < 4; j++) { - STAssertEqualsWithAccuracy(nsComponents[j], colorValues[i + 2][j], 0.000001, - @"Theme Text Color %d is wrong", i); - STAssertEqualObjects([textColor colorSpaceName], NSCalibratedRGBColorSpace, - @"Color space must be CalibratedRGB"); - } - } -} - -- (void)testColorWithThemeBrushColor { - float colorValues[][4] = { - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 0.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.980011, 0.990005, 0.990005, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.709789, 0.835294, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.492195, 0.675792, 0.847669, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.000000, 0.000000, 0.000000, 1.000000 }, - { 0.500008, 0.500008, 0.500008, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.600000, 0.600000, 0.600000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.510002, 0.510002, 0.510002, 1.000000 }, - { 0.760006, 0.760006, 0.760006, 1.000000 }, - { 0.940002, 0.940002, 0.940002, 1.000000 }, - { 0.980011, 0.980011, 0.980011, 1.000000 }, - { 0.670008, 0.670008, 0.670008, 1.000000 }, - { 0.860014, 0.860014, 0.860014, 1.000000 }, - { 0.880003, 0.880003, 0.880003, 1.000000 }, - { 0.880003, 0.880003, 0.880003, 1.000000 }, - { 0.990005, 0.990005, 0.990005, 1.000000 }, - { 0.900008, 0.900008, 0.900008, 1.000000 }, - { 0.930007, 0.930007, 0.930007, 1.000000 }, - { 0.930007, 0.930007, 0.930007, 1.000000 }, - { 0.990005, 0.990005, 0.990005, 1.000000 }, - { 0.540002, 0.540002, 0.540002, 1.000000 }, - { 0.590005, 0.590005, 0.590005, 1.000000 }, - { 0.590005, 0.590005, 0.590005, 1.000000 }, - { 0.730007, 0.730007, 0.730007, 1.000000 }, - { 0.640009, 0.640009, 0.640009, 1.000000 }, - { 0.640009, 0.640009, 0.640009, 1.000000 }, - { 0.820005, 0.820005, 0.820005, 1.000000 }, - { 0.820005, 0.820005, 0.820005, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 1.000000, 1.000000, 1.000000, 1.000000 }, - { 0.925490, 0.952895, 0.996094, 1.000000 } - }; - - NSString *theme = [[NSWorkspace sharedWorkspace] gtm_themeAppearance]; - if ([theme isEqualToString:(NSString*)kThemeAppearanceAquaGraphite]) { - // COV_NF_START - // These are the only two brushes that change with an appearance change - // In general we will be testing in blue, so this code won't get run - colorValues[21][0] = 0.605478; - colorValues[21][1] = 0.667979; - colorValues[21][2] = 0.738293; - colorValues[59][0] = 0.941192; - colorValues[59][1] = 0.941192; - colorValues[59][2] = 0.941192; - // COV_NF_END - } - for(int i = kThemeBrushWhite; i < kThemeBrushListViewColumnDivider; i++) { - // Brush "14" is the selection, so it will change depending on the system - // There is no brush 0. - if (i == 0 || i == 14) continue; - NSColor *brushColor = [NSColor gtm_colorWithThemeBrush:i]; - float nsComponents[5]; - [brushColor getComponents: nsComponents]; - for(int j = 0; j < 4; j++) { - STAssertEqualsWithAccuracy(nsComponents[j], colorValues[i + 2][j], 0.000001, - @"Theme Text Brush %d is wrong", i + 2); - STAssertEqualObjects([brushColor colorSpaceName], NSCalibratedRGBColorSpace, - @"Color space must be CalibratedRB"); - } - } -} - -@end |