evas_vg: Add TC for evas_vg_shape_dup 78/232278/5
authorAmitesh Singh <singh.amitesh@gmail.com>
Wed, 29 Apr 2020 14:17:55 +0000 (19:47 +0530)
committerAmitesh Singh <singh.amitesh@gmail.com>
Mon, 11 May 2020 05:38:54 +0000 (11:08 +0530)
Change-Id: Iae6f7443a27ba282a1e2ac828676c4c80f857604
Signed-off-by: Amitesh Singh <singh.amitesh@gmail.com>
TC/evas/canvas/evas_vg/tslist
TC/evas/canvas/evas_vg/tslist_mobile
TC/evas/canvas/evas_vg/utc_evas_vg_shape_dup.c [new file with mode: 0644]

index 7a262686646185cde4e6e48dede1b6a0f4e9af83..ada0535f5b1fb83506075a87f2d913d8d62f1471 100755 (executable)
@@ -19,3 +19,4 @@ utc_evas_vg_shape_stroke_width_set_get.c
 utc_evas_vg_shape_append_move_to_line_to.c
 utc_evas_vg_shape_stroke_cap_set_get.c
 utc_evas_vg_shape_stroke_scale_set_get.c
+utc_evas_vg_shape_dup.c
index 7a262686646185cde4e6e48dede1b6a0f4e9af83..ada0535f5b1fb83506075a87f2d913d8d62f1471 100755 (executable)
@@ -19,3 +19,4 @@ utc_evas_vg_shape_stroke_width_set_get.c
 utc_evas_vg_shape_append_move_to_line_to.c
 utc_evas_vg_shape_stroke_cap_set_get.c
 utc_evas_vg_shape_stroke_scale_set_get.c
+utc_evas_vg_shape_dup.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_dup.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_dup.c
new file mode 100644 (file)
index 0000000..00b40b5
--- /dev/null
@@ -0,0 +1,133 @@
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Eina.h>
+
+#include <check.h>
+
+#include <math.h>
+#include <float.h>
+
+#define WIDTH 800
+#define HEIGHT 600
+
+static Ecore_Evas *ee = NULL;
+
+/**
+ * @addtogroup evas_vg
+ * @{
+ * @defgroup evas_vg_shape
+ *
+ *
+ * @precondition
+ * @step 1 Initialize ecore-evas with ecore_evas_init()
+ * @step 2 Create a new Ecore_Evas and show
+ */
+static void
+setup(void)
+{
+   printf(" ============ Startup ============ \n");
+   ecore_evas_init();
+   ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL);
+   if (!ee)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+   ecore_evas_show(ee);
+}
+
+static void
+teardown(void)
+{
+   printf(" ============ Cleanup ============ \n");
+   if (ee)
+     {
+        ecore_evas_free(ee);
+     }
+   ecore_evas_shutdown();
+}
+
+static void
+_draw_line(Efl_VG *line)
+{
+   evas_vg_shape_append_move_to(line, 0, 0);
+   evas_vg_shape_append_line_to(line, 100, 100);
+   evas_vg_shape_stroke_color_set(line, 255, 0, 0, 255);
+   evas_vg_shape_stroke_width_set(line, 5);
+   evas_vg_node_origin_set(line, 50, 50);
+   evas_vg_node_color_set(line, 255, 255, 255, 255);
+   evas_vg_shape_stroke_cap_set(line, EFL_GFX_CAP_ROUND);
+}
+
+START_TEST(utc_evas_vg_shape_dup_p)
+{
+   Efl_VG *vg, *container, *line, *newline;
+   const Evas_Vg_Path_Command *op_get = NULL;
+   const double *points_get = NULL;
+
+   vg = evas_object_vg_add(ecore_evas_get(ee));
+   evas_object_resize(vg, WIDTH, HEIGHT);
+   evas_object_show(vg);
+
+   container = evas_vg_container_add(vg);
+   evas_object_vg_root_node_set(vg, container);
+
+   line = evas_vg_shape_add(container);
+   _draw_line(line);
+
+   newline = evas_vg_shape_add(container);
+   if (!newline)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+
+   evas_vg_shape_dup(newline, line);
+   evas_vg_shape_path_get(newline, &op_get, &points_get);
+
+   if (!op_get)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+   if (!points_get)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+
+   if (op_get[0] != EFL_GFX_PATH_COMMAND_TYPE_MOVE_TO && op_get[1] != EFL_GFX_PATH_COMMAND_TYPE_LINE_TO)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+   if (points_get[0] != 0.0 && points_get[1] != 0.0
+       && points_get[2] != 0.0 && points_get[3] != 100.0)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+START_TEST(utc_evas_vg_shape_dup_n)
+{
+   evas_vg_shape_dup(NULL, NULL);
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+TCase * _utc_evas_vg_shape_dup()
+{
+   TCase *tcase = tcase_create("utc_evas_vg_shape_dup");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_evas_vg_shape_dup_p);
+   tcase_add_test(tcase, utc_evas_vg_shape_dup_n);
+
+   return tcase;
+}