Fixed a bug in the new CPIndexSet when adding indexes to the back of the set. Also added a test to handle this case. Also moved Table visual tests into Tests/ folder.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-08-22 02:51:37 -07:00
parent 1b4a5dc48b
commit 3b761ec55e
19 changed files with 15 additions and 4 deletions
+1 -1
View File
@@ -521,7 +521,7 @@
var rhsRangeIndex = assumedPositionOfIndex(_ranges, CPMaxRange(aRange)),
rhsRangeIndexFLOOR = FLOOR(rhsRangeIndex);
if (rhsRangeIndexFLOOR === rhsRangeIndex && rhsRangeIndexFLOOR > 0)
if (rhsRangeIndexFLOOR === rhsRangeIndex && rhsRangeIndexFLOOR >= 0)
aRange = CPUnionRange(aRange, _ranges[rhsRangeIndexFLOOR]);
var removalCount = rhsRangeIndexFLOOR - lhsRangeIndexCEIL + 1;
+2 -1
View File
@@ -11,7 +11,7 @@
_tableColumn = [[CPTableColumn alloc] initWithIdentifier:@"Foo"];
[_tableView addTableColumn:_tableColumn];
}
/*
// Failing test for issue 112, See:http://github.com/280north/cappuccino/issues/#issue/112
- (void)testCPTableDoubleAction
{
@@ -21,3 +21,4 @@
[_tableView trackSelection:dblClk];
}
*/
+7 -2
View File
@@ -55,9 +55,14 @@ function descriptionWithoutEntity(aString)
[self assert:@"[number of indexes: 41 (in 3 ranges), indexes: (10-19 23 30-59)]" equals:descriptionWithoutEntity(indexSet)];
// Test adding range across two empty slots forcing a combination
[indexSet addIndexesInRange:CPMakeRange(0,70)];
[indexSet addIndexesInRange:CPMakeRange(5,70)];
[self assert:@"[number of indexes: 70 (in 1 range), indexes: (0-69)]" equals:descriptionWithoutEntity(indexSet)];
[self assert:@"[number of indexes: 70 (in 1 range), indexes: (5-74)]" equals:descriptionWithoutEntity(indexSet)];
// Test adding to extend the beginning of the first range
[indexSet addIndex:4];
[self assert:@"[number of indexes: 71 (in 1 range), indexes: (4-74)]" equals:descriptionWithoutEntity(indexSet)];
}
- (void)testRemoveIndexes

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

@@ -16,6 +16,11 @@ CPLogRegister(CPLogConsole);
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
indexes = [CPMutableIndexSet indexSetWithIndex:5];
[indexes addIndexesInRange:CPMakeRange(4, 1)];
alert(indexes);
return;
var view = [[CPView alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 100.0)];
[view setBackgroundColor:[CPColor whiteColor]];

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB