evas_vg:Add TC for evas_vg_shape_append_cubic_to() 08/233108/4
authorShriyam Shrivastava <shriyam.s2@samsung.com>
Tue, 12 May 2020 07:34:21 +0000 (03:34 -0400)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 20 May 2020 11:58:33 +0000 (20:58 +0900)
Change-Id: I96c4780fe807b243d847d13f0ad17cb32752a397

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

index f99b980f9db21ce382328af0c8f2aa0c623c48b3..3dceac9ff70d0db1cfe96cd7d2986e9ae63217fd 100755 (executable)
@@ -39,3 +39,4 @@ utc_evas_vg_shape_append_arc.c
 utc_evas_vg_gradient_radial_focal_get_set.c
 utc_evas_vg_gradient_radial_center_get_set.c
 utc_evas_vg_gradient_radial_add.c
+utc_evas_vg_shape_append_cubic_to.c
index f99b980f9db21ce382328af0c8f2aa0c623c48b3..3dceac9ff70d0db1cfe96cd7d2986e9ae63217fd 100755 (executable)
@@ -39,3 +39,4 @@ utc_evas_vg_shape_append_arc.c
 utc_evas_vg_gradient_radial_focal_get_set.c
 utc_evas_vg_gradient_radial_center_get_set.c
 utc_evas_vg_gradient_radial_add.c
+utc_evas_vg_shape_append_cubic_to.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_cubic_to.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_cubic_to.c
new file mode 100755 (executable)
index 0000000..f22efcd
--- /dev/null
@@ -0,0 +1,161 @@
+#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_cubic_to\r
+ * @{\r
+ * @objective Positive test case checks if function adds a cubic Bezier curve between the current position and the end point\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 an arc that connects from the current point to the {100, 80} point\r
+ * @step 6 Add a cubic Bezier curve between the current position and the {0, 0} point\r
+ * @step 7 Get current control point and check on expected value\r
+ *\r
+ * @passcondition Function should add a cubic Bezier curve between the current position and the end point,\r
+ * and without segmentation fault.\r
+ * @}\r
+ * @}\r
+ */\r
+START_TEST(utc_evas_vg_shape_append_cubic_to_p)\r
+{\r
+   Efl_VG *vg, *container, *shape;\r
+   double x = 10.0;\r
+   double y = 100.0;\r
+   double ctrl_pt1_x = 15.0;\r
+   double ctrl_pt1_y = 65.0;\r
+   double ctrl_pt2_x = 50.0;\r
+   double ctrl_pt2_y = 80.0;\r
+\r
+   double exp_x, exp_y, exp_pt2_x, exp_pt2_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
+   evas_vg_shape_append_arc_to(shape, 100, 80, 10, 10, 0, EINA_FALSE, EINA_TRUE);\r
+\r
+   evas_vg_shape_append_cubic_to(shape, x, y, ctrl_pt1_x, ctrl_pt1_y, ctrl_pt2_x, ctrl_pt2_y);\r
+\r
+   evas_vg_shape_current_get(shape, &exp_x, &exp_y);\r
+   evas_vg_shape_current_ctrl_get(shape, &exp_pt2_x, &exp_pt2_y);\r
+\r
+   if (!EINA_DBL_EQ(exp_x, x) || !EINA_DBL_EQ(exp_y, y))\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d][x = %f, y = %f, exp_x = %f, exp_y = %f] : Test has failed", __FILE__, __LINE__, x, y, exp_x, exp_y);\r
+        return;\r
+     }\r
+   if (!EINA_DBL_EQ(exp_pt2_x, ctrl_pt2_x) || !EINA_DBL_EQ(exp_pt2_y, ctrl_pt2_y))\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d][ctrl_pt2_x = %f, ctrl_pt2_y = %f, exp_pt2_x = %f, exp_pt2_y = %f] : Test has failed", __FILE__, __LINE__, ctrl_pt2_x, ctrl_pt2_y, exp_pt2_x, exp_pt2_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_cubic_to\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_cubic_to_n)\r
+{\r
+   evas_vg_shape_append_cubic_to(NULL, 0, 0, 15, 65, 50, 80);\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_cubic_to()\r
+{\r
+   TCase *tcase = tcase_create("utc_evas_vg_shape_append_cubic_to");\r
+   tcase_set_timeout(tcase, 30);\r
+   tcase_add_checked_fixture(tcase, setup, teardown);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_cubic_to_p);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_cubic_to_n);\r
+\r
+   return tcase;\r
+}\r
+\r