testing library

Checks for skribble interfaces: whether text keeps the ink's breathing room inside hand-drawn borders, and whether it reflows on narrow screens.

The checks read a laid-out render tree, so they work in widget tests and need no extra dependencies:

// Static example: test
testWidgets('the settings screen keeps the ink padding', (tester) async {
  await tester.pumpWidget(const SettingsApp());
  final root = tester.binding.renderViews.first;
  expect(crampedText(root), isEmpty);
  expect(squeezedText(root), isEmpty);
});

Classes

CrampedText
Text that sits too close to the hand-drawn line around it, found by crampedText.

Functions

crampedText(RenderObject root, {double? vertical, double? horizontal}) → List<CrampedText>
Text under root whose glyphs come within vertical pixels of the top or bottom, or horizontal pixels of the sides, of the smallest hand-drawn border around it, or spill past it. The defaults are kWiredInkPadding, the space every skribble control keeps.
squeezedText(RenderObject root, {double width = 140, int lines = 4}) → List<String>
Paragraphs squeezed into a narrow column, lines lines or more in less than width pixels: the sign of a layout that should reflow, such as actions that ought to move below their message on a phone.