evas_vg:Add TC for evas_vg_shape_append_scubic_to() 15/233115/4
authorShriyam Shrivastava <shriyam.s2@samsung.com>
Tue, 12 May 2020 07:40:20 +0000 (03:40 -0400)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 20 May 2020 11:42:25 +0000 (20:42 +0900)
Change-Id: Ic6c306139bce7aa763c1d97da6aab2116adcc7ad

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

index e6321607f0ff82af174e4d896702a58d41472ed5..07c0bdb0391e1f5b006ecc86854035be0e46f60a 100755 (executable)
@@ -23,3 +23,4 @@ utc_evas_vg_shape_dup.c
 utc_evas_vg_shape_stroke_join_set_get.c
 utc_evas_object_vg_root_node_set_get.c
 utc_evas_vg_shape_path_set_get.c
+utc_evas_vg_shape_append_scubic_to.c
index e6321607f0ff82af174e4d896702a58d41472ed5..07c0bdb0391e1f5b006ecc86854035be0e46f60a 100755 (executable)
@@ -23,3 +23,4 @@ utc_evas_vg_shape_dup.c
 utc_evas_vg_shape_stroke_join_set_get.c
 utc_evas_object_vg_root_node_set_get.c
 utc_evas_vg_shape_path_set_get.c
+utc_evas_vg_shape_append_scubic_to.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_scubic_to.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_scubic_to.c
new file mode 100755 (executable)
index 0000000..966833f
--- /dev/null
@@ -0,0 +1,165 @@
+#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_scubic_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
+ * @step 5 Move current point to {30, 30}\r
+ * @step 6 Add a cubic Bezier curve between the current position and the {30, 30} point\r
+ * @step 7 Use the current control point to draw the cubic bezier\r
+ * @step 8 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_scubic_to_p)\r
+{\r
+   Efl_VG *vg, *container, *shape;\r
+   double x = 250.0;\r
+   double y = 30.0;\r
+   double ctrl_x = 200.0;\r
+   double ctrl_y = 30.0;\r
+\r
+   double exp_x, exp_y;\r
+   double res_ctrl_x;\r
+   double res_ctrl_y;\r
+   double exp_ctrl_x = 30.0;\r
+   double exp_ctrl_y = 0.0;\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_move_to(shape, 30, 30);\r
+   evas_vg_shape_append_cubic_to(shape, 30, 30, 17, 67, 83, 71);\r
+\r
+   evas_vg_shape_append_scubic_to(shape, x, y, ctrl_x, ctrl_y);\r
+\r
+   evas_vg_shape_current_get(shape, &exp_x, &exp_y);\r
+   evas_vg_shape_current_ctrl_get(shape, &res_ctrl_x, &res_ctrl_x);\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_ctrl_x, res_ctrl_x) || !EINA_DBL_EQ(exp_ctrl_y, res_ctrl_y))\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d][ctrl_x = %f, ctrl_y = %f, exp_ctrl_x = %f, exp_ctrl_y = %f] : Test has failed", __FILE__, __LINE__, ctrl_x, ctrl_y, exp_ctrl_x, exp_ctrl_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_scubic_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_scubic_to_n)\r
+{\r
+   evas_vg_shape_append_scubic_to(NULL, 250, 30, 200, 30);\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_scubic_to()\r
+{\r
+   TCase *tcase = tcase_create("utc_evas_vg_shape_append_scubic_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_scubic_to_p);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_append_scubic_to_n);\r
+\r
+   return tcase;\r
+}\r
+\r