feat: V1.0.0 发布(呆头鹅)
- 默认浅色白底主题;字体整数化 + Microsoft YaHei UI 提升清晰度 - 相位分区:圆周/条形显示、沿弧排列、拖拽边界(虚线参考+弱吸附)、增删改(对话框/右键/双击) - 动作:Ctrl 多选批量对齐;上下拖拽自由换行;左右端拖拽改起止(虚线+弱吸附+左右箭头光标) - 动作编辑支持角度与时间双向换算 - 圆周顺时针箭头移至刻度环外;条形左侧标题列收窄 - 侧栏可隐藏/钉住;适应视图按内容自适应;节拍统计改为按钮弹窗 - AI 生成时序图(DeepSeek,Flash/Pro,推理强度),基于 dart:io 无插件 - 窗口标题显示文件名/未命名文件;关于信息(设计人/版本/版权) - 全量中文注释、docs/ARCHITECTURE.md、docs/HELP.md(按任务组织) - 构建脚本输出到 dist/,并附带 dist 生成物
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sequence_diagram/model/models.dart';
|
||||
import 'package:sequence_diagram/model/units.dart';
|
||||
|
||||
void main() {
|
||||
group('units', () {
|
||||
test('time conversion', () {
|
||||
const UnitSettings u = UnitSettings(timeUnit: TimeUnit.s);
|
||||
expect(tfmt(2400, u), '2.400 s');
|
||||
expect(tfmt(467, u), '0.467 s');
|
||||
const UnitSettings ms = UnitSettings(timeUnit: TimeUnit.ms);
|
||||
expect(tfmt(467, ms), '467 ms');
|
||||
expect(parseDuration('700ms', u), 700);
|
||||
expect(parseDuration('0.7s', u), 700);
|
||||
expect(parseDuration('0.7', u), 700);
|
||||
});
|
||||
|
||||
test('phase conversion', () {
|
||||
expect(pfmt(105, const UnitSettings()), '105.0°');
|
||||
expect(pfmt(105, const UnitSettings(phaseUnit: PhaseUnit.percent)), '29.17%');
|
||||
expect(parsePhase('29.17%'), closeTo(105.012, 0.01));
|
||||
expect(parsePhase('105°'), 105);
|
||||
});
|
||||
|
||||
test('snap and normalize', () {
|
||||
expect(snapTo(103, 5), 105);
|
||||
expect(normalizeAngle(-10), 350);
|
||||
expect(normalizeAngle(370), 10);
|
||||
});
|
||||
});
|
||||
|
||||
group('model', () {
|
||||
test('wrap detection', () {
|
||||
final Action a = Action(
|
||||
id: 'A8',
|
||||
name: '清洁',
|
||||
stationId: 'ST3',
|
||||
driver: '',
|
||||
startAngle: 340,
|
||||
durationAngle: 45,
|
||||
layer: 7,
|
||||
color: kActionPalette[0],
|
||||
);
|
||||
expect(a.wrap, isTrue);
|
||||
expect(a.endAngle, 385);
|
||||
});
|
||||
|
||||
test('json round trip', () {
|
||||
final Project p = Project.demo();
|
||||
final String encoded = p.encode();
|
||||
final Project decoded = Project.decode(encoded);
|
||||
expect(decoded.actions.length, p.actions.length);
|
||||
expect(decoded.stations.length, p.stations.length);
|
||||
expect(decoded.phaseZones.length, p.phaseZones.length);
|
||||
expect(decoded.actions.last.deps.first.type, DepType.fs);
|
||||
expect(decoded.cycle.durationMs, 2400);
|
||||
expect(decoded.actions.last.color, p.actions.last.color);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user