evas_vg:Add TC for evas_vg_shape_stroke_cap_set/get() 71/232571/3
authorShriyam Shrivastava <shriyam.s2@samsung.com>
Wed, 6 May 2020 10:48:42 +0000 (06:48 -0400)
committerHermet Park <chuneon.park@samsung.com>
Thu, 7 May 2020 01:53:24 +0000 (10:53 +0900)
Change-Id: Ie7cf386582c2fe66f021b389b503f6f53b90e5c9

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

index aaefcebef07b83c59bfc28ce405a89081d4d9ad6..6fcc15164c092800cd7264269c9660ae848408fc 100755 (executable)
@@ -17,3 +17,4 @@ utc_evas_vg_shape_stroke_width_set_get.c
 utc_evas_vg_node_raise.c
 utc_evas_vg_node_stack_below.c
 utc_evas_vg_shape_append_move_to_line_to.c
+utc_evas_vg_shape_stroke_cap_set_get.c
index aaefcebef07b83c59bfc28ce405a89081d4d9ad6..e10db2f56869f737a8cb568b0c7a047ff4a76bba 100755 (executable)
@@ -14,6 +14,10 @@ utc_evas_vg_shape_add.c
 utc_evas_vg_node_geometry_get_set.c
 utc_evas_vg_container_children_get.c
 utc_evas_vg_shape_stroke_width_set_get.c
+<<<<<<< HEAD
 utc_evas_vg_node_raise.c
 utc_evas_vg_node_stack_below.c
 utc_evas_vg_shape_append_move_to_line_to.c
+=======
+utc_evas_vg_shape_stroke_cap_set_get.c
+>>>>>>> 16014000... evas_vg:Add TC for evas_vg_shape_stroke_cap_set/get()
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_stroke_cap_set_get.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_stroke_cap_set_get.c
new file mode 100755 (executable)
index 0000000..8a88211
--- /dev/null
@@ -0,0 +1,162 @@
+#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
+     }\r
+   ecore_evas_show(ee);\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
+static void\r
+_draw_line(Efl_VG *line, Efl_VG *container)\r
+{\r
+   evas_vg_shape_append_move_to(line, 0, 0);\r
+   evas_vg_shape_append_line_to(line, 100, 100);\r
+   evas_vg_shape_stroke_color_set(line, 255, 0, 0, 255);\r
+   evas_vg_shape_stroke_width_set(line, 5);\r
+   evas_vg_node_origin_set(line, 50, 50);\r
+   evas_vg_node_color_set(line, 255, 255, 255, 255);\r
+}\r
+\r
+/**\r
+ * @addtogroup utc_vg_shape_stroke_cap\r
+ * @{\r
+ * @objective Positive test case checks if function sets/gets the cap style to be used for stroking 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 line object\r
+ * and check on not NULL.\r
+ * @step 5 Set the cap style EFL_GFX_CAP_ROUND for stroking the path\r
+ * @step 6 Get the cap style from stroking the path and check on EFL_GFX_CAP_ROUND\r
+ * @step 7 Set the cap style EFL_GFX_CAP_SQUARE for stroking the path\r
+ * @step 8 Get the cap style from stroking the path and check on EFL_GFX_CAP_SQUARE\r
+ *\r
+ * @passcondition Function should set/get the cap style to be used for stroking the path,\r
+ * and without segmentation fault.\r
+ * @}\r
+ * @}\r
+ */\r
+START_TEST(utc_evas_vg_shape_stroke_cap_set_get_p)\r
+{\r
+   Efl_VG *vg, *container, *line;\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
+   line = evas_vg_shape_add(container);\r
+   if (!line)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);\r
+        return;\r
+     }\r
+\r
+   _draw_line(line, container);\r
+\r
+   evas_vg_shape_stroke_cap_set(line, EFL_GFX_CAP_ROUND);\r
+   if (evas_vg_shape_stroke_cap_get(line) != EFL_GFX_CAP_ROUND)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);\r
+        return;\r
+     }\r
+\r
+   evas_vg_shape_stroke_cap_set(line, EFL_GFX_CAP_SQUARE);\r
+   if (evas_vg_shape_stroke_cap_get(line) != EFL_GFX_CAP_SQUARE)\r
+     {\r
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);\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_stroke_cap\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_stroke_cap_set_get_n)\r
+{\r
+   evas_vg_shape_stroke_cap_set(NULL, EFL_GFX_CAP_SQUARE);\r
+   evas_vg_shape_stroke_cap_get(NULL);\r
+\r
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);\r
+}\r
+END_TEST\r
+\r
+TCase * _utc_evas_vg_shape_stroke_cap_set_get()\r
+{\r
+   TCase *tcase = tcase_create("utc_evas_vg_shape_stroke_cap_set_get");\r
+   tcase_set_timeout(tcase, 30);\r
+   tcase_add_checked_fixture(tcase, setup, teardown);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_stroke_cap_set_get_p);\r
+   tcase_add_test(tcase, utc_evas_vg_shape_stroke_cap_set_get_n);\r
+\r
+   return tcase;\r
+}\r