Display-only card (D-78): renders an SvgDocument in a framed, aspect- ratio-sized region with an optional clide-themed label/description caption beneath. The SVG is content (its own palette); the frame + captions are chrome (SurfaceTokens). Widget-tested via the kernel fixture. Per-object data-* overlay and lightbox remain follow-ons. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
37 lines
1.3 KiB
Dart
37 lines
1.3 KiB
Dart
import 'package:clide/src/svg/svg_document.dart';
|
|
import 'package:clide/widgets/src/draw/drawing_card.dart';
|
|
import 'package:clide/widgets/src/svg/svg_painter.dart';
|
|
import 'package:flutter/widgets.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import '../../helpers/kernel_fixture.dart';
|
|
import '../../helpers/widget_harness.dart';
|
|
|
|
void main() {
|
|
late KernelFixture f;
|
|
setUp(() async => f = await KernelFixture.create());
|
|
tearDown(() async => f.dispose());
|
|
|
|
Widget card({String? label, String? description}) => SizedBox(
|
|
width: 400,
|
|
child: DrawingCard(
|
|
document: buildSvgDocument('<svg viewBox="0 0 20 10"><rect width="20" height="10" fill="#FF0000"/></svg>'),
|
|
label: label,
|
|
description: description,
|
|
),
|
|
);
|
|
|
|
testWidgets('renders the SVG region with both captions', (tester) async {
|
|
await tester.pumpWidget(anchoredHarness(f, card(label: 'Build pipeline', description: 'how it connects')));
|
|
expect(find.byType(SvgView), findsOneWidget);
|
|
expect(find.text('Build pipeline'), findsOneWidget);
|
|
expect(find.text('how it connects'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('omits captions when label and description are absent', (tester) async {
|
|
await tester.pumpWidget(anchoredHarness(f, card()));
|
|
expect(find.byType(SvgView), findsOneWidget);
|
|
expect(find.text('Build pipeline'), findsNothing);
|
|
});
|
|
}
|