init project
This commit is contained in:
39
example/test/amap_tools_test.dart
Normal file
39
example/test/amap_tools_test.dart
Normal file
@ -0,0 +1,39 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
|
||||
void main() {
|
||||
test('Distance between two different point', () {
|
||||
LatLng p1 = LatLng(1, 1);
|
||||
LatLng p2 = LatLng(2, 2);
|
||||
double distance = AMapTools.distanceBetween(p1, p2);
|
||||
expect(distance, 157401.56104583555);
|
||||
});
|
||||
|
||||
test('Distance between two same point', () {
|
||||
LatLng p1 = LatLng(1, 1);
|
||||
LatLng p2 = LatLng(1, 1);
|
||||
double distance = AMapTools.distanceBetween(p1, p2);
|
||||
expect(distance, 0);
|
||||
});
|
||||
|
||||
test('Distance between two different point with equal lat', () {
|
||||
LatLng p1 = LatLng(1, 1);
|
||||
LatLng p2 = LatLng(1, 2);
|
||||
double distance = AMapTools.distanceBetween(p1, p2);
|
||||
expect(distance, 111302.53586533663);
|
||||
});
|
||||
|
||||
test('Distance between two different point with equal lng', () {
|
||||
LatLng p1 = LatLng(1, 1);
|
||||
LatLng p2 = LatLng(2, 1);
|
||||
double distance = AMapTools.distanceBetween(p1, p2);
|
||||
expect(distance, 111319.49079327357);
|
||||
});
|
||||
|
||||
test('Distance between two different point with close point', () {
|
||||
LatLng p1 = LatLng(39.938212, 116.455139);
|
||||
LatLng p2 = LatLng(39.987656, 116.265605);
|
||||
double distance = AMapTools.distanceBetween(p1, p2);
|
||||
expect(distance, 17082.425889709597);
|
||||
});
|
||||
}
|
27
example/test/widget_test.dart
Normal file
27
example/test/widget_test.dart
Normal file
@ -0,0 +1,27 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility that Flutter provides. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:amap_map_example/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Verify Platform version', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(AMapDemo());
|
||||
|
||||
// Verify that platform version is retrieved.
|
||||
expect(
|
||||
find.byWidgetPredicate(
|
||||
(Widget widget) =>
|
||||
widget is Text && widget.data!.startsWith('Running on:'),
|
||||
),
|
||||
findsOneWidget,
|
||||
);
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user