evas_vg: Add TC for evas_vg_shape_append_quadratic/squadratic 61/233161/4
authorApurv Khatri <apurv.khatri@samsung.com>
Tue, 12 May 2020 16:47:58 +0000 (22:17 +0530)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 20 May 2020 11:47:27 +0000 (20:47 +0900)
Change-Id: I7e3da890249b358c07f2c90372e33da6086d4380

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

index 30a536eeab6edc399c8621d974bfe9d8e45aaa96..5f9aa5e3d750f8feb4ec188a78ead1b2176d9185 100755 (executable)
@@ -27,3 +27,4 @@ utc_evas_vg_shape_append_scubic_to.c
 utc_evas_vg_gradient_linear_start_get_set.c
 utc_evas_vg_shape_append_arc_to.c
 utc_evas_vg_shape_equal_commands.c
+utc_evas_vg_shape_append_quadratic_to_squadratic_to.c
index 30a536eeab6edc399c8621d974bfe9d8e45aaa96..5f9aa5e3d750f8feb4ec188a78ead1b2176d9185 100755 (executable)
@@ -27,3 +27,4 @@ utc_evas_vg_shape_append_scubic_to.c
 utc_evas_vg_gradient_linear_start_get_set.c
 utc_evas_vg_shape_append_arc_to.c
 utc_evas_vg_shape_equal_commands.c
+utc_evas_vg_shape_append_quadratic_to_squadratic_to.c
diff --git a/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_quadratic_to_squadratic_to.c b/TC/evas/canvas/evas_vg/utc_evas_vg_shape_append_quadratic_to_squadratic_to.c
new file mode 100755 (executable)
index 0000000..8dc9096
--- /dev/null
@@ -0,0 +1,186 @@
+#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();
+}
+
+/**
+ * @addtogroup utc_evas_vg_shape_append_cubic_to
+ * @{
+ * @objective Positive test case checks if function adds a cubic Bezier curve between the current position and the end point
+ * and without segmentation fault.
+ *
+ * @n Input Data:
+ * @li the given canvas
+ *
+ * @procedure
+ * @step 1 Call evas_object_vg_add function to create a new vector object
+ * and check on not NULL
+ * @step 2 Show vector object
+ * @step 3 Call evas_vg_container_add function to create a new vector container object
+ * @step 4 Call evas_vg_shape_add function to create a new shape object
+ * and check on not NULL.
+ * @step 5 Move current point to {20, 20}
+ * @step 6 Add a quadratic Bezier curve between the current position and the {250, 20} point
+ * @step 7 Get current control point and check on expected value
+ *
+ * @passcondition Function should add a quadratic Bezier curve between the current position and the end point,
+ * and without segmentation fault.
+ * @}
+ * @}
+ */
+START_TEST(utc_evas_vg_shape_append_quadratic_to_p)
+{
+   Efl_VG *vg, *container, *shape;
+   double ctrl_x, ctrl_y;
+   double shape_epsilon = 0.000001;
+
+   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);
+
+   container = evas_vg_container_add(vg);
+   evas_object_vg_root_node_set(vg, container);
+
+   shape = evas_vg_shape_add(container);
+   if (!shape)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+
+   evas_vg_shape_append_move_to(shape, 20, 20);
+   evas_vg_shape_append_quadratic_to(shape, 250, 20, 125, 100);
+   evas_vg_shape_current_ctrl_get(shape, &ctrl_x, &ctrl_y);
+
+   if (fabs(ctrl_x - 166.666667) > shape_epsilon || fabs(ctrl_y - 73.333333) > shape_epsilon)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed x = %f y = %f ", __FILE__, __LINE__, ctrl_x, ctrl_y);
+        return;
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+START_TEST(utc_evas_vg_shape_append_squadratic_to_p)
+{
+   Efl_VG *vg, *container, *shape;
+   double ctrl_x, ctrl_y;
+   double shape_epsilon = 0.000001;
+
+   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);
+
+   container = evas_vg_container_add(vg);
+   evas_object_vg_root_node_set(vg, container);
+
+   shape = evas_vg_shape_add(container);
+   if (!shape)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed", __FILE__, __LINE__);
+        return;
+     }
+
+   evas_vg_shape_append_move_to(shape, 20, 20);
+   evas_vg_shape_append_quadratic_to(shape, 20, 100, 60, 40);
+   evas_vg_shape_append_squadratic_to(shape, 20, 200);
+
+   evas_vg_shape_current_ctrl_get(shape, &ctrl_x, &ctrl_y);
+   if (fabs(ctrl_x - 2.222222) > shape_epsilon || fabs(ctrl_y - 160) > shape_epsilon)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed x = %f y = %f ", __FILE__, __LINE__, ctrl_x, ctrl_y);
+        return;
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+START_TEST(utc_evas_vg_shape_append_quadratic_to_n)
+{
+   evas_vg_shape_append_quadratic_to(NULL, 20, 100, 60, 40);
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+START_TEST(utc_evas_vg_shape_append_squadratic_to_n)
+{
+   evas_vg_shape_append_squadratic_to(NULL, 20, 200);
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+TCase * _utc_evas_vg_shape_append_quadratic_to_squadratic_to()
+{
+   TCase *tcase = tcase_create("utc_evas_vg_shape_append_quadratic_to_squadratic_to");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_evas_vg_shape_append_quadratic_to_p);
+   tcase_add_test(tcase, utc_evas_vg_shape_append_squadratic_to_p);
+   tcase_add_test(tcase, utc_evas_vg_shape_append_quadratic_to_n);
+   tcase_add_test(tcase, utc_evas_vg_shape_append_squadratic_to_n);
+
+   return tcase;
+}
+