/// Infobulles des graphes (Patrick, 2026-10-17 : « il manque l'heure »). library; import 'package:etm_powersync_app/widgets/chart_tooltip.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; String _texte(InlineSpan? s) => s is TextSpan ? '${s.text ?? ''}${(s.children ?? []).map(_texte).join()}' : ''; void main() { testWidgets('l\'heure s\'écrit UNE fois, sur la première ligne affichée — pas sur une tue', (t) async { final items = itemsInfobulle('14:30', [ null, // bande invisible (couleur: Colors.amber, nom: 'Mesuré', valeur: '1,20 kW'), (couleur: Colors.yellow, nom: 'Prévu', valeur: '1,50 kW'), ]); // Alignés sur les séries touchées : fl_chart l'exige. expect(items, hasLength(3)); expect(items[0], isNull); final t1 = (items[1]!.children ?? []).map(_texte).join(); final t2 = (items[2]!.children ?? []).map(_texte).join(); expect(t1, startsWith('14:30\n')); expect(t1, contains('Mesuré 1,20 kW')); expect(t2, isNot(contains('14:30'))); }); testWidgets('une bulle de barre porte sa période en tête', (t) async { final b = itemBarre('ven. 17/10', [ (couleur: Colors.blue, nom: 'Consommation', valeur: '12,40 kWh'), ]); final t = (b.children ?? []).map(_texte).join(); expect(t, 'ven. 17/10\n● Consommation 12,40 kWh'); }); }