devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Golden image testing for icons

Open DaveShuckerow opened this issue 6 years ago • 0 comments

Golden image testing in Flutter is very easy, and it uses the same golden file update infrastructure we're already using.

In a test file:

testWidgets('widgetToTest looks correct', (tester) async {
  await tester.pumpWidget(widgetToTest);
  await expectLater(find.byType(WidgetToTest), 
  matchesGoldenFile('goldens/widget_to_test.png');
});

See https://github.com/flutter/devtools/commit/ba526fe1045efc40bec941b8269c56eb366aea38 for a sample.

We can use this for the Icons.

Note that Flutter tests by default will use a placebo font that shows squares for all characters. If we care about testing what the icons look like in addition to how we're drawing them, we will need to do some additional work to load the icon fonts.

DaveShuckerow avatar Oct 15 '19 19:10 DaveShuckerow