@@ -18,16 +18,22 @@ import 'package:google_navigation_flutter/src/method_channel/convert/navigation_
1818import 'package:google_navigation_flutter/src/method_channel/method_channel.dart' ;
1919
2020void main () {
21- late NavigationWaypointDto waypointDto;
21+ late NavigationWaypointDto placeIDWaypointDto;
22+ late NavigationWaypointDto targetWaypointDto;
2223 late NavigationWaypoint waypoint;
2324 late Destinations destinations;
2425 late NavigationDisplayOptions displayOptions;
2526 late RoutingOptions routingOptions;
2627
2728 setUp (() {
28- waypointDto = NavigationWaypointDto (
29+ targetWaypointDto = NavigationWaypointDto (
2930 title: 'testTitle' ,
3031 target: LatLngDto (latitude: 5.0 , longitude: 6.0 ),
32+ preferSameSideOfRoad: true ,
33+ preferredSegmentHeading: 50 ,
34+ );
35+ placeIDWaypointDto = NavigationWaypointDto (
36+ title: 'testTitle' ,
3137 placeID: 'testID' ,
3238 preferSameSideOfRoad: true ,
3339 preferredSegmentHeading: 50 ,
@@ -58,18 +64,46 @@ void main() {
5864
5965 group ('NavigationWaypoint tests' , () {
6066 test ('tests Navigation Waypoint conversion from DTO' , () {
61- final NavigationWaypoint gmsWaypoint = waypointDto.toNavigationWaypoint ();
62- expect (gmsWaypoint.title, waypointDto.title);
63- expect (gmsWaypoint.target? .latitude, waypointDto.target? .latitude);
64- expect (gmsWaypoint.target? .longitude, waypointDto.target? .longitude);
65- expect (gmsWaypoint.placeID, waypointDto.placeID);
67+ final NavigationWaypoint targetGmsWaypoint =
68+ targetWaypointDto.toNavigationWaypoint ();
69+ expect (targetGmsWaypoint.title, targetWaypointDto.title);
70+ expect (
71+ targetGmsWaypoint.target? .latitude,
72+ targetWaypointDto.target? .latitude,
73+ );
74+ expect (
75+ targetGmsWaypoint.target? .longitude,
76+ targetWaypointDto.target? .longitude,
77+ );
78+ expect (targetGmsWaypoint.placeID, targetWaypointDto.placeID);
79+ expect (
80+ targetGmsWaypoint.preferSameSideOfRoad,
81+ targetWaypointDto.preferSameSideOfRoad,
82+ );
83+ expect (
84+ targetGmsWaypoint.preferredSegmentHeading,
85+ targetWaypointDto.preferredSegmentHeading,
86+ );
87+
88+ final NavigationWaypoint placeIDGmsWaypoint =
89+ placeIDWaypointDto.toNavigationWaypoint ();
90+ expect (placeIDGmsWaypoint.title, placeIDWaypointDto.title);
91+ expect (
92+ placeIDGmsWaypoint.target? .latitude,
93+ placeIDWaypointDto.target? .latitude,
94+ );
6695 expect (
67- gmsWaypoint.preferSameSideOfRoad ,
68- waypointDto.preferSameSideOfRoad ,
96+ placeIDGmsWaypoint.target ? .longitude ,
97+ placeIDWaypointDto.target ? .longitude ,
6998 );
99+ expect (placeIDGmsWaypoint.placeID, placeIDWaypointDto.placeID);
70100 expect (
71- gmsWaypoint.preferredSegmentHeading,
72- waypointDto.preferredSegmentHeading,
101+ placeIDGmsWaypoint.preferSameSideOfRoad,
102+ placeIDWaypointDto.preferSameSideOfRoad,
103+ );
104+ expect (
105+ placeIDGmsWaypoint.preferredSegmentHeading,
106+ placeIDWaypointDto.preferredSegmentHeading,
73107 );
74108 });
75109
@@ -85,6 +119,19 @@ void main() {
85119 waypointDto2.preferredSegmentHeading,
86120 );
87121 });
122+
123+ test ('tests Navigation Waypoint creation asserts' , () {
124+ expect (
125+ () => NavigationWaypoint (
126+ title: 'test' ,
127+ target: const LatLng (latitude: 5.0 , longitude: 6.0 ),
128+ placeID: 'testID' ,
129+ ),
130+ throwsAssertionError,
131+ );
132+
133+ expect (() => NavigationWaypoint (title: 'test' ), throwsAssertionError);
134+ });
88135 });
89136
90137 group ('NavigationDestinationEventMessage tests' , () {
0 commit comments