v1.3.13: 模块化注册架构 + PDS流程设计套件更名 + 依赖/圆周交互修复
- 模块化:EdcModule 契约 + registry + 模块独立目录;发布包增加 modules/registry.json - 更名:PDS流程设计套件 / ProcessDesignSuite;同步构建、发布脚本与文档 - 时序图:依赖偏移以时间显示/编辑;紧贴依赖隐藏箭头并在接缝显示标签;动作条磁吸 - 圆周:依赖标签沿圆弧方向、环间空隙;动作旋转磁吸增强;短弧标签优先动作名 - 清理:release 移至源码同级(本地不入库);tool 合并到 tools;发布说明迁移 docs/release-notes
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
// 依赖编辑:修改已有依赖的类型 / 偏移 / 前置动作,并保留手动走线偏移。
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:sequence_diagram/model/models.dart';
|
||||
import 'package:sequence_diagram/state/app_controller.dart';
|
||||
|
||||
Project _project() {
|
||||
Action a(String id, double start) => Action(
|
||||
id: id,
|
||||
name: id,
|
||||
stationId: 'ST1',
|
||||
driver: '',
|
||||
startAngle: start,
|
||||
durationAngle: 30,
|
||||
layer: 0,
|
||||
color: 0xFF4CC9F0,
|
||||
);
|
||||
return Project(
|
||||
name: 'dep-edit',
|
||||
cycle: const Cycle(durationMs: 2400),
|
||||
stations: const <Station>[
|
||||
Station(id: 'ST1', name: 'S', order: 0, color: 0xFF4CC9F0),
|
||||
],
|
||||
actions: <Action>[a('A1', 0), a('A2', 60), a('A3', 120)],
|
||||
units: const UnitSettings(),
|
||||
viewState: const ViewState(mode: ViewMode.bar),
|
||||
);
|
||||
}
|
||||
|
||||
void main() {
|
||||
test('updateDependency:修改类型与偏移,保留走线偏移', () {
|
||||
final AppController c = AppController(project: _project());
|
||||
addTearDown(c.dispose);
|
||||
c.addDependency('A1', 'A2', DepType.fs, 0);
|
||||
c.setDependencyOffset('A1', 'A2', 30);
|
||||
c.updateDependency(
|
||||
'A1',
|
||||
'A2',
|
||||
fromId: 'A1',
|
||||
type: DepType.ss,
|
||||
offset: 12,
|
||||
);
|
||||
final Dependency d =
|
||||
c.project.actionById('A2')!.deps.firstWhere((Dependency d) => d.fromId == 'A1');
|
||||
expect(d.type, DepType.ss);
|
||||
expect(d.offsetAngle, 12);
|
||||
expect(d.routeOffset, 30);
|
||||
});
|
||||
|
||||
test('修改循环时长:依赖偏移的时间保持不变', () {
|
||||
final AppController c = AppController(project: _project());
|
||||
addTearDown(c.dispose);
|
||||
c.addDependency('A1', 'A2', DepType.ss, 50);
|
||||
c.setCycleDuration(4800);
|
||||
Dependency d =
|
||||
c.project.actionById('A2')!.deps.firstWhere((Dependency d) => d.fromId == 'A1');
|
||||
// 2400ms 下 50° = 0.333s;换成 4800ms 后角度应减半,时间不变。
|
||||
expect(d.offsetAngle, closeTo(25, 0.001));
|
||||
c.setCycleDuration(2400);
|
||||
d = c.project.actionById('A2')!.deps.firstWhere((Dependency d) => d.fromId == 'A1');
|
||||
expect(d.offsetAngle, closeTo(50, 0.001));
|
||||
});
|
||||
|
||||
test('updateDependency:更换前置动作时去重并合并', () {
|
||||
final AppController c = AppController(project: _project());
|
||||
addTearDown(c.dispose);
|
||||
c.addDependency('A1', 'A2', DepType.fs, 0);
|
||||
c.addDependency('A3', 'A2', DepType.ss, 5);
|
||||
c.updateDependency(
|
||||
'A1',
|
||||
'A2',
|
||||
fromId: 'A3',
|
||||
type: DepType.ff,
|
||||
offset: 7,
|
||||
);
|
||||
final List<Dependency> deps = c.project.actionById('A2')!.deps;
|
||||
expect(deps.where((Dependency d) => d.fromId == 'A1'), isEmpty);
|
||||
final List<Dependency> from3 =
|
||||
deps.where((Dependency d) => d.fromId == 'A3').toList();
|
||||
expect(from3.length, 1);
|
||||
expect(from3.single.type, DepType.ff);
|
||||
expect(from3.single.offsetAngle, 7);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user