mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Add avatars display on map
This commit is contained in:
@@ -128,6 +128,8 @@ void main() {
|
||||
expect(updated.displayLocation, isNotNull);
|
||||
expect(updated.displayLocation!.latitude, closeTo(45.0001, 0.0001));
|
||||
expect(updated.displayLocation!.longitude, closeTo(13.9999, 0.0001));
|
||||
expect(updated.advLat, equals((45.0001 * 1e6).round()));
|
||||
expect(updated.advLon, equals((13.9999 * 1e6).round()));
|
||||
});
|
||||
|
||||
test(
|
||||
@@ -232,6 +234,26 @@ void main() {
|
||||
expect(snapshot.location.latitude, closeTo(46.0569, 0.000001));
|
||||
expect(snapshot.location.longitude, closeTo(14.5058, 0.000001));
|
||||
});
|
||||
|
||||
test('persists last valid telemetry gps on the contact across reloads', () async {
|
||||
final telemetryData = CayenneLppParser.createGpsData(
|
||||
latitude: 45.0001,
|
||||
longitude: 13.9999,
|
||||
);
|
||||
|
||||
provider.updateTelemetry(publicKey.sublist(0, 6), telemetryData);
|
||||
await Future<void>.delayed(Duration.zero);
|
||||
|
||||
final reloadedProvider = ContactsProvider();
|
||||
await reloadedProvider.initializeEarly();
|
||||
|
||||
final reloaded = reloadedProvider.findContactByKey(publicKey)!;
|
||||
expect(reloaded.advLat, equals((45.0001 * 1e6).round()));
|
||||
expect(reloaded.advLon, equals((13.9999 * 1e6).round()));
|
||||
expect(reloaded.advertLocation, isNotNull);
|
||||
expect(reloaded.advertLocation!.latitude, closeTo(45.0001, 0.0001));
|
||||
expect(reloaded.advertLocation!.longitude, closeTo(13.9999, 0.0001));
|
||||
});
|
||||
});
|
||||
|
||||
group('ContactsProvider route updates', () {
|
||||
|
||||
27
test/providers/helpers/ping_tracker_test.dart
Normal file
27
test/providers/helpers/ping_tracker_test.dart
Normal file
@@ -0,0 +1,27 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:meshcore_sar_app/providers/helpers/ping_tracker.dart';
|
||||
|
||||
void main() {
|
||||
Uint8List createPublicKey() => Uint8List.fromList(
|
||||
List<int>.generate(32, (index) => index + 1),
|
||||
);
|
||||
|
||||
group('PingTracker', () {
|
||||
test('completes pending ping when response uses public key prefix', () async {
|
||||
final tracker = PingTracker();
|
||||
final publicKey = createPublicKey();
|
||||
|
||||
final pingFuture = tracker.trackPing(
|
||||
publicKey: publicKey,
|
||||
wasDirectAttempt: true,
|
||||
);
|
||||
|
||||
tracker.markPingSuccessful(publicKey.sublist(0, 6));
|
||||
|
||||
await expectLater(pingFuture, completion(isTrue));
|
||||
expect(tracker.hasPendingPing(publicKey), isFalse);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user