Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions lib/features/workspace/results_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ class _ResultsTabState extends material.State<ResultsTab> {
padding: const material.EdgeInsets.all(32),
child: material.Column(
mainAxisAlignment: material.MainAxisAlignment.center,
mainAxisSize: material.MainAxisSize.min,
children: [
material.Icon(
material.Icons.error_outline_rounded,
Expand All @@ -288,11 +289,15 @@ class _ResultsTabState extends material.State<ResultsTab> {
const Gap(16),
const Text('Query Error').large().semiBold(),
const Gap(8),
VirtualSelectableTextView(
text: widget.errorMessage!,
style: material.TextStyle(
color: Theme.of(context).colorScheme.mutedForeground,
fontSize: 13,
// A long driver message scrolls inside the space left, instead
// of pushing the column past the pane.
material.Flexible(
child: VirtualSelectableTextView(
text: widget.errorMessage!,
style: material.TextStyle(
color: Theme.of(context).colorScheme.mutedForeground,
fontSize: 13,
),
),
),
if (widget.errorAction != null) ...[
Expand Down
37 changes: 37 additions & 0 deletions test/features/workspace/results_tab_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,43 @@ void main() {
);
});

testWidgets('a long error scrolls inside a short pane without overflow',
(tester) async {
final longError = [
for (var i = 0; i < 40; i++)
'SqliteException(1): while preparing statement, no such table, '
'line $i of the driver message',
].join('\n');
await tester.pumpWidget(
resultsShell(
child: material.Scaffold(
body: material.Center(
child: material.SizedBox(
width: 600,
height: 300,
child: ResultsTab(
isLoading: false,
errorMessage: longError,
),
),
),
),
),
);
await tester.pumpAndSettle();

expect(tester.takeException(), isNull);
expect(
find.byKey(const material.ValueKey('results_mode_error')),
findsOneWidget,
);
final pane = tester.getRect(find.byType(ResultsTab));
final error = tester.getRect(
find.byKey(const material.ValueKey('results_mode_error')),
);
expect(error.bottom, lessThanOrEqualTo(pane.bottom));
});

testWidgets('shows idle / loading / error / grid mode keys', (tester) async {
await tester.pumpWidget(
resultsShell(
Expand Down
Loading