Hug the turn activity row's hover on desktop

On macOS, Linux, Windows and desktop browsers the "Thought · tool calls ·
background tasks" row is as wide as its label, so its hover and click area
no longer span the transcript. Phones keep the full-width touch row. The
check uses the device platform because web themes are pinned to Android.
The scroll fixture gains ?turnactivity=1 for captures.
This commit is contained in:
2026-11-09 20:46:22 +00:00
parent 9246c168ac
commit 55ef6558e0
4 changed files with 87 additions and 0 deletions
@@ -0,0 +1,52 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/features/chat/ui/transcript/chat_turn_activity_view.dart';
Future<double> _activityWidth(
WidgetTester tester,
TargetPlatform platform,
) async {
debugDefaultTargetPlatformOverride = platform;
tester.view.physicalSize = const Size(1200, 800);
tester.view.devicePixelRatio = 1;
addTearDown(tester.view.reset);
await tester.pumpWidget(
MaterialApp(
// Web pins the theme to Android; the device platform decides.
theme: ThemeData(platform: TargetPlatform.android),
home: const Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ChatTurnActivityView(
parts: [
{'type': 'reasoning', 'text': 'Considering the files.'},
],
streaming: false,
),
],
),
),
),
);
final width = tester
.getSize(find.byKey(const Key('chat-turn-activity')))
.width;
debugDefaultTargetPlatformOverride = null;
return width;
}
void main() {
testWidgets('desktop hover hugs the activity label', (tester) async {
for (final platform in [TargetPlatform.macOS, TargetPlatform.linux]) {
expect(await _activityWidth(tester, platform), lessThan(400));
}
});
testWidgets('phones keep the full-width touch row', (tester) async {
for (final platform in [TargetPlatform.android, TargetPlatform.iOS]) {
expect(await _activityWidth(tester, platform), 1200);
}
});
}