/// T-319: loadDrawingImages decodes the annotated `` hrefs a drawing /// card references, skipping files it can't read — the resolver the compare /// card and lightbox paint through. library; import 'dart:async'; import 'dart:typed_data'; import 'dart:ui' as ui; import 'package:clide/builtin/claude/src/conversation_view.dart' show loadDrawingImages; import 'package:clide/src/svg/svg_document.dart' show buildSvgDocument; import 'package:flutter_test/flutter_test.dart'; Future _pixelImage() { final c = Completer(); ui.decodeImageFromPixels(Uint8List(4), 1, 1, ui.PixelFormat.rgba8888, c.complete); return c.future; } void main() { TestWidgetsFlutterBinding.ensureInitialized(); test('decodes annotated image hrefs and skips a missing file', () async { final img = await _pixelImage(); final doc = buildSvgDocument( '' '' '' '', ); final imgs = await loadDrawingImages( doc, load: (p) async => p == 'a.png' ? Uint8List(4) : null, // gone.png → null → skipped decode: (_) async => img, ); expect(imgs.keys.toList(), ['a.png']); expect(imgs['a.png'], same(img)); img.dispose(); }); test('a doc with no image references loads nothing', () async { final doc = buildSvgDocument(''); expect(await loadDrawingImages(doc, load: (_) async => Uint8List(4)), isEmpty); }); }