fix(todo): Today's tab centres its day in the calendar
The day stood on the calendar's bottom edge: a line box's place in the space below the calendar's line was the font's to choose. It is placed by its baseline now. Whats-New: Today's tab shows its day centred in the calendar. Whats-New-De: Der Heute-Tab zeigt den Tag mittig im Kalender. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
53313978f1
commit
6ee7aeabc0
1 changed files with 63 additions and 16 deletions
|
|
@ -0,0 +1,36 @@
|
|||
import 'package:clock/clock.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:halkyon_todo_flutter/src/tabs/today_icon.dart';
|
||||
import 'package:material_ui/material_ui.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets("the day's digits stand centred below the calendar's line, "
|
||||
"whatever the font's line box (the developer's review, 5 Nov 2026)", (
|
||||
tester,
|
||||
) async {
|
||||
await tester.pumpWidget(
|
||||
const Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: IconTheme(
|
||||
data: IconThemeData(size: 24),
|
||||
child: Center(child: TodayIcon()),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final icon = tester.getTopLeft(find.byType(TodayIcon));
|
||||
final day = find.text('${clock.now().day}');
|
||||
final measured = TextPainter(
|
||||
text: TextSpan(text: '5', style: tester.widget<Text>(day).style),
|
||||
textDirection: TextDirection.ltr,
|
||||
)..layout();
|
||||
addTearDown(measured.dispose);
|
||||
final baseline =
|
||||
tester.getTopLeft(day).dy +
|
||||
measured.computeDistanceToActualBaseline(TextBaseline.alphabetic) -
|
||||
icon.dy;
|
||||
|
||||
// The digits, 0.714 of 9.6 units high, between the strokes at 11 and 21.
|
||||
expect(baseline, moreOrLessEquals(19.43, epsilon: 0.01));
|
||||
});
|
||||
}
|
||||
Loading…
Reference in a new issue