[UTC][location-manager][ACR-1591][TC addition for location_bounds_contains_coordinate... 31/244431/1
authorchakradhar <v.pogiri@samsung.com>
Fri, 18 Sep 2020 10:10:54 +0000 (15:40 +0530)
committerchakradhar <v.pogiri@samsung.com>
Fri, 18 Sep 2020 10:10:54 +0000 (15:40 +0530)
Change-Id: I49828ac798822a14470ee747799c49430ec0490f

src/utc/location-manager/tct-location-manager-core_mobile.h
src/utc/location-manager/tct-location-manager-core_tizeniot.h
src/utc/location-manager/tct-location-manager-core_wearable.h
src/utc/location-manager/utc-location-bound.c

index 6be89a26a14eaf1882528011cbedc7d4a9f1f47a..7e7ea383b7e7aff23736e01ede3e2e72c6ca4a0e 100755 (executable)
@@ -172,6 +172,10 @@ extern int utc_location_bounds_get_type_n(void);
 extern int utc_location_bounds_contains_coordinates_p(void);
 extern int utc_location_bounds_contains_coordinates_n(void);
 extern int utc_location_bounds_contains_coordinates_n2(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_p(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n2(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n3(void);
 extern int utc_location_bounds_create_rect_p(void);
 extern int utc_location_bounds_create_rect_n(void);
 extern int utc_location_bounds_create_rect_n2(void);
@@ -331,6 +335,10 @@ testcase tc_array[] = {
        {"utc_location_bounds_contains_coordinates_p",utc_location_bounds_contains_coordinates_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_contains_coordinates_n",utc_location_bounds_contains_coordinates_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_contains_coordinates_n2",utc_location_bounds_contains_coordinates_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_p",utc_location_bounds_contains_coordinates_on_edge_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n",utc_location_bounds_contains_coordinates_on_edge_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n2",utc_location_bounds_contains_coordinates_on_edge_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n3",utc_location_bounds_contains_coordinates_on_edge_n3,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_p",utc_location_bounds_create_rect_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_n",utc_location_bounds_create_rect_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_n2",utc_location_bounds_create_rect_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
index 6be89a26a14eaf1882528011cbedc7d4a9f1f47a..7e7ea383b7e7aff23736e01ede3e2e72c6ca4a0e 100755 (executable)
@@ -172,6 +172,10 @@ extern int utc_location_bounds_get_type_n(void);
 extern int utc_location_bounds_contains_coordinates_p(void);
 extern int utc_location_bounds_contains_coordinates_n(void);
 extern int utc_location_bounds_contains_coordinates_n2(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_p(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n2(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n3(void);
 extern int utc_location_bounds_create_rect_p(void);
 extern int utc_location_bounds_create_rect_n(void);
 extern int utc_location_bounds_create_rect_n2(void);
@@ -331,6 +335,10 @@ testcase tc_array[] = {
        {"utc_location_bounds_contains_coordinates_p",utc_location_bounds_contains_coordinates_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_contains_coordinates_n",utc_location_bounds_contains_coordinates_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_contains_coordinates_n2",utc_location_bounds_contains_coordinates_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_p",utc_location_bounds_contains_coordinates_on_edge_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n",utc_location_bounds_contains_coordinates_on_edge_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n2",utc_location_bounds_contains_coordinates_on_edge_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n3",utc_location_bounds_contains_coordinates_on_edge_n3,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_p",utc_location_bounds_create_rect_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_n",utc_location_bounds_create_rect_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_n2",utc_location_bounds_create_rect_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
index 6be89a26a14eaf1882528011cbedc7d4a9f1f47a..7e7ea383b7e7aff23736e01ede3e2e72c6ca4a0e 100755 (executable)
@@ -172,6 +172,10 @@ extern int utc_location_bounds_get_type_n(void);
 extern int utc_location_bounds_contains_coordinates_p(void);
 extern int utc_location_bounds_contains_coordinates_n(void);
 extern int utc_location_bounds_contains_coordinates_n2(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_p(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n2(void);
+extern int utc_location_bounds_contains_coordinates_on_edge_n3(void);
 extern int utc_location_bounds_create_rect_p(void);
 extern int utc_location_bounds_create_rect_n(void);
 extern int utc_location_bounds_create_rect_n2(void);
@@ -331,6 +335,10 @@ testcase tc_array[] = {
        {"utc_location_bounds_contains_coordinates_p",utc_location_bounds_contains_coordinates_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_contains_coordinates_n",utc_location_bounds_contains_coordinates_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_contains_coordinates_n2",utc_location_bounds_contains_coordinates_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_p",utc_location_bounds_contains_coordinates_on_edge_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n",utc_location_bounds_contains_coordinates_on_edge_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n2",utc_location_bounds_contains_coordinates_on_edge_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
+       {"utc_location_bounds_contains_coordinates_on_edge_n3",utc_location_bounds_contains_coordinates_on_edge_n3,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_p",utc_location_bounds_create_rect_p,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_n",utc_location_bounds_create_rect_n,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
        {"utc_location_bounds_create_rect_n2",utc_location_bounds_create_rect_n2,utc_location_manager_bound_startup,utc_location_manager_bound_cleanup},
index a91f70655ebee26fbe4dcd696a588ef48dc055ac..93476fe738d3eb67e77d75548787b11ecbbc4751 100755 (executable)
@@ -739,6 +739,132 @@ int utc_location_bounds_contains_coordinates_n2(void)
        return 0;
 }
 
+/**
+ * @testcase           utc_location_bounds_contains_coordinates_on_edge_p
+ * @since_tizen                6.0
+ * @description                Checks whether the edges of the bounds contain the specified coordinates within tolerance
+ */
+int utc_location_bounds_contains_coordinates_on_edge_p(void)
+{
+       location_bounds_h bounds_poly = NULL;
+       int poly_size = 4;
+       double tolerance = 40;
+       location_coords_s coord_list[poly_size];
+       coord_list[0].latitude = 28.581394;
+       coord_list[0].longitude = 77.362621;
+       coord_list[1].latitude = 28.580652;
+       coord_list[1].longitude = 77.363302;
+       coord_list[2].latitude = 28.580976;
+       coord_list[2].longitude = 77.363771;
+       coord_list[3].latitude = 28.581717;
+       coord_list[3].longitude = 77.363032;
+       location_coords_s test_coords;
+       test_coords.latitude = 28.580723;
+       test_coords.longitude = 77.363666;
+
+       ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+       CHECK(is_location_supported, ret);
+
+       location_bounds_contains_coordinates_on_edge(bounds_poly, test_coords, tolerance);
+       ret = get_last_result();
+       CHECK_ERROR_NONE(is_location_supported, ret);
+
+       ret = location_bounds_destroy(bounds_poly);
+       CHECK(is_location_supported, ret);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_location_bounds_contains_coordinates_on_edge_n
+ * @since_tizen                6.0
+ * @description                Checks whether the edges of the bounds contain the specified coordinates within tolerance with invalid parameters
+ */
+int utc_location_bounds_contains_coordinates_on_edge_n(void)
+{
+       double tolerance = 40;
+       location_coords_s test_coords;
+       test_coords.latitude = 28.580723;
+       test_coords.longitude = 77.363666;
+
+       location_bounds_contains_coordinates_on_edge(NULL, test_coords, tolerance);
+       ret = get_last_result();
+       CHECK_INVALID_PARAMETER(is_location_supported, ret);
+       return 0;
+}
+
+/**
+ * @testcase           utc_location_bounds_contains_coordinates_on_edge_n2
+ * @since_tizen                6.0
+ * @description                Checks whether the edges of the bounds contain the specified coordinates within tolerance with invalid parameters
+ */
+int utc_location_bounds_contains_coordinates_on_edge_n2(void)
+{
+       location_bounds_h bounds_poly = NULL;
+       int poly_size = 4;
+       double tolerance = 40;
+       location_coords_s coord_list[poly_size];
+       coord_list[0].latitude = 28.581394;
+       coord_list[0].longitude = 77.362621;
+       coord_list[1].latitude = 28.580652;
+       coord_list[1].longitude = 77.363302;
+       coord_list[2].latitude = 28.580976;
+       coord_list[2].longitude = 77.363771;
+       coord_list[3].latitude = 28.581717;
+       coord_list[3].longitude = 77.363032;
+       location_coords_s coord_test;
+       coord_test.latitude = -91;
+       coord_test.longitude = 181;
+
+       ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+       CHECK(is_location_supported, ret);
+
+       location_bounds_contains_coordinates_on_edge(bounds_poly, coord_test, tolerance);
+       ret = get_last_result();
+       CHECK_INVALID_PARAMETER(is_location_supported, ret);
+
+       ret = location_bounds_destroy(bounds_poly);
+       CHECK(is_location_supported, ret);
+
+       return 0;
+}
+
+/**
+ * @testcase           utc_location_bounds_contains_coordinates_on_edge_n3
+ * @since_tizen                6.0
+ * @description                Checks whether the edges of the bounds contain the specified coordinates within tolerance with invalid parameters
+ */
+int utc_location_bounds_contains_coordinates_on_edge_n3(void)
+{
+       location_bounds_h bounds_poly = NULL;
+       int poly_size = 4;
+       double tolerance = -40;
+       location_coords_s coord_list[poly_size];
+       coord_list[0].latitude = 28.581394;
+       coord_list[0].longitude = 77.362621;
+       coord_list[1].latitude = 28.580652;
+       coord_list[1].longitude = 77.363302;
+       coord_list[2].latitude = 28.580976;
+       coord_list[2].longitude = 77.363771;
+       coord_list[3].latitude = 28.581717;
+       coord_list[3].longitude = 77.363032;
+       location_coords_s coord_test;
+       coord_test.latitude = 28.580723;
+       coord_test.longitude = 77.363666;
+
+       ret = location_bounds_create_polygon(coord_list, poly_size, &bounds_poly);
+       CHECK(is_location_supported, ret);
+
+       location_bounds_contains_coordinates_on_edge(bounds_poly, coord_test, tolerance);
+       ret = get_last_result();
+       CHECK_INVALID_PARAMETER(is_location_supported, ret);
+
+       ret = location_bounds_destroy(bounds_poly);
+       CHECK(is_location_supported, ret);
+
+       return 0;
+}
+
 /**
  * @testcase           utc_location_bounds_create_rect_p
  * @since_tizen                2.3