如何使用Flutter中呈现良好的字体进行黄金测试?
在不使用Flatter测试中默认的纯正方形字体“Ahem”的情况下渲染图像需要采取哪些步骤?这对我来说很有用: 创建如何使用Flutter中呈现良好的字体进行黄金测试?,flutter,flutter-test,Flutter,Flutter Test,在不使用Flatter测试中默认的纯正方形字体“Ahem”的情况下渲染图像需要采取哪些步骤?这对我来说很有用: 创建test/flatter\u test\u config.dart import 'dart:async'; import 'dart:io'; import 'package:golden_toolkit/golden_toolkit.dart'; Future<void> testExecutable(FutureOr<void> Function(
test/flatter\u test\u config.dart
import 'dart:async';
import 'dart:io';
import 'package:golden_toolkit/golden_toolkit.dart';
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
return GoldenToolkit.runWithConfiguration(
() async {
await loadAppFonts();
await testMain();
},
config: GoldenToolkitConfiguration(
// Currently, goldens are not generated/validated in CI for this repo. We have settled on the goldens for this package
// being captured/validated by developers running on MacOSX. We may revisit this in the future if there is a reason to invest
// in more sophistication
skipGoldenAssertion: () => !Platform.isMacOS,
),
);
}
创建目录:mkdir资产/{images,fonts}
并下载到font-dir中
确保那可能是空的这对我来说很有用: 创建
test/flatter\u test\u config.dart
import 'dart:async';
import 'dart:io';
import 'package:golden_toolkit/golden_toolkit.dart';
Future<void> testExecutable(FutureOr<void> Function() testMain) async {
return GoldenToolkit.runWithConfiguration(
() async {
await loadAppFonts();
await testMain();
},
config: GoldenToolkitConfiguration(
// Currently, goldens are not generated/validated in CI for this repo. We have settled on the goldens for this package
// being captured/validated by developers running on MacOSX. We may revisit this in the future if there is a reason to invest
// in more sophistication
skipGoldenAssertion: () => !Platform.isMacOS,
),
);
}
创建目录:mkdir资产/{images,fonts}
并下载到font-dir中
一定要把它弄空