import 'dart:io'; import 'package:clide/src/svg/svg_document.dart'; import 'package:clide/src/svg/svg_node.dart'; import 'package:test/test.dart'; /// End-to-end: the full raw-SVG → typed-scene pipeline against a real diagram /// rendered by the `d2` binary (the output we sampled while scoping T-320). void main() { Iterable flatten(SvgNode n) sync* { yield n; if (n is SvgGroup) { for (final c in n.children) { yield* flatten(c); } } } test('builds a real d2-rendered SVG into a sane scene', () { final svg = File('test/svg/fixtures/d2_pipeline.svg').readAsStringSync(); final doc = buildSvgDocument(svg); final nodes = flatten(doc.root).toList(); expect(doc.viewBox, isNotNull, reason: 'd2 sets a viewBox'); // The four pipeline labels render as . final labels = nodes.whereType().map((t) => t.text).toSet(); expect(labels, containsAll(['fetch', 'build', 'test', 'deploy'])); // The node boxes render as . expect(nodes.whereType(), isNotEmpty); // The edges render as , and their class-driven fill resolved to ARGB // (proves the