Merge branch '0.9.1'

This commit is contained in:
Klaas Pieter Annema committed 2011-05-04 19:08:42 +02:00
commit d8a09722c6
3 files changed
+42 -6

No files matched your search

+15 -1
View File
@@ -466,12 +466,26 @@ CPTexturedBackgroundWindowMask
return _platformWindow;
}
/*!
Sets the platform window of the reciver.
This method will first close the reciever,
change the platform window, then reopen the window (if it was originally open).
*/
- (void)setPlatformWindow:(CPPlatformWindow)aPlatformWindow
{
// FIXME: already visible.
var wasVisible = [self isVisible];
// we have to close it first, otherwise we get a DOM exception.
if (wasVisible)
[self close];
_platformWindow = aPlatformWindow;
if (wasVisible)
[self orderFront:self];
}
/*!
@ignore
*/
+11 -1
View File
@@ -83,6 +83,16 @@
return [_indexes objectAtIndex:position];
}
- (void)setIndexes:(CPArray)theIndexes
{
_indexes = [theIndexes copy];
}
- (CPArray)indexes
{
return [_indexes copy];
}
#pragma mark -
#pragma mark Modification
@@ -93,7 +103,7 @@
- (CPIndexPath)indexPathByRemovingLastIndex
{
return [CPIndexPath indexPathWithIndexes:_indexes length:[self length]];
return [CPIndexPath indexPathWithIndexes:_indexes length:[self length] - 1];
}
#pragma mark -
+16 -4
View File
@@ -35,11 +35,23 @@
- (void)testIndexPathByRemovingLastIndex
{
var ip = [indexPath indexes];
[ip removeLastObject];
// Keep removing indexes until the indexPath is empty
while ([indexPath length] > 0)
{
var expectedIndexes = [[indexPath indexes] copy];
[expectedIndexes removeObject:[expectedIndexes lastObject]];
[self assert:[CPIndexPath indexPathWithIndexes:ip]
equals:[indexPath indexPathByRemovingLastIndex]];
indexPath = [indexPath indexPathByRemovingLastIndex];
[self assert:[CPIndexPath indexPathWithIndexes:expectedIndexes] equals:indexPath];
}
}
- (void)testIndexes
{
var newIndexes = [indexPath indexes];
[newIndexes removeObjectAtIndex:0];
[self assert:[indexPath indexes] notEqual:newIndexes];
}
- (void)testCompareThrowsOnNil