- The sidebar's server switch moves to a footer bar: the connected server's name on the left (tap for the server sheet) and a settings key on the right, matching the first-party phone layout. - Settings has three groups: 外观 (theme mode and seed colour, stored on the device only in shared_preferences), 聊天 (the server's followUpBehavior: steer or queue) and a 宠物 placeholder. The app theme now reads the seed and mode. - The chat's short send while a turn runs uses the configured follow-up behaviour; the long-press sheet offers both and marks the default. The value is read from GET /api/config/settings?surface=mobile on connect, on resume and when the page opens, and written back with PUT. - Tests: settings page groups and choice, sidebar footer naming the server and opening settings, follow-up normalization. - 0.3.17 (317).
34 lines
1.1 KiB
Dart
34 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:openchamber/screens/sessions_screen.dart';
|
|
import 'package:openchamber/state.dart';
|
|
import 'package:openchamber/storage.dart';
|
|
|
|
void main() {
|
|
testWidgets('the sidebar footer names the server and opens settings',
|
|
(tester) async {
|
|
final app = AppState();
|
|
app.conn = Connection(
|
|
id: 'c1',
|
|
label: '家里的服务器',
|
|
url: 'http://127.0.0.1:3000',
|
|
);
|
|
addTearDown(app.dispose);
|
|
|
|
await tester.pumpWidget(MaterialApp(
|
|
home: Scaffold(body: SessionListPane(app: app)),
|
|
));
|
|
|
|
expect(find.text('家里的服务器'), findsOneWidget);
|
|
expect(find.byIcon(Icons.dns_outlined), findsOneWidget);
|
|
expect(find.byTooltip('设置'), findsOneWidget);
|
|
|
|
await tester.tap(find.byTooltip('设置'));
|
|
await tester.pumpAndSettle();
|
|
// The settings page replaced the shell.
|
|
expect(find.text('外观'), findsOneWidget);
|
|
expect(find.text('聊天'), findsOneWidget);
|
|
expect(find.text('宠物'), findsOneWidget);
|
|
});
|
|
}
|