feat: 万花筒专区可设置门的通关状态
通关态与前两个动作一样落在 userKaleidxScopeList 同一行,是 isClear。 用三态下拉(不改动 / 已通关 / 未通关)而不是勾选框,因为通关可以往回改。 - 标记通关时补 clearDate,格式按客户端 TimeManager.GetDateString 的 yyyy-MM-dd HH:mm:ss.f;已有首次通关日期不覆盖,撤销通关时一起清空 - 上行是整行替换,只叠加要改的位,playCount / best 成绩 / 日期保持原值 - 通关态只在 found && key 的前提下才显示得出来,缺钥匙时给一条短提示 - 校验放宽:三个动作任选其一即可执行
This commit is contained in:
1 parent
44c4a1daae
commit
6438fb2171
7 files changed
+241
-27
No files matched your search
@@ -506,5 +506,97 @@ void main() {
|
||||
contains('隐形'),
|
||||
);
|
||||
});
|
||||
|
||||
test('标记通关时落一个首次通关日期,已有日期不被覆盖', () {
|
||||
const noDate = UserKaleidxScopeBean(gateId: 5);
|
||||
final marked = noDate.withActions(
|
||||
discover: true,
|
||||
giveKey: true,
|
||||
clear: true,
|
||||
timestamp: '2026-10-01 12:00:00.0',
|
||||
);
|
||||
expect(marked.isClear, isTrue);
|
||||
expect(marked.clearDate, '2026-10-01 12:00:00.0');
|
||||
|
||||
const already = UserKaleidxScopeBean(
|
||||
gateId: 5,
|
||||
isGateFound: true,
|
||||
isKeyFound: true,
|
||||
isClear: true,
|
||||
clearDate: '2026-01-01 00:00:00.0',
|
||||
);
|
||||
final reMarked = already.withActions(
|
||||
discover: false,
|
||||
giveKey: false,
|
||||
clear: true,
|
||||
timestamp: '2026-10-01 12:00:00.0',
|
||||
);
|
||||
// clearDate 是「首次」通关日期,不能被后来的一次操作改掉。
|
||||
expect(reMarked.clearDate, '2026-01-01 00:00:00.0');
|
||||
});
|
||||
|
||||
test('撤销通关把 clearDate 一起清掉', () {
|
||||
const cleared = UserKaleidxScopeBean(
|
||||
gateId: 6,
|
||||
isGateFound: true,
|
||||
isKeyFound: true,
|
||||
isClear: true,
|
||||
clearDate: '2026-01-01 00:00:00.0',
|
||||
playCount: 3,
|
||||
);
|
||||
|
||||
final undone = cleared.withActions(
|
||||
discover: false,
|
||||
giveKey: false,
|
||||
clear: false,
|
||||
);
|
||||
|
||||
expect(undone.isClear, isFalse);
|
||||
expect(undone.clearDate, '');
|
||||
// 只动通关态,成绩与次数要原样留着。
|
||||
expect(undone.playCount, 3);
|
||||
expect(undone.isKeyFound, isTrue);
|
||||
});
|
||||
|
||||
test('通关状态选「不改动」时 null 不覆写原值', () {
|
||||
const cleared = UserKaleidxScopeBean(
|
||||
gateId: 8,
|
||||
isGateFound: true,
|
||||
isKeyFound: true,
|
||||
isClear: true,
|
||||
clearDate: '2026-01-01 00:00:00.0',
|
||||
);
|
||||
|
||||
final kept = cleared.withActions(discover: true, giveKey: false);
|
||||
|
||||
expect(kept.isClear, isTrue);
|
||||
expect(kept.clearDate, '2026-01-01 00:00:00.0');
|
||||
});
|
||||
|
||||
test('新行也能直接建成已通关', () {
|
||||
final row = UserKaleidxScopeBean.discovered(
|
||||
11,
|
||||
giveKey: true,
|
||||
clear: true,
|
||||
timestamp: '2026-10-01 12:00:00.0',
|
||||
).toWireJson();
|
||||
|
||||
expect(row['isGateFound'], isTrue);
|
||||
expect(row['isKeyFound'], isTrue);
|
||||
expect(row['isClear'], isTrue);
|
||||
expect(row['clearDate'], '2026-10-01 12:00:00.0');
|
||||
});
|
||||
|
||||
test('新行不选通关时 clearDate 留空', () {
|
||||
final row = UserKaleidxScopeBean.discovered(
|
||||
11,
|
||||
giveKey: false,
|
||||
clear: false,
|
||||
timestamp: '2026-10-01 12:00:00.0',
|
||||
).toWireJson();
|
||||
|
||||
expect(row['isClear'], isFalse);
|
||||
expect(row['clearDate'], '');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user