Test: CGGeometry "string from" for point, size and rect.

This commit is contained in:
Alexander Ljungberg
2013-06-13 12:43:48 +01:00
parent 29c336f7b8
commit 563300a16f
2 changed files with 27 additions and 1 deletions
-1
View File
@@ -112,7 +112,6 @@ function CGStringFromRect(aRect)
return "{" + CGStringFromPoint(aRect.origin) + ", " + CGStringFromSize(aRect.size) + "}";
}
function CGRectOffset(aRect, dX, dY)
{
return { origin:{ x:aRect.origin.x + dX, y:aRect.origin.y + dY }, size:{ width:aRect.size.width, height:aRect.size.height } };
+27
View File
@@ -0,0 +1,27 @@
@import <AppKit/CGGeometry.j>
@implementation CGGeometryTest : OJTestCase
- (void)testCGStringFromPoint
{
[self assert:@"{0, 0}" equals:CGStringFromPoint(CGPointMakeZero())];
[self assert:@"{123, 234}" equals:CGStringFromPoint(CGPointMake(123, 234))];
[self assert:@"{-123.45, -234}" equals:CGStringFromPoint(CGPointMake(-123.45, -234.))];
}
- (void)testCGStringFromSize
{
[self assert:@"{0, 0}" equals:CGStringFromSize(CGSizeMakeZero())];
[self assert:@"{123, 234}" equals:CGStringFromSize(CGSizeMake(123, 234))];
[self assert:@"{-123.45, -234}" equals:CGStringFromSize(CGSizeMake(-123.45, -234.))];
}
- (void)testCGStringFromRect
{
[self assert:@"{{0, 0}, {0, 0}}" equals:CGStringFromRect(CGRectMakeZero())];
[self assert:@"{{123, 234}, {345, 456}}" equals:CGStringFromRect(CGRectMake(123, 234, 345, 456))];
[self assert:@"{{-123.45, -234}, {345.5, 456}}" equals:CGStringFromRect(CGRectMake(-123.45, -234, 345.5, 456.))];
}
@end