From f2284d5529e811f8108ffc5dd954ee17f0171274 Mon Sep 17 00:00:00 2001 From: ZhuchkaTriplesix Date: Sun, 11 Oct 2026 16:30:28 +0300 Subject: [PATCH] fix(ui): SQL toolbar row states its control size, test one height The row had no hand-written sizes and happened to be md; it is now inside a QueryaControlScope(md) and a test measures the run split button, the explain button, the editor icon buttons and the session menu at 32 px. Refs #1439 --- .../workspace/sql_workspace_toolbar.dart | 8 ++- .../workspace/sql_workspace_toolbar_test.dart | 50 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/lib/features/workspace/sql_workspace_toolbar.dart b/lib/features/workspace/sql_workspace_toolbar.dart index f129214e..dfd03326 100644 --- a/lib/features/workspace/sql_workspace_toolbar.dart +++ b/lib/features/workspace/sql_workspace_toolbar.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:flutter/material.dart' as material; +import 'package:querya_desktop/core/ui/querya_control_tokens.dart'; import 'package:querya_desktop/features/settings/preferences_dialog.dart'; import 'package:querya_desktop/features/settings/sql_statement_timeout_dropdown.dart'; import 'package:querya_desktop/features/workspace/sql_execution_delegate.dart'; @@ -149,7 +150,11 @@ class SqlWorkspaceToolbar extends StatelessWidget { return material.LayoutBuilder( builder: (context, constraints) { final compact = constraints.maxWidth < compactWidthBreakpoint; - return material.SingleChildScrollView( + // One size for the whole row: the run split button, the buttons, the + // icon buttons and the session menu are all `md` (#1439). + return QueryaControlScope( + size: QueryaControlSize.md, + child: material.SingleChildScrollView( scrollDirection: material.Axis.horizontal, child: material.Row( children: [ @@ -275,6 +280,7 @@ class SqlWorkspaceToolbar extends StatelessWidget { ], ], ), + ), ); }, ); diff --git a/test/features/workspace/sql_workspace_toolbar_test.dart b/test/features/workspace/sql_workspace_toolbar_test.dart index c99fafc2..3f884e2e 100644 --- a/test/features/workspace/sql_workspace_toolbar_test.dart +++ b/test/features/workspace/sql_workspace_toolbar_test.dart @@ -125,5 +125,55 @@ void main() { await tester.tap(find.byKey(const material.ValueKey('run_script'))); expect(executeCalled, isTrue); }); + + testWidgets('every control of the row has the md height (#1439)', + (tester) async { + final session = SqlQueryTabSession( + id: '1', + title: 'Query 1', + initialSql: 'SELECT 1;', + ); + + await tester.pumpWidget( + buildApp( + SqlWorkspaceToolbar( + session: session, + delegate: _FakeSqlExecutionDelegate(), + effectiveDatabase: 'test_db', + autocommit: false, + supportsAutocommit: true, + supportsStmtTimeout: true, + txOpen: true, + queryTimeoutSeconds: null, + historyEnabled: true, + onExecute: (_) {}, + onExplain: () {}, + onCancel: () {}, + onOpenHistory: () {}, + onOpenFile: () {}, + onSaveFile: () {}, + onRunTxCommand: (_) {}, + onToggleAutocommit: () {}, + onTimeoutChanged: (_) {}, + ), + ), + ); + await tester.pumpAndSettle(); + + for (final key in [ + 'run_script', + 'run_menu', + 'explain_query', + 'history_button', + 'format_button', + 'open_sql_button', + 'save_sql_button', + 'session_menu', + ]) { + final finder = find.byKey(material.ValueKey(key)); + expect(finder, findsOneWidget, reason: key); + expect(tester.getSize(finder).height, 32, reason: key); + } + }); }); }