v1.3.10: 应用身份切换 cc.sincos.edc(彻底解决桌面名称); 移除尺寸标注与图元库自定义; 修复帮助中心空白与 Windows 更新包校验

This commit is contained in:
2026-10-11 21:38:18 +08:00
parent d26991593a
commit f42caa3657
30 changed files with 143 additions and 1178 deletions
+1 -81
View File
@@ -658,87 +658,7 @@ void main() {
});
});
group('尺寸编辑(识别后图形)', () {
test('矩形宽 / 圆直径:直接缩放且中心保持', () {
const ArchShape rect = ArchShape(
id: 'D1',
type: ArchShapeType.rect,
rect: Rect.fromLTWH(100, 100, 200, 120),
);
final ArchShape w = archShapeApplyDim(rect, ArchDimKind.width, 300);
expect(w.rect.width, 300);
expect(w.rect.center, rect.rect.center);
expect(w.rect.height, 120);
final ArchShape c = archShapeApplyDim(
const ArchShape(
id: 'D2',
type: ArchShapeType.circle,
rect: Rect.fromLTWH(0, 0, 80, 80),
),
ArchDimKind.diameter,
120,
);
expect(c.rect.width, 120);
expect(c.rect.height, 120);
});
test('直线 / 曲线长度:按比例缩放保持形状', () {
const ArchShape line = ArchShape(
id: 'L1',
type: ArchShapeType.line,
rect: Rect.fromLTWH(0, 0, 100, 0),
a: Offset(0, 0),
b: Offset(100, 0),
);
expect(archShapeDimValue(line, ArchDimKind.length), 100);
final ArchShape l2 = archShapeApplyDim(line, ArchDimKind.length, 250);
expect(archShapeDimValue(l2, ArchDimKind.length), closeTo(250, 0.01));
expect(l2.rect.center, line.rect.center);
const ArchShape curve = ArchShape(
id: 'C1',
type: ArchShapeType.curve,
rect: Rect.fromLTWH(0, 0, 100, 50),
pts: <Offset>[Offset(0, 0), Offset(100, 0), Offset(100, 50)],
);
expect(archShapeLength(curve), closeTo(150, 0.01));
final ArchShape c2 = archShapeApplyDim(curve, ArchDimKind.length, 300);
expect(archShapeLength(c2), closeTo(300, 0.5));
final Rect b2 = archLinearBounds(c2);
expect(b2.width / b2.height, closeTo(2.0, 0.01));
});
test('尺寸标注 JSON 往返', () {
const ArchShape s = ArchShape(
id: 'S1',
type: ArchShapeType.rect,
rect: Rect.fromLTWH(0, 0, 100, 80),
dims: <ArchDimKind>{ArchDimKind.width, ArchDimKind.height},
);
final ArchShape back = ArchShape.fromJson(
jsonDecode(jsonEncode(s.toJson())) as Map<String, dynamic>);
expect(back.dims.contains(ArchDimKind.width), isTrue);
expect(back.dims.contains(ArchDimKind.height), isTrue);
});
test('控制器:改值缩放 + 标注开关', () {
final AppController c = AppController(project: Project.demo());
addTearDown(c.dispose);
c.addArchShape(const ArchShape(
id: 'S1',
type: ArchShapeType.rect,
rect: Rect.fromLTWH(10, 10, 100, 60),
));
c.setArchShapeDim('S1', ArchDimKind.width, 260);
expect(c.arch.shapeById('S1')!.rect.width, 260);
c.toggleArchShapeDim('S1', ArchDimKind.width);
expect(
c.arch.shapeById('S1')!.dims.contains(ArchDimKind.width), isTrue);
c.toggleArchShapeDim('S1', ArchDimKind.width);
expect(
c.arch.shapeById('S1')!.dims.contains(ArchDimKind.width), isFalse);
});
group('默认画布', () {
test('默认画布 A0:空文档内容边界 1189×841', () {
final Rect b = ArchDoc.empty.contentBounds();
expect(b.width, 1189);