Add more test cases

This commit is contained in:
2025-03-16 23:21:14 +01:00
parent dbfe627877
commit 2df23dde06
2 changed files with 201 additions and 37 deletions

View File

@@ -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;
}