fix(#1273): one triangle signal glyph per strength level
The signal helper drew a triangle at the top tier and bars below it, and the two lowest tiers shared one glyph. Every tier now uses the Material Symbols triangle family (4 bars down to 0, and "off" for no reading), filled, through one SignalIcon widget at all five call sites. Regression test signal_ui_test.dart: distinct glyph per tier, one family, filled, and no screen draws a signal glyph outside SignalIcon. Against dev's icons 3 of 4 cases fail. Epic: #1272 Agent: StormyElk (session 088ce922)pull/1353/head
parent
ce8da46764
commit
77572a7cd5
@ -0,0 +1,46 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:meshcore_open/widgets/signal_ui.dart';
|
||||
import 'package:meshcore_open/widgets/snr_indicator.dart';
|
||||
|
||||
// #1273: the signal glyph switched from a triangle at the top tier to bars
|
||||
// below it, and the two lowest tiers shared one glyph.
|
||||
void main() {
|
||||
final family = Symbols.signal_cellular_4_bar.fontFamily;
|
||||
|
||||
test('every tier has its own glyph, all from one family', () {
|
||||
final icons = [for (var t = 0; t < 5; t++) signalUiForStrengthTier(t).icon];
|
||||
expect(icons.toSet().length, 5);
|
||||
for (final icon in icons) {
|
||||
expect(icon.fontFamily, family);
|
||||
}
|
||||
});
|
||||
|
||||
test('no reading uses the same family', () {
|
||||
expect(snrUiFromSNR(null, 10).icon.fontFamily, family);
|
||||
});
|
||||
|
||||
testWidgets('SignalIcon draws the glyph filled', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: SignalIcon(Symbols.signal_cellular_2_bar, color: Colors.amber),
|
||||
),
|
||||
);
|
||||
expect(tester.widget<Icon>(find.byType(Icon)).fill, 1);
|
||||
});
|
||||
|
||||
test('no screen draws a signal glyph outside SignalIcon', () {
|
||||
final offenders = <String>[];
|
||||
final pattern = RegExp(
|
||||
r'Icons\.signal_cellular|\bIcon\(\s*(snrUi|signalUi)\.icon',
|
||||
);
|
||||
for (final f in Directory('lib').listSync(recursive: true)) {
|
||||
if (f is! File || !f.path.endsWith('.dart')) continue;
|
||||
if (pattern.hasMatch(f.readAsStringSync())) offenders.add(f.path);
|
||||
}
|
||||
expect(offenders, isEmpty);
|
||||
});
|
||||
}
|
||||
Loading…
Reference in new issue