Files
FlClash/test/lint/material_icons_test.dart
T
chen08209 ee6a49713a feat(ui): draw the app's own glyphs and redraw the theme page
Drops the Material compatibility bridge and the icon font.

Changelog: New app glyphs, empty states and theme page
2026-10-02 02:51:32 +08:00

32 lines
904 B
Dart

import 'dart:io';
import 'package:test/test.dart';
final _materialIcon = RegExp(r'\b(?:Animated)?Icons\.\w+');
void main() {
test('lib draws its icons from AppGlyphs, not Material icons', () {
final offenders = <String>[];
for (final entity in Directory('lib').listSync(recursive: true)) {
if (entity is! File ||
!entity.path.endsWith('.dart') ||
entity.path.contains('/generated/')) {
continue;
}
final lines = entity.readAsLinesSync();
for (var i = 0; i < lines.length; i++) {
final match = _materialIcon.firstMatch(lines[i]);
if (match != null) {
offenders.add(
'${entity.path}:${i + 1} — ${match[0]} is a Material icon; '
'draw it in AppGlyphs and show it with GlyphIcon.',
);
}
}
}
expect(offenders, isEmpty, reason: offenders.join('\n'));
});
}