flutter/dev/tools/test/update_icons_test.dart
Pierre-Louis 7855132341
Generate a demo for new icons when updating icons (#101190)
* add code to generate new icon demo and make font family optional

* remove trailing spaces

* Update update_icons_test.dart

* remove trailing space
2022-04-05 12:56:23 +02:00

62 lines
1.6 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:test/test.dart';
import '../update_icons.dart';
Map<String, String> codepointsA = <String, String>{
'airplane': '111',
'boat': '222',
};
Map<String, String> codepointsB = <String, String>{
'airplane': '333',
};
Map<String, String> codepointsC = <String, String>{
'airplane': '111',
'train': '444',
};
void main() {
group('safety checks', () {
test('superset', () {
expect(testIsSuperset(codepointsA, codepointsA), true);
expect(testIsSuperset(codepointsA, codepointsB), true);
expect(testIsSuperset(codepointsB, codepointsA), false);
});
test('stability', () {
expect(testIsStable(codepointsA, codepointsA), true);
expect(testIsStable(codepointsA, codepointsB), false);
expect(testIsStable(codepointsB, codepointsA), false);
expect(testIsStable(codepointsA, codepointsC), true);
expect(testIsStable(codepointsC, codepointsA), true);
});
});
test('no double underscores', () {
expect(Icon.generateFlutterId('abc__123'), 'abc_123');
});
test('usage string is correct', () {
expect(
Icon(const MapEntry<String, String>('abc', '')).usage,
'Icon(Icons.abc),',
);
});
test('usage string is correct with replacement', () {
expect(
Icon(const MapEntry<String, String>('123', '')).usage,
'Icon(Icons.onetwothree),',
);
expect(
Icon(const MapEntry<String, String>('123_rounded', '')).usage,
'Icon(Icons.onetwothree_rounded),',
);
});
}