@@ -36,6 +36,13 @@ import 'package:pyble/pble/pble.dart';
3636import '../support/feature_harness.dart' ;
3737import '../support/recording_connection.dart' ;
3838
39+ const Key _normalActionsRowKey = ValueKey <String >('filesNormalActionsRow' );
40+ const Key _actionsOverflowKey = ValueKey <String >('filesActionsOverflowButton' );
41+ const Key _overflowRefreshKey = ValueKey <String >('filesOverflowRefresh' );
42+ const Key _overflowNewFileKey = ValueKey <String >('filesOverflowNewFile' );
43+ const Key _overflowNewFolderKey = ValueKey <String >('filesOverflowNewFolder' );
44+ const Key _overflowUploadKey = ValueKey <String >('filesOverflowUpload' );
45+
3946/// Records a deterministic fail-fast boundary without changing the shared
4047/// connection test double. Files before [failPath] delete normally; that path
4148/// records its attempted verb and fails, so later files must remain untouched.
@@ -147,6 +154,17 @@ void main() {
147154 );
148155 }
149156
157+ void expectOneHorizontalLine (WidgetTester tester, List <Finder > actions) {
158+ final List <double > centers = actions
159+ .map ((Finder action) => tester.getCenter (action).dy)
160+ .toList (growable: false );
161+ expect (
162+ centers.map ((double center) => (center - centers.first).abs ()),
163+ everyElement (lessThan (0.1 )),
164+ reason: 'normal Files actions must share exactly one horizontal row' ,
165+ );
166+ }
167+
150168 Future <void > enterSelection (WidgetTester tester) async {
151169 await tester.tap (find.byKey (kFilesSelectActionKey));
152170 await tester.pumpAndSettle ();
@@ -191,6 +209,154 @@ void main() {
191209 );
192210 });
193211
212+ testWidgets (
213+ 'compact toolbar keeps Select and GitHub direct on one action row' ,
214+ (WidgetTester tester) async {
215+ final RecordingConnection rec = RecordingConnection (
216+ initial: ConnState .ready,
217+ );
218+ addTearDown (rec.dispose);
219+ await rec.putFile ('/alpha.py' , b ('print("alpha")\n ' ));
220+ await pumpSurface (
221+ tester,
222+ const FilesView (),
223+ connection: rec,
224+ size: const Size (252 , 568 ),
225+ );
226+ await tester.pumpAndSettle ();
227+ final AppLocalizations l10n = l10nOf (tester);
228+
229+ final Finder select = find.byTooltip (l10n.filesActionSelect);
230+ final Finder github = find.byTooltip (l10n.githubImportAction);
231+ final Finder overflow = find.byKey (_actionsOverflowKey);
232+ expect (find.byKey (_normalActionsRowKey), findsOneWidget);
233+ expect (select, findsOneWidget);
234+ expect (github, findsOneWidget);
235+ expect (overflow, findsOneWidget);
236+ expect (find.byTooltip (l10n.filesActionRefresh), findsNothing);
237+ expect (find.byTooltip (l10n.filesEmptyCta), findsNothing);
238+ expect (find.byTooltip (l10n.filesActionNewFolder), findsNothing);
239+ expect (find.byTooltip (l10n.filesActionUpload), findsNothing);
240+ expectOneHorizontalLine (tester, < Finder > [select, github, overflow]);
241+ expect (tester.getSize (find.byKey (_normalActionsRowKey)).height, 48 );
242+ expectTouchTarget (tester, select, 'compact Select' );
243+ expectTouchTarget (tester, github, 'compact GitHub import' );
244+ expectTouchTarget (tester, overflow, 'compact overflow' );
245+ expect (tester.getSemantics (overflow).label, l10n.filesMoreActions);
246+ expect (tester.takeException (), isNull);
247+ },
248+ );
249+
250+ testWidgets (
251+ 'compact overflow labels and routes every lower-frequency action' ,
252+ (WidgetTester tester) async {
253+ final _HeldListConnection rec = _HeldListConnection ();
254+ addTearDown (() async {
255+ if (! rec.releaseList.isCompleted) rec.releaseList.complete ();
256+ await rec.dispose ();
257+ });
258+ await rec.putFile ('/alpha.py' , b ('a\n ' ));
259+ await pumpSurface (
260+ tester,
261+ const FilesView (),
262+ connection: rec,
263+ size: const Size (252 , 568 ),
264+ );
265+ await tester.pumpAndSettle ();
266+ final AppLocalizations l10n = l10nOf (tester);
267+
268+ await tester.tap (find.byKey (_actionsOverflowKey));
269+ await tester.pumpAndSettle ();
270+
271+ for (final (Key key, String label) in < (Key , String )> [
272+ (_overflowRefreshKey, l10n.filesActionRefresh),
273+ (_overflowNewFileKey, l10n.filesEmptyCta),
274+ (_overflowNewFolderKey, l10n.filesActionNewFolder),
275+ (_overflowUploadKey, l10n.filesActionUpload),
276+ ]) {
277+ final Finder item = find.byKey (key);
278+ expect (item, findsOneWidget);
279+ expect (
280+ find.descendant (of: item, matching: find.text (label)),
281+ findsOneWidget,
282+ );
283+ expectTouchTarget (tester, item, label);
284+ }
285+
286+ rec.holdNextList ();
287+ await tester.tap (find.byKey (_overflowRefreshKey));
288+ await rec.listStarted.future;
289+ expect (find.byKey (_actionsOverflowKey), findsOneWidget);
290+ rec.releaseList.complete ();
291+ await tester.pumpAndSettle ();
292+ expect (tester.takeException (), isNull);
293+ },
294+ );
295+
296+ testWidgets ('roomy toolbar exposes all six actions on one row' , (
297+ WidgetTester tester,
298+ ) async {
299+ final RecordingConnection rec = RecordingConnection (
300+ initial: ConnState .ready,
301+ );
302+ addTearDown (rec.dispose);
303+ await rec.putFile ('/alpha.py' , b ('a\n ' ));
304+ await pumpSurface (
305+ tester,
306+ const FilesView (),
307+ connection: rec,
308+ size: const Size (600 , 568 ),
309+ );
310+ await tester.pumpAndSettle ();
311+ final AppLocalizations l10n = l10nOf (tester);
312+ final List <Finder > actions = < Finder > [
313+ find.byTooltip (l10n.filesActionSelect),
314+ find.byTooltip (l10n.filesActionRefresh),
315+ find.byTooltip (l10n.filesEmptyCta),
316+ find.byTooltip (l10n.filesActionNewFolder),
317+ find.byTooltip (l10n.filesActionUpload),
318+ find.byTooltip (l10n.githubImportAction),
319+ ];
320+
321+ expect (find.byKey (_actionsOverflowKey), findsNothing);
322+ for (final Finder action in actions) {
323+ expect (action, findsOneWidget);
324+ expectTouchTarget (tester, action, 'roomy Files action' );
325+ }
326+ expectOneHorizontalLine (tester, actions);
327+ expect (tester.getSize (find.byKey (_normalActionsRowKey)).height, 48 );
328+ expect (tester.takeException (), isNull);
329+ });
330+
331+ testWidgets ('compact overflow remains usable at 2x text' , (
332+ WidgetTester tester,
333+ ) async {
334+ tester.platformDispatcher.textScaleFactorTestValue = 2 ;
335+ addTearDown (tester.platformDispatcher.clearTextScaleFactorTestValue);
336+ final RecordingConnection rec = RecordingConnection (
337+ initial: ConnState .ready,
338+ );
339+ addTearDown (rec.dispose);
340+ await rec.putFile ('/alpha.py' , b ('a\n ' ));
341+ await pumpSurface (
342+ tester,
343+ const FilesView (),
344+ connection: rec,
345+ size: const Size (252 , 568 ),
346+ );
347+ await tester.pumpAndSettle ();
348+ final AppLocalizations l10n = l10nOf (tester);
349+
350+ await tester.tap (find.byKey (_actionsOverflowKey));
351+ await tester.pumpAndSettle ();
352+
353+ expect (find.text (l10n.filesActionRefresh), findsOneWidget);
354+ expect (find.text (l10n.filesEmptyCta), findsOneWidget);
355+ expect (find.text (l10n.filesActionNewFolder), findsOneWidget);
356+ expect (find.text (l10n.filesActionUpload), findsOneWidget);
357+ expect (tester.takeException (), isNull);
358+ });
359+
194360 testWidgets ('lists the fsRoot entries when connected' , (
195361 WidgetTester tester,
196362 ) async {
0 commit comments