evas_vg:Add TC for evas_vg_shape_append_arc() 76/233076/4
authorShriyam Shrivastava <shriyam.s2@samsung.com>
Tue, 12 May 2020 04:25:40 +0000 (00:25 -0400)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 20 May 2020 11:55:44 +0000 (20:55 +0900)
Change-Id: I00d75fc5e62c324b9921d4b98d8cb71fd46f0d12

TC/evas/canvas/evas_vg/tslist
TC/evas/canvas/evas_vg/tslist_mobile
TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_arc.c [new file with mode: 0755]

index 09faf9a46028e2fa1932e7d73cf1ba1f556cffaa..acd5af0acc04731a731ff67ba32b70b3f800c995 100755 (executable)
@@ -35,3 +35,4 @@ utc_evas_vg_shape_fill_set_get.c
 utc_evas_vg_gradient_spread_set_get.c
 utc_evas_vg_shape_append_rect.c
 utc_evas_vg_gradient_radial_radius_get_set.c
+utc_evas_vg_shape_append_arc.c
index 09faf9a46028e2fa1932e7d73cf1ba1f556cffaa..acd5af0acc04731a731ff67ba32b70b3f800c995 100755 (executable)
@@ -35,3 +35,4 @@ utc_evas_vg_shape_fill_set_get.c
 utc_evas_vg_gradient_spread_set_get.c
 utc_evas_vg_shape_append_rect.c
 utc_evas_vg_gradient_radial_radius_get_set.c
+utc_evas_vg_shape_append_arc.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_arc.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_arc.c
new file mode 100755 (executable)
index 0000000..7edad80
--- /dev/null
@@ -0,0 +1,154 @@
+#include <Evas.h>\r
+#include <Ecore.h>\r
+#include <Ecore_Evas.h>\r
+#include <Eina.h>\r
+\r
+#include <check.h>\r
+\r
+#include <math.h>\r
+#include <float.h>\r
+\r
+#define WIDTH 800\r
+#define HEIGHT 600\r
+\r
+static Ecore_Evas *ee = NULL;\r
+\r
+/**\r
+ * @addtogroup evas_vg\r
+ * @{\r
+ * @defgroup evas_vg_shape\r
+ *\r
+ *\r
+ * @precondition\r
+ * @step 1 Initialize ecore-evas with ecore_evas_init()\r
+ * @step 2 Create a new Ecore_Evas and show\r
+ */\r
+static void\r
+setup(void)\r
+{\r
+   printf(" ============ Startup ============ \n");\r
+   ecore_evas_init();\r
+   ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);\r
+   if (!ee)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);\r
+        return;\r
+     }\r
+   ecore_evas_show(ee);\r
+\r
+}\r
+\r
+static void\r
+teardown(void)\r
+{\r
+   printf(" ============ Cleanup ============ \n");\r
+   if (ee)\r
+     {\r
+        ecore_evas_free(ee);\r
+     }\r
+   ecore_evas_shutdown();\r
+}\r
+\r
+/**\r
+ * @addtogroup utc_evas_vg_shape_append_arc\r
+ * @{\r
+ * @objective Positive test case checks if function appends the given arc to the path\r
+ * and without segmentation fault.\r
+ *\r
+ * @n Input Data:\r
+ * @li the given canvas\r
+ *\r
+ * @procedure\r
+ * @step 1 Call evas_object_vg_add function to create a new vector object\r
+ * and check on not NULL\r
+ * @step 2 Show vector object\r
+ * @step 3 Call evas_vg_container_add function to create a new vector container object\r
+ * @step 4 Call evas_vg_shape_add function to create a new shape object\r
+ * and check on not NULL.\r
+ * @step 5 Append the given arc (x = 0, y = 0, w = 100, h = 100) to the path\r
+ * @step 6 Get current point and check on expected value\r
+ *\r
+ * @passcondition Function should append the given arc to the path,\r
+ * and without segmentation fault.\r
+ * @}\r
+ * @}\r
+ */\r
+START_TEST(utc_evas_vg_shape_append_arc_p)\r
+{\r
+   Efl_VG *vg, *container, *shape;\r
+   double x = 0.0;\r
+   double y = 0.0;\r
+   double w = 100.0;\r
+   double h = 100.0;\r
+   double shape_epsilon = 0.000001;\r
+\r
+   double cur_x, cur_y;\r
+\r
+   vg = evas_object_vg_add(ecore_evas_get(ee));\r
+   if (!vg)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);\r
+        return;\r
+     }\r
+\r
+   evas_object_resize(vg, WIDTH, HEIGHT);\r
+   evas_object_show(vg);\r
+\r
+   container = evas_vg_container_add(vg);\r
+   evas_object_vg_root_node_set(vg, container);\r
+\r
+   shape = evas_vg_shape_add(container);\r
+   if (!shape)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);\r
+        return;\r
+     }\r
+\r
+   evas_vg_shape_append_arc(shape, x, y, w, h, 90, 200);\r
+\r
+   const double exp_x = 67.121364;\r
+   const double exp_y = 96.991698;\r
+\r
+   evas_vg_shape_current_get(shape, &cur_x, &cur_y);\r
+   if (fabs(cur_x - exp_x) > shape_epsilon || fabs(cur_y - exp_y) > shape_epsilon)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d][cur_x = %f, cur_y = %f, exp_x = %f, exp_y = %f] : Test has failed", __FILE__, __LINE__, cur_x, cur_y, exp_x, exp_y);\r
+        return;\r
+     }\r
+\r
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);\r
+}\r
+END_TEST\r
+\r
+/**\r
+ * @addtogroup utc_evas_vg_shape_append_arc\r
+ * @{\r
+ * @objective Negative Test case checks if calling function with invalid value won't cause segmentation fault\r
+ * @n Input Data:\r
+ * @li NULL, shape object value\r
+ *\r
+ * @procedure\r
+ * @step 1 Call testing function with NULL as a shape object value\r
+ *\r
+ * @passcondition There is no segmentation fault\r
+ * @}\r
+ */\r
+START_TEST(utc_evas_vg_shape_append_arc_n)\r
+{\r
+   evas_vg_shape_append_arc(NULL, 0, 0, 100, 100, 90, 200);\r
+\r
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);\r
+}\r
+END_TEST\r
+\r
+TCase * _utc_evas_vg_shape_append_arc()\r
+{\r
+   TCase *tcase = tcase_create("utc_evas_vg_shape_append_arc");\r
+   tcase_set_timeout(tcase, 30);\r
+   tcase_add_checked_fixture(tcase, setup, teardown);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_arc_p);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_arc_n);\r
+\r
+   return tcase;\r
+}\r
+\r