Merge remote-tracking branch 'origin/dev' into cursor/routing-send-settings-ef15
# Conflicts: # documentation/design.md # lib/screens/channels_screen.dart # lib/screens/chat_screen.dart
This commit is contained in:
commit
84c0b97710
67 files changed
+5449
-880
No files matched your search
@@ -132,6 +132,32 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test('keeps contact added times out of app settings', () async {
|
||||
SharedPreferences.setMockInitialValues({
|
||||
'app_settings': jsonEncode({'theme_mode': 'dark'}),
|
||||
'contact_added_at_0011223344': jsonEncode({'aa': 1}),
|
||||
});
|
||||
PrefsManager.reset();
|
||||
await PrefsManager.initialize();
|
||||
addTearDown(PrefsManager.reset);
|
||||
final connector = MeshCoreConnector();
|
||||
addTearDown(connector.dispose);
|
||||
|
||||
final json = await const BackupService().createBackup(
|
||||
items: {BackupItem.appSettings},
|
||||
connector: connector,
|
||||
settings: AppSettings(),
|
||||
password: '',
|
||||
);
|
||||
final payload = jsonDecode(json) as Map<String, dynamic>;
|
||||
final section =
|
||||
(payload['sections'] as Map<String, dynamic>)['appSettings']
|
||||
as Map<String, dynamic>;
|
||||
final preferences = section['preferences'] as Map<String, dynamic>;
|
||||
expect(preferences, contains('app_settings'));
|
||||
expect(preferences, isNot(contains('contact_added_at_0011223344')));
|
||||
});
|
||||
|
||||
test('backs up a sensitive key without unrelated app settings', () async {
|
||||
SharedPreferences.setMockInitialValues({
|
||||
'app_settings': jsonEncode({
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_open/models/image_codec_support.dart';
|
||||
import 'package:meshcore_open/services/app_settings_service.dart';
|
||||
import 'package:meshcore_open/services/image_codec_backend.dart';
|
||||
import 'package:meshcore_open/services/image_codec_service.dart';
|
||||
import 'package:meshcore_open/services/image_codec_settings_store.dart';
|
||||
import 'package:meshcore_open/widgets/image_send_codec_binding.dart';
|
||||
|
||||
/// Runs in both build modes; each half skips in the other (`scripts/onnx.sh`).
|
||||
void main() {
|
||||
ImageCodecService newService() {
|
||||
final service = ImageCodecService(
|
||||
AppSettingsService(),
|
||||
settingsStore: InMemoryImageCodecSettingsStore(
|
||||
const ImageCodecPreferences(enabled: true),
|
||||
),
|
||||
);
|
||||
addTearDown(service.dispose);
|
||||
return service;
|
||||
}
|
||||
|
||||
test('ONNX-free build reports the image codec unavailable', () {
|
||||
final service = newService();
|
||||
expect(createImageCodecBackend(), isNull);
|
||||
expect(service.availability, ImageCodecAvailability.unavailable);
|
||||
expect(service.unavailableReason, contains('without ONNX Runtime'));
|
||||
expect(service.canRunInference, isFalse);
|
||||
}, skip: imageCodecRuntimeAvailable ? 'ONNX Runtime is compiled in' : false);
|
||||
|
||||
test('ONNX build has a codec backend', () {
|
||||
final service = newService();
|
||||
expect(createImageCodecBackend(), isA<OnnxImageCodecBackend>());
|
||||
expect(service.unavailableReason, isNull);
|
||||
}, skip: imageCodecRuntimeAvailable ? false : 'built without ONNX Runtime');
|
||||
}
|
||||
Reference in new issue
Block a user