|
22 | 22 | // HAND-OFF provenance: lib/app → app-architect; lib/pble → app-protocol-engineer. |
23 | 23 |
|
24 | 24 | import 'package:flutter/material.dart'; |
| 25 | +import 'package:flutter/rendering.dart'; |
25 | 26 | import 'package:flutter_test/flutter_test.dart'; |
26 | 27 |
|
27 | 28 | import 'package:pyble/app/app.dart'; |
@@ -231,6 +232,7 @@ void main() { |
231 | 232 | ); |
232 | 233 |
|
233 | 234 | final AppLocalizations l10n = _l10n(tester); |
| 235 | + expect(_pillLabel('Ready'), findsOneWidget); |
234 | 236 | expect( |
235 | 237 | find.descendant( |
236 | 238 | of: find.byKey(_pillKey), |
@@ -283,6 +285,108 @@ void main() { |
283 | 285 | expect(find.byTooltip('Disconnect'), findsOneWidget); |
284 | 286 | }, |
285 | 287 | ); |
| 288 | + |
| 289 | + testWidgets( |
| 290 | + 'Connect-to-IDE transition retains identity in ready and running', |
| 291 | + (tester) async { |
| 292 | + final FakeConnection connection = fakeConnection( |
| 293 | + initial: ConnState.connecting, |
| 294 | + info: fakeDeviceInfo(deviceId: '5646', agentVersion: '0.6.0'), |
| 295 | + ); |
| 296 | + final PbleConnectionManager manager = await pumpShell( |
| 297 | + tester, |
| 298 | + connection: connection, |
| 299 | + surface: ipadLandscape, |
| 300 | + ); |
| 301 | + |
| 302 | + final AppLocalizations l10n = _l10n(tester); |
| 303 | + expect( |
| 304 | + find.text(l10n.connectEmptyTitle), |
| 305 | + findsOneWidget, |
| 306 | + reason: 'the pre-connection Connect surface starts mounted', |
| 307 | + ); |
| 308 | + |
| 309 | + await manager.connect('shell-transition-board'); |
| 310 | + connection.emit(ConnState.ready); |
| 311 | + await tester.pumpAndSettle(); |
| 312 | + |
| 313 | + expect(find.text(l10n.connectEmptyTitle), findsNothing); |
| 314 | + expect(find.text(l10n.connectDeviceInfoTitle), findsNothing); |
| 315 | + expect(_pillLabel('Ready'), findsOneWidget); |
| 316 | + expect( |
| 317 | + find.text(l10n.connStatusBoardInfoSummary('5646', '0.6.0')), |
| 318 | + findsOneWidget, |
| 319 | + ); |
| 320 | + expect( |
| 321 | + find.bySemanticsLabel( |
| 322 | + l10n.connStatusBoardInfoSemanticLabel('Ready', '5646', '0.6.0'), |
| 323 | + ), |
| 324 | + findsOneWidget, |
| 325 | + ); |
| 326 | + |
| 327 | + connection.emit(ConnState.running); |
| 328 | + await tester.pumpAndSettle(); |
| 329 | + |
| 330 | + expect(_pillLabel('Running'), findsOneWidget); |
| 331 | + expect( |
| 332 | + find.text(l10n.connStatusBoardInfoSummary('5646', '0.6.0')), |
| 333 | + findsOneWidget, |
| 334 | + ); |
| 335 | + expect( |
| 336 | + find.bySemanticsLabel( |
| 337 | + l10n.connStatusBoardInfoSemanticLabel('Running', '5646', '0.6.0'), |
| 338 | + ), |
| 339 | + findsOneWidget, |
| 340 | + ); |
| 341 | + }, |
| 342 | + ); |
| 343 | + |
| 344 | + testWidgets('tight 2x layout ellipsizes identity but not state', ( |
| 345 | + tester, |
| 346 | + ) async { |
| 347 | + tester.platformDispatcher.textScaleFactorTestValue = 2; |
| 348 | + addTearDown(tester.platformDispatcher.clearTextScaleFactorTestValue); |
| 349 | + const String longId = 'BOARD-IDENTITY-1234567890'; |
| 350 | + const String longVersion = '0.6.0-development-metadata'; |
| 351 | + |
| 352 | + await pumpShell( |
| 353 | + tester, |
| 354 | + connection: fakeConnection( |
| 355 | + initial: ConnState.ready, |
| 356 | + info: fakeDeviceInfo(deviceId: longId, agentVersion: longVersion), |
| 357 | + ), |
| 358 | + surface: phonePortrait, |
| 359 | + ); |
| 360 | + |
| 361 | + final AppLocalizations l10n = _l10n(tester); |
| 362 | + final Finder stateFinder = _pillLabel('Ready'); |
| 363 | + final Finder summaryFinder = find.descendant( |
| 364 | + of: find.byKey(_pillKey), |
| 365 | + matching: find.text( |
| 366 | + l10n.connStatusBoardInfoSummary(longId, longVersion), |
| 367 | + ), |
| 368 | + ); |
| 369 | + expect(stateFinder, findsOneWidget); |
| 370 | + expect(summaryFinder, findsOneWidget); |
| 371 | + expect( |
| 372 | + tester.renderObject<RenderParagraph>(stateFinder).didExceedMaxLines, |
| 373 | + isFalse, |
| 374 | + reason: 'the full state word is the non-negotiable minimum signal', |
| 375 | + ); |
| 376 | + expect( |
| 377 | + tester.renderObject<RenderParagraph>(summaryFinder).didExceedMaxLines, |
| 378 | + isTrue, |
| 379 | + reason: 'only the appended identity may ellipsize under pressure', |
| 380 | + ); |
| 381 | + expect( |
| 382 | + find.bySemanticsLabel( |
| 383 | + l10n.connStatusBoardInfoSemanticLabel('Ready', longId, longVersion), |
| 384 | + ), |
| 385 | + findsOneWidget, |
| 386 | + reason: 'visual ellipsis must not truncate accessibility metadata', |
| 387 | + ); |
| 388 | + expect(tester.takeException(), isNull); |
| 389 | + }); |
286 | 390 | }); |
287 | 391 |
|
288 | 392 | group('FR-UI-1 collapsible landscape Files sidebar', () { |
|
0 commit comments