evas_vg: Add TC for evas_vg_gradient_linear_start_get_set 70/233370/5
authorApurv Khatri <apurv.khatri@samsung.com>
Thu, 14 May 2020 07:15:25 +0000 (12:45 +0530)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 20 May 2020 11:43:46 +0000 (20:43 +0900)
Change-Id: I81b7482f8c6a8a8cc700a3c66a328fed489a5256

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

index 07c0bdb0391e1f5b006ecc86854035be0e46f60a..4451ec73426058290f21aa5a8d3a7242e1cc37a4 100755 (executable)
@@ -24,3 +24,4 @@ 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
+utc_evas_vg_gradient_linear_start_get_set.c
index 07c0bdb0391e1f5b006ecc86854035be0e46f60a..4451ec73426058290f21aa5a8d3a7242e1cc37a4 100755 (executable)
@@ -24,3 +24,4 @@ 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
+utc_evas_vg_gradient_linear_start_get_set.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_gradient_linear_start_get_set.c b/TC/evas/canvas/evas_vg/utc_evas_vg_gradient_linear_start_get_set.c
new file mode 100755 (executable)
index 0000000..caa7c90
--- /dev/null
@@ -0,0 +1,124 @@
+#include <check.h>
+
+#define WIDTH 800
+#define HEIGHT 600
+
+#include <Evas.h>
+#include <Ecore.h>
+#include <Ecore_Evas.h>
+#include <Eina.h>
+
+#include <math.h>
+#include <float.h>
+
+static Ecore_Evas *ee = NULL;
+
+/**
+ * @addtogroup evas_vg
+ * @{
+ * @defgroup evas_vg_gradient
+ *
+ *
+ * @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();
+}
+
+/**
+ * @addtogroup evas_vg_gradient
+ * @{
+ * @defgroup evas_vg_gradient_liner
+ * evas_vg_gradient_linear_start_get()
+ * evas_vg_gradient_linear_start_set()
+ * @{
+ * @objective Positive test case checks if functions sets/gets the start/end point of this linear gradient,
+ * and without segmentation fault.
+ *
+ * @n Input Data:
+ * @li the gradient liner object
+ * @li 10 the x coordinate of start point
+ * @li 10 the y coordinate of start point
+ * @passcondition Function should set/get expected the start/end point of this linear gradient, and without segmentation fault.
+ * @}
+ * @}
+ */
+START_TEST(utc_evas_vg_gradient_linear_start_get_set_p)
+{
+   double shape_epsilon = 0.000001;
+   Efl_VG *root, *liner_gradient;
+
+   Evas_Object *vg = evas_object_vg_add(ecore_evas_get(ee));
+   if (!vg)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+   evas_object_resize(vg, WIDTH, HEIGHT);
+   evas_object_show(vg);
+   evas_object_vg_root_node_set(vg, evas_vg_container_add(vg));
+   root = evas_object_vg_root_node_get(vg);
+   if (!root)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+   double x;
+   double y;
+   liner_gradient = evas_vg_gradient_linear_add(root);
+
+   evas_vg_gradient_linear_start_set(liner_gradient, 10, 10);
+   evas_vg_gradient_linear_start_get(liner_gradient, &x, &y);
+
+   if (fabs(x - 10) > shape_epsilon || fabs(y - 10) > shape_epsilon)
+     {
+        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_gradient_linear_start_get_set_n)
+{
+   evas_vg_gradient_linear_start_set(NULL, 10, 10);
+   evas_vg_gradient_linear_start_get(NULL, NULL, NULL);
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+TCase * _utc_evas_vg_gradient_linear_start_get_set()
+{
+   TCase *tcase = tcase_create("utc_evas_vg_gradient_linear_start_get_set");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_evas_vg_gradient_linear_start_get_set_p);
+   tcase_add_test(tcase, utc_evas_vg_gradient_linear_start_get_set_n);
+   return tcase;
+}
+