Remove Cupertino pipeline branches
Keep the pipeline feature on its existing Material path because the app runs under MaterialApp and never selects Cupertino hosts. Preserve public cupertino parameters and required Cupertino icon values for later cleanup and shared controls.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import '../features/settings/settings_topic_test_helper.dart';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/application/pipelines_app.dart';
|
||||
@@ -16,89 +15,73 @@ import 'pipelines_replies.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
void main() {
|
||||
for (final cupertino in [false, true]) {
|
||||
testWidgets('Settings shares socket and one native bar ($cupertino)', (
|
||||
tester,
|
||||
) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
if (cupertino) {
|
||||
tester.platformDispatcher.platformBrightnessTestValue = Brightness.dark;
|
||||
addTearDown(tester.platformDispatcher.clearPlatformBrightnessTestValue);
|
||||
}
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
var sockets = 0;
|
||||
final client = PipelinesClient(
|
||||
channelFactory: (_) {
|
||||
sockets++;
|
||||
return channel;
|
||||
},
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
server: webServer(),
|
||||
client: client,
|
||||
cupertino: cupertino,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(
|
||||
requestOf(channel, 'ping'),
|
||||
isNull,
|
||||
reason: 'Unvisited settings must not issue hidden requests',
|
||||
);
|
||||
await replyPipelines(tester, channel, PipelineFixture());
|
||||
testWidgets('Settings shares socket and one native bar', (tester) async {
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
final channel = FakeChannel()..readyCompleter.complete();
|
||||
var sockets = 0;
|
||||
final client = PipelinesClient(
|
||||
channelFactory: (_) {
|
||||
sockets++;
|
||||
return channel;
|
||||
},
|
||||
);
|
||||
final provider = PlatformRouteInformationProvider(
|
||||
initialRouteInformation: RouteInformation(uri: Uri.parse('/pipelines')),
|
||||
);
|
||||
addTearDown(provider.dispose);
|
||||
await tester.pumpWidget(
|
||||
PipelinesApp(
|
||||
server: webServer(),
|
||||
client: client,
|
||||
cupertino: false,
|
||||
routeInformationProvider: provider,
|
||||
),
|
||||
);
|
||||
await tester.pump();
|
||||
expect(
|
||||
requestOf(channel, 'ping'),
|
||||
isNull,
|
||||
reason: 'Unvisited settings must not issue hidden requests',
|
||||
);
|
||||
await replyPipelines(tester, channel, PipelineFixture());
|
||||
|
||||
await tapBarAction(
|
||||
tester,
|
||||
find.byKey(const Key('pipelines-open-settings')),
|
||||
'Settings',
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/settings');
|
||||
expect(find.text('Quick switch animation'), findsOneWidget);
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
expect(find.text('Server URL'), findsOneWidget);
|
||||
if (cupertino) {
|
||||
final title = tester.widget<Text>(find.text('Connection').last);
|
||||
expect(
|
||||
title.style!.color!.computeLuminance(),
|
||||
greaterThan(0.5),
|
||||
reason: 'Cupertino dark host must not inherit light Material text',
|
||||
);
|
||||
}
|
||||
expect(find.text('Settings — Not implemented'), findsNothing);
|
||||
expect(sockets, 1);
|
||||
expect(find.byType(SegmentedBar), findsOneWidget);
|
||||
final ping = requestOf(channel, 'ping')!;
|
||||
channel.incoming.add(
|
||||
jsonEncode({
|
||||
'id': ping['id'],
|
||||
'type': 'pong',
|
||||
'build': {'version': 'settings-fixture'},
|
||||
'time': 'fixture time',
|
||||
'protocol': 2,
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(find.textContaining('settings-fixture'), findsOneWidget);
|
||||
expect(
|
||||
find.text(
|
||||
'Protocol mismatch: this page speaks protocol 1, '
|
||||
'the server reports 2.',
|
||||
),
|
||||
findsOneWidget,
|
||||
reason: 'a mismatched server must stay visibly flagged in Settings',
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
});
|
||||
}
|
||||
await tapBarAction(
|
||||
tester,
|
||||
find.byKey(const Key('pipelines-open-settings')),
|
||||
'Settings',
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(provider.value.uri.path, '/settings');
|
||||
expect(find.text('Quick switch animation'), findsOneWidget);
|
||||
await selectSettingsTopic(tester, 'Connection');
|
||||
expect(find.text('Server URL'), findsOneWidget);
|
||||
expect(find.text('Settings — Not implemented'), findsNothing);
|
||||
expect(sockets, 1);
|
||||
expect(find.byType(SegmentedBar), findsOneWidget);
|
||||
final ping = requestOf(channel, 'ping')!;
|
||||
channel.incoming.add(
|
||||
jsonEncode({
|
||||
'id': ping['id'],
|
||||
'type': 'pong',
|
||||
'build': {'version': 'settings-fixture'},
|
||||
'time': 'fixture time',
|
||||
'protocol': 2,
|
||||
}),
|
||||
);
|
||||
await tester.pump();
|
||||
await tester.pump();
|
||||
expect(find.textContaining('settings-fixture'), findsOneWidget);
|
||||
expect(
|
||||
find.text(
|
||||
'Protocol mismatch: this page speaks protocol 1, '
|
||||
'the server reports 2.',
|
||||
),
|
||||
findsOneWidget,
|
||||
reason: 'a mismatched server must stay visibly flagged in Settings',
|
||||
);
|
||||
expect(tester.takeException(), isNull);
|
||||
await tester.pumpWidget(const SizedBox.shrink());
|
||||
await tester.pump();
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user