mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-27 02:25:36 +00:00
Fix and test case for issue #746
This commit is contained in:
1 parent
f26d2f4ebf
commit
8ecac8d03c
2 files changed
+9
-2
No files matched your search
@@ -698,12 +698,12 @@
|
||||
var range = _ranges[i],
|
||||
maximum = CPMaxRange(range);
|
||||
|
||||
if (anIndex > maximum)
|
||||
if (anIndex >= maximum)
|
||||
break;
|
||||
|
||||
// If our index is within our range, but not the first index,
|
||||
// then this range will be split.
|
||||
if (anIndex > range.location && anIndex < maximum)
|
||||
if (anIndex > range.location)
|
||||
{
|
||||
// Split the range into shift and unshifted.
|
||||
shifted = CPMakeRange(anIndex + aDelta, maximum - anIndex);
|
||||
|
||||
@@ -366,6 +366,13 @@ function descriptionWithoutEntity(aString)
|
||||
// negative delta for downward shift
|
||||
[_set shiftIndexesStartingAtIndex:1 by:-1];
|
||||
[self assertTrue:[_set containsIndexes:[CPIndexSet indexSetWithIndexesInRange:startRange]]];
|
||||
|
||||
// test for fix to issue #746 (last item is mistakenly shifted)
|
||||
_set = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 1)];
|
||||
[self assertTrue:[_set lastIndex] === 0];
|
||||
|
||||
[_set shiftIndexesStartingAtIndex:[_set lastIndex] + 1 by:1];
|
||||
[self assertTrue:[_set lastIndex] === 0];
|
||||
}
|
||||
|
||||
- (void)tearDown
|
||||
|
||||
Reference in new issue
Block a user