A better font for golden tests.

Overview

Golden Bricks
A better font for golden tests.

This project is a Flutter Bounty Hunters proof-of-concept. Want font adjustments? Fund a milestone today!


Golden Bricks Font

Like the traditional Ahem font, the Golden Bricks font renders every character as a rectangle to avoid test failures due to anti-aliasing. Unlike the traditional Ahem font, the Golden Bricks font sizes each character rectangle similar to the standard English character, and also adds space between characters. As a result, text in your golden tests will be a similar size to regular text, and your test can render text selections that you can see across multiple characters.

Golen Bricks font screenshot

How to use the Golden Bricks font in an app

Use the Golden Bricks font by setting the fontFamily of a TextStyle:

Text(
  "Some text",
  style: const TextStyle(
    // The "goldenBricks" variable is a constant that's 
    // exported from the golden_bricks package.
    fontFamily: goldenBricks,
  ),
);

How to use the Golden Bricks font in golden tests

To use a font in Flutter golden tests, you must explicitly load that font before your tests run. The easiest way to load fonts for golden tests is to use the golden_toolkit package. After adding the golden_toolkit package to your test dependencies, create a flutter_test_config.dart file in your /test directory. Include the following implementation:

import 'dart:async';

import 'package:golden_toolkit/golden_toolkit.dart';

Future<void> testExecutable(FutureOr<void> Function() testMain) async {
  await loadAppFonts();
  return testMain();
}

Once the font is loaded, use the font in your tests, as desired. The easiest way to use the Golden Bricks font in a test is to configure the default theme font family to use the Golden Bricks font.

testWidgets("renders in golden tests", (tester) async {
  await tester.pumpWidget(
    MaterialApp(  
      theme: ThemeData(
        fontFamily: goldenBricks,
      ),
      home: Scaffold(
        // content
      ),
    ),
  );

  // TODO: implement the rest of the test
});
You might also like...

Fake Firebase Performance for use during Flutter unit & widget tests.

Fake Firebase Performance Fakes to write unit tests for apps using Firebase Performance monitoring. Instantiate a FakeFirebasePerformance, then pass i

Apr 16, 2022

Quizlet-Flutter - A quiz app tests the analyzing Information on Financial Statements (True or False)

Quizlet-Flutter - A quiz app tests the analyzing Information on Financial Statements (True or False)

Quizlet-Flutter This is a simple Quizlet mobile application testing your financi

Jan 19, 2022

Integration Test Preview allows tests on multiple screen sizes in a single e2e test run.

Integration Test Preview allows tests on multiple screen sizes in a single e2e test run.

Integration Test Preview has pre-configured methods that allow for faster test deployment for end to end (e2e) test coverage (using Android and iOS pl

Aug 23, 2022

Write and debug tests easily, built on integration_test

Write and debug tests easily, built on integration_test

flutter_convenient_test: Write and debug tests easily, built on integration_test Quick demo full_video.mov Have questions? Though used in production e

Dec 21, 2022

🌈 Repository for a compass project, basically an App for displaying bank transfers, with API requests, Flag persistence, Infinite Scroll, Error Handling, Unit Tests, Extract Sharing working with SOLID, BLoC and Designer Patterns.

🌈 Repository for a compass project, basically an App for displaying bank transfers, with API requests, Flag persistence, Infinite Scroll, Error Handling, Unit Tests, Extract Sharing working with SOLID, BLoC and Designer Patterns.

💸 Green Bank Aplicação desenvolvida em Flutter com intuito de trabalhar conexão com API, Gerenciamento de estado usando BLoC, Refatoração, Arquitetur

Oct 7, 2022

Chance Dart is a free Open Source project that lets you create random strings, integers, and other things to help with tiresome tasks, especially when building automated tests or wherever else you require anything random.

 Chance Dart is a free Open Source project that lets you create random strings, integers, and other things to help with tiresome tasks, especially when building automated tests or wherever else you require anything random.

Chance Dart Random generator helper for Dart Homepage • Documentation Overview Chance Dart is a free Open Source project that lets you create random s

Dec 27, 2022

Overlay/OverlayEntry, but better

Overlay/OverlayEntry, but better

Call for maintainer I (@rrousselGit) am sadly unable to maintain flutter_portal at the moment due to a lack of time, and would like to find a new main

Jan 2, 2023

An experiment in building a better XMPP client. using Flutter

An experiment in building a better XMPP client. using Flutter

moxxy An experimental XMPP client that tries to be as easy, modern and beautiful

Dec 15, 2022
Owner
Flutter Bounty Hunters
We build open source Flutter and Dart tools.
Flutter Bounty Hunters
A font catalogue app made with flutter

Fontina An app which showcases a personally curated collection of fonts. Written in flutter, cross-platform and responsive. Uses the Fontgen API to di

Shreeyans Bahadkar 54 Nov 22, 2022
A font loader to download, cache and load web fonts in flutter with support for Firebase Cloud Storage.

Dynamic Cached Fonts A simple, easy to use yet customizable font loader to use web fonts. Demo: https://sidrao2006.github.io/dynamic_cached_fonts ?? I

Aneesh Rao 18 Dec 21, 2022
Flutter screen adaptation, font adaptation, get screen information

flutter_screenutil A flutter plugin for adapting screen and font size.Let your UI display a reasonable layout on different screen sizes! Note: This pl

OpenFlutter 3.4k Jan 6, 2023
The Font Awesome Icon pack available as Flutter Icons

font_awesome_flutter The Font Awesome Icon pack available as set of Flutter Icons. Based on Font Awesome 5.15.4. Includes all free icons: Regular Soli

Flutter Community 731 Dec 28, 2022
Scale the entire UI design proportionally. Button, image, font, everything is scaled automatically

Scale the entire UI design proportionally. Button, image, font, everything is scaled automatically. Before: 250x250 square is the same size across dev

Wildcard 3 Sep 25, 2022
Create bulk instagram quotes posts with custom background, style, font, size. built using flutter

Mini Canva minicanva.com Bulk Image Generator from given list of quotes, lines ?? Purpose Etsy is an E-commerce platform where we can sell digital goo

Ashish Pipaliya 7 Oct 29, 2022
DDC Font App for iOS

DDC Font App for iOS This is the project code for DDC Font app. Do check out locally and update or refector the code with suitable message. Note on iO

Kinley Rabgay 2 Aug 31, 2022
Ozzie is your testing friend. Ozzie will take an screenshot during integration tests whenever you need. Ozzie will capture performance reports for you.

ozzie.flutter Ozzie is your testing friend. Ozzie will take an screenshot during integration tests whenever you need. Ozzie will capture performance r

Jorge Coca 40 Nov 3, 2022
Ouday 25 Dec 15, 2022