mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-16 11:40:42 +00:00
Add -isEqual: and -description to CPFont. Add a unit test for -isEqual:
Closes #506. Closes #505.
This commit is contained in:
1 parent
dbe0ca0adc
commit
efd699a044
2 files changed
+21
-2
No files matched your search
+11
-1
@@ -130,6 +130,16 @@ var _CPFonts = {},
|
||||
return _name;
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)anObject
|
||||
{
|
||||
return [anObject isKindOfClass:[CPFont class]] && [anObject cssString] === [self cssString];
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
return [CPString stringWithFormat:@"%@ %@ %f pt.", [super description], [self familyName], [self size]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPFontNameKey = @"CPFontNameKey",
|
||||
@@ -161,4 +171,4 @@ var CPFontNameKey = @"CPFontNameKey",
|
||||
[aCoder encodeBool:_isBold forKey:CPFontIsBoldKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
@@ -38,4 +38,13 @@
|
||||
[self assert:[_boldCustomFont cssString] equals:@"bold 30px \"Helvetica\", Arial, sans-serif"];
|
||||
}
|
||||
|
||||
@end
|
||||
- (void)testIsEqual
|
||||
{
|
||||
[self assert:_customFont equals:_customFont];
|
||||
[self assert:_systemFont equals:_systemFont];
|
||||
[self assert:_systemFont notEqual:_customFont];
|
||||
[self assert:_customFont notEqual:"a string"];
|
||||
[self assert:_customFont notEqual:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user