[ITC][location-manager][ACR-1591][Added location_bounds_contains_coordinates_on_edge... 19/244119/4
authorPriya Kohli <priya.kohli@samsung.com>
Tue, 15 Sep 2020 06:40:03 +0000 (12:10 +0530)
committershobhit verma <shobhit.v@samsung.com>
Wed, 16 Sep 2020 05:44:37 +0000 (05:44 +0000)
Change-Id: I93e9d1206c2703269fb9c3b36134ed20630cedf6
Signed-off-by: Priya Kohli <priya.kohli@samsung.com>
src/itc/location-manager/ITs-location-bounds.c
src/itc/location-manager/tct-location-manager-native_mobile.h
src/itc/location-manager/tct-location-manager-native_tizeniot.h
src/itc/location-manager/tct-location-manager-native_wearable.h

index b34910bb8f0af52d073dcab5e57f9e0e64e75ce1..0e60a45097b3fe2c90624e4dedddc20ff4fa452e 100755 (executable)
@@ -672,5 +672,77 @@ int ITc_location_bounds_get_type_p(void)
 
        return 0;
 }
+
+//& purpose: To check whether the edges of the bounds contain the specified coordinates within tolerance.
+//& type: auto
+/**
+* @testcase                    ITc_location_bounds_contains_coordinates_on_edge_p
+* @since_tizen                 6.0
+* @author              SRID(priya.kohli)
+* @reviewer            SRID(shobhit.v)
+* @type                                auto
+* @description                 Checks whether the edges of the bounds contain the specified coordinates within tolerance.
+* @scenario                            creates a polygon type of new location bounds and verify output\n
+*                                              check the generate location bound for null\n
+*                                              check coordinates on polygon boundary within tolerance\n
+*                                              destroy a polygon type of new location bounds and verify output
+* @apicovered                  location_bounds_contains_coordinates, location_bounds_create_polygon, location_bounds_destroy
+* @passcase                            When location_bounds_contains_coordinates_on_edge and supporting APIs are successful
+* @failcase                            If target API or supporting APIs fails
+* @precondition                        None
+* @postcondition               None
+*/
+int ITc_location_bounds_contains_coordinates_on_edge_p(void)
+{
+       START_TEST;
+
+       location_bounds_h hPolyLocationBound = NULL;
+       bool bIsContained = false;
+       int nPolySize = 4;
+       location_coords_s location_coord_list[nPolySize];
+       location_coord_list[0].latitude = 28.581394;
+       location_coord_list[0].longitude = 77.362621;
+       location_coord_list[1].latitude = 28.580652;
+       location_coord_list[1].longitude = 77.363302;
+       location_coord_list[2].latitude = 28.580976;
+       location_coord_list[2].longitude = 77.363771;
+       location_coord_list[3].latitude = 28.581717;
+       location_coord_list[3].longitude = 77.363032;
+
+       location_coords_s testLocationCoordinates;
+       testLocationCoordinates.latitude = 28.580723;
+       testLocationCoordinates.longitude = 77.363666;
+       location_bound_error_e nRet = location_bounds_create_polygon(location_coord_list, nPolySize, &hPolyLocationBound);
+       if ( false == g_bIsLocationFeatureSupported )
+       {
+               if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+               {
+                       FPRINTF("[Line : %d][%s] Feature support as returned by TCTCheckSystemInfoFeatureSupported() and error code as returned by location_bounds_create_polygon() mismatched, Leaving test\\n", __LINE__, API_NAMESPACE);
+                       return 1;
+               }
+               else
+               {
+                       FPRINTF("[Line : %d][%s] feature not supported, Leaving test\\n", __LINE__, API_NAMESPACE);
+                       return 0;
+               }
+       }
+       PRINT_RESULT(LOCATION_BOUNDS_ERROR_NONE, nRet, "location_bounds_create_polygon", LocationBoundsGetError(nRet));
+       CHECK_HANDLE(hPolyLocationBound, "location_bounds_create_polygon");
+
+       double dTolerance = 40;
+       bIsContained = location_bounds_contains_coordinates_on_edge(hPolyLocationBound, testLocationCoordinates, dTolerance);
+       if ( bIsContained == false )
+       {
+               FPRINTF("[Line : %d][%s] location_bounds_contains_coordinates_on_edge failed, bIsContained returned = false\\n", __LINE__, API_NAMESPACE);
+               location_bounds_destroy(hPolyLocationBound);
+               return 1;
+       }
+
+       bIsContained = false;
+       nRet = location_bounds_destroy(hPolyLocationBound);
+       PRINT_RESULT_NORETURN(LOCATION_BOUNDS_ERROR_NONE, nRet, "location_bounds_destroy", LocationBoundsGetError(nRet));
+
+       return 0;
+}
 /** @} */
 /** @} */
index 56a48bdb88947142824f42a8f76be85b7b3cb1ab..d0672f27765855b2b57b90303fcbe33e7f68fd5d 100755 (executable)
@@ -65,6 +65,7 @@ extern int ITc_location_bounds_set_unset_state_changed_cb_p(void);
 extern int ITc_location_bounds_foreach_polygon_coords_p(void);
 extern int ITc_location_bounds_contains_coordinates_p(void);
 extern int ITc_location_bounds_get_type_p(void);
+extern int ITc_location_bounds_contains_coordinates_on_edge_p(void);
 extern int ITc_gps_status_get_nmea_p(void);
 extern int ITc_gps_status_get_satellite_p(void);
 extern int ITc_gps_status_get_last_satellite_p(void);
@@ -113,6 +114,7 @@ testcase tc_array[] = {
        {"ITc_location_bounds_foreach_polygon_coords_p",ITc_location_bounds_foreach_polygon_coords_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_location_bounds_contains_coordinates_p",ITc_location_bounds_contains_coordinates_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_location_bounds_get_type_p",ITc_location_bounds_get_type_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
+       {"ITc_location_bounds_contains_coordinates_on_edge_p",ITc_location_bounds_contains_coordinates_on_edge_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_gps_status_get_nmea_p",ITc_gps_status_get_nmea_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
        {"ITc_gps_status_get_satellite_p",ITc_gps_status_get_satellite_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
        {"ITc_gps_status_get_last_satellite_p",ITc_gps_status_get_last_satellite_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
index 56a48bdb88947142824f42a8f76be85b7b3cb1ab..d0672f27765855b2b57b90303fcbe33e7f68fd5d 100755 (executable)
@@ -65,6 +65,7 @@ extern int ITc_location_bounds_set_unset_state_changed_cb_p(void);
 extern int ITc_location_bounds_foreach_polygon_coords_p(void);
 extern int ITc_location_bounds_contains_coordinates_p(void);
 extern int ITc_location_bounds_get_type_p(void);
+extern int ITc_location_bounds_contains_coordinates_on_edge_p(void);
 extern int ITc_gps_status_get_nmea_p(void);
 extern int ITc_gps_status_get_satellite_p(void);
 extern int ITc_gps_status_get_last_satellite_p(void);
@@ -113,6 +114,7 @@ testcase tc_array[] = {
        {"ITc_location_bounds_foreach_polygon_coords_p",ITc_location_bounds_foreach_polygon_coords_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_location_bounds_contains_coordinates_p",ITc_location_bounds_contains_coordinates_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_location_bounds_get_type_p",ITc_location_bounds_get_type_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
+       {"ITc_location_bounds_contains_coordinates_on_edge_p",ITc_location_bounds_contains_coordinates_on_edge_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_gps_status_get_nmea_p",ITc_gps_status_get_nmea_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
        {"ITc_gps_status_get_satellite_p",ITc_gps_status_get_satellite_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
        {"ITc_gps_status_get_last_satellite_p",ITc_gps_status_get_last_satellite_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
index 56a48bdb88947142824f42a8f76be85b7b3cb1ab..d0672f27765855b2b57b90303fcbe33e7f68fd5d 100755 (executable)
@@ -65,6 +65,7 @@ extern int ITc_location_bounds_set_unset_state_changed_cb_p(void);
 extern int ITc_location_bounds_foreach_polygon_coords_p(void);
 extern int ITc_location_bounds_contains_coordinates_p(void);
 extern int ITc_location_bounds_get_type_p(void);
+extern int ITc_location_bounds_contains_coordinates_on_edge_p(void);
 extern int ITc_gps_status_get_nmea_p(void);
 extern int ITc_gps_status_get_satellite_p(void);
 extern int ITc_gps_status_get_last_satellite_p(void);
@@ -113,6 +114,7 @@ testcase tc_array[] = {
        {"ITc_location_bounds_foreach_polygon_coords_p",ITc_location_bounds_foreach_polygon_coords_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_location_bounds_contains_coordinates_p",ITc_location_bounds_contains_coordinates_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_location_bounds_get_type_p",ITc_location_bounds_get_type_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
+       {"ITc_location_bounds_contains_coordinates_on_edge_p",ITc_location_bounds_contains_coordinates_on_edge_p,ITs_location_bounds_startup,ITs_location_bounds_cleanup},
        {"ITc_gps_status_get_nmea_p",ITc_gps_status_get_nmea_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
        {"ITc_gps_status_get_satellite_p",ITc_gps_status_get_satellite_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},
        {"ITc_gps_status_get_last_satellite_p",ITc_gps_status_get_last_satellite_p,ITs_location_gps_status_startup,ITs_location_gps_status_cleanup},