evas_vg:Add TC for evas_vg_shape_append_circle() 82/233082/5
authorShriyam Shrivastava <shriyam.s2@samsung.com>
Tue, 12 May 2020 04:40:39 +0000 (00:40 -0400)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 20 May 2020 11:52:12 +0000 (20:52 +0900)
Change-Id: I52148b7402636e48c0f6b978eb415bb7f4e21b24

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

index 68dfdb0a27568cf257f0d52ea19f7b3ecf2d5519..2054f71f47f55ba453ebd20c8b59cf2d897a73da 100755 (executable)
@@ -30,3 +30,4 @@ utc_evas_vg_shape_equal_commands.c
 utc_evas_vg_shape_append_quadratic_to_squadratic_to.c
 utc_evas_vg_gradient_stop_set_get.c
 utc_evas_vg_shape_stroke_fill_set_get.c
+utc_evas_vg_shape_append_circle.c
index 68dfdb0a27568cf257f0d52ea19f7b3ecf2d5519..2054f71f47f55ba453ebd20c8b59cf2d897a73da 100755 (executable)
@@ -30,3 +30,4 @@ utc_evas_vg_shape_equal_commands.c
 utc_evas_vg_shape_append_quadratic_to_squadratic_to.c
 utc_evas_vg_gradient_stop_set_get.c
 utc_evas_vg_shape_stroke_fill_set_get.c
+utc_evas_vg_shape_append_circle.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_circle.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_circle.c
new file mode 100755 (executable)
index 0000000..99c2529
--- /dev/null
@@ -0,0 +1,153 @@
+#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_circle\r
+ * @{\r
+ * @objective Positive test case checks if function appends the given circle 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 circle (x = 50, y = 50, radius = 50) to the path\r
+ * @step 6 Get current point and check on expected value\r
+ *\r
+ * @passcondition Function should append the given circle to the path,\r
+ * and without segmentation fault.\r
+ * @}\r
+ * @}\r
+ */\r
+START_TEST(utc_evas_vg_shape_append_circle_p)\r
+{\r
+   Efl_VG *vg, *container, *shape;\r
+   double x = 50.0;\r
+   double y = 50.0;\r
+   double radius = 50.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_circle(shape, 50, 50, 50);\r
+\r
+   const double exp_x = 100.0;\r
+   const double exp_y = 50.0;\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_circle\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_circle_n)\r
+{\r
+   evas_vg_shape_append_circle(NULL, 50, 50, 50);\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_circle()\r
+{\r
+   TCase *tcase = tcase_create("utc_evas_vg_shape_append_circle");\r
+   tcase_set_timeout(tcase, 30);\r
+   tcase_add_checked_fixture(tcase, setup, teardown);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_circle_p);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_circle_n);\r
+\r
+   return tcase;\r
+}\r
+\r