Add more test cases
This commit is contained in:
		@@ -49,27 +49,54 @@ class ModListTroubleshooter {
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ModList linearForward({int stepSize = 20}) {
 | 
			
		||||
    _endIndex = _startIndex + stepSize;
 | 
			
		||||
    final totalMods = originalModList.activeMods.length;
 | 
			
		||||
    
 | 
			
		||||
    if (_startIndex >= totalMods || _startIndex == _endIndex) {
 | 
			
		||||
      int newStart = totalMods - stepSize;
 | 
			
		||||
      if (newStart < 0) {
 | 
			
		||||
        newStart = 0;
 | 
			
		||||
      }
 | 
			
		||||
      _startIndex = newStart;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _startIndex = _startIndex.clamp(0, totalMods);
 | 
			
		||||
    _endIndex = (_startIndex + stepSize).clamp(0, totalMods);
 | 
			
		||||
 | 
			
		||||
    final subset = originalModList.activeMods.keys.toList().sublist(
 | 
			
		||||
      _startIndex,
 | 
			
		||||
      _endIndex,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    currentModList.disableAll();
 | 
			
		||||
    currentModList.enableMods(subset);
 | 
			
		||||
    _startIndex = _endIndex;
 | 
			
		||||
    
 | 
			
		||||
    return currentModList;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  ModList linearBackward({int stepSize = 20}) {
 | 
			
		||||
    _startIndex = _endIndex - stepSize;
 | 
			
		||||
    _endIndex = _startIndex;
 | 
			
		||||
    final totalMods = originalModList.activeMods.length;
 | 
			
		||||
 | 
			
		||||
    if (_endIndex <= 0 || _startIndex == _endIndex) {
 | 
			
		||||
      int newEnd = stepSize;
 | 
			
		||||
      if (newEnd > totalMods) {
 | 
			
		||||
        newEnd = totalMods;
 | 
			
		||||
      }
 | 
			
		||||
      _endIndex = newEnd;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    _endIndex = _endIndex.clamp(0, totalMods);
 | 
			
		||||
    _startIndex = (_endIndex - stepSize).clamp(0, _endIndex);
 | 
			
		||||
 | 
			
		||||
    final subset = originalModList.activeMods.keys.toList().sublist(
 | 
			
		||||
      _startIndex,
 | 
			
		||||
      _endIndex,
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    currentModList.disableAll();
 | 
			
		||||
    currentModList.enableMods(subset);
 | 
			
		||||
    _endIndex = _startIndex;
 | 
			
		||||
    
 | 
			
		||||
    return currentModList;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user