garage_auth, garage_entitlements, garage_iap and garage_ui, moved out of Garage-Services and Metro-Map-Maker into one public repo. MIT, one readme, docs under docs/. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013F4NWNvYcdeSgqbWMT1VQ7
44 lines
1.5 KiB
Dart
44 lines
1.5 KiB
Dart
import "package:flutter_test/flutter_test.dart";
|
|
import "package:garage_ui/theme/theme_data.dart";
|
|
|
|
// The whole point of the ladder: text that isn't in a control has to stay in
|
|
// step with the control font. If someone retunes fontSize and textXs stops
|
|
// tracking it, a dialog title drifts away from the button under it again.
|
|
void main() {
|
|
for (final d in const [Density(), Density.normal()]) {
|
|
final name = d.control.name;
|
|
|
|
test("$name: textXs sits a step above the control font", () {
|
|
expect(d.textXs, greaterThan(d.fontSize),
|
|
reason: "dialog copy is meant to read larger than a button label");
|
|
});
|
|
|
|
test("$name: the ladder climbs and stays on whole pixels", () {
|
|
final steps = [d.textXs, d.textSm, d.textLg];
|
|
for (var i = 1; i < steps.length; i++) {
|
|
expect(steps[i], greaterThan(steps[i - 1]));
|
|
}
|
|
for (final s in steps) {
|
|
expect(s, s.roundToDouble(), reason: "$s is not a whole pixel");
|
|
}
|
|
});
|
|
}
|
|
|
|
test("the two larger tiers keep the values they replaced", () {
|
|
// these were hardcoded 12/14/18 - a retune of fontSize is meant to move
|
|
// them, but at the shipped densities they must not shift at all.
|
|
for (final d in const [Density(), Density.normal()]) {
|
|
expect(d.textXs, 11.0);
|
|
expect(d.textSm, 14.0);
|
|
expect(d.textLg, 18.0);
|
|
}
|
|
});
|
|
|
|
test("a retuned density carries the whole ladder with it", () {
|
|
const big = Density(fontSize: 20);
|
|
expect(big.textXs, 22.0);
|
|
expect(big.textSm, 28.0);
|
|
expect(big.textLg, 36.0);
|
|
});
|
|
}
|