#include <Ecore_Evas.h>
#include "../../../utc_negative_unitest.h"
+static void *data=NULL;
+
+static void _smart_add(Evas_Object *obj)
+{
+ data = (void *)malloc(2);
+ if (!data)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory is not allocated..", __FILE__, __LINE__);
+ }
+ evas_object_smart_data_set(obj, data);
+}
+
/**
* @addtogroup evas_object_smart
* @{
*
* @procedure
* @step 1 Create new Evas object.
- * @step 2 Create new table Evas_Object.
- * @step 3 Set data of the table pointer to newly allocated buffer
+ * @step 2 Create new smart Evas_Object.
+ * @step 3 Set data of the smart object to newly allocated buffer
* @step 4 Get the data from the box and compare it with data, which was set.
*
* @passcondition Returned pointer and pointer that was set are equal.
*/
START_TEST(utc_evas_object_smart_data_get_p)
{
- Ecore_Evas *ee = ecore_evas_buffer_new(320, 240);
- Evas *evas = ecore_evas_get(ee);
- Evas_Object *obj = evas_object_table_add(evas);
- void *data = (void *)malloc(2);
-
- if (!data)
+ Evas *evas = evas_new();
+ if (!evas)
{
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memmory is not allocated..", __FILE__, __LINE__);
- return;
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Evas object is not created..", __FILE__, __LINE__);
}
+ Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("utc_smart_data_get");
+ sc.add = _smart_add;
+ Evas_Smart *smart = evas_smart_class_new(&sc);
+ Evas_Object *obj = evas_object_smart_add(evas, smart);
if (!obj)
{
- free (data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Evas_Object is not created..", __FILE__, __LINE__);
- return;
+ evas_free(evas);
+ free(data);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Smart Evas_Object is not created..", __FILE__, __LINE__);
}
- evas_object_smart_data_set(obj, data);
if (data != evas_object_smart_data_get(obj))
{
- free (data);
+ evas_free(evas);
+ free(data);
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
}
- free (data);
+ evas_free(evas);
+ free(data);
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
END_TEST
if (UNITEST_FUNC_NEG_RET(NULL, evas_object_smart_data_get, NULL) == TEST_FAIL)
{
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
}
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
#include <Ecore_Evas.h>
#include "../../../utc_negative_unitest.h"
+static void *data=NULL;
+
+static void _smart_add(Evas_Object *obj)
+{
+ data = (void *)malloc(2);
+ if (!data)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory is not allocated..", __FILE__, __LINE__);
+ }
+ evas_object_smart_data_set(obj, data);
+}
+
+static void _smart_add_negative(Evas_Object *obj)
+{
+ data = (void *)malloc(2);
+ if (!data)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory is not allocated..", __FILE__, __LINE__);
+ }
+ UNITEST_FUNC_NEG(evas_object_smart_data_set, obj, data);
+}
+
/**
* @addtogroup evas_object_smart
* @{
*
* @procedure
* @step 1 Create new Evas object.
- * @step 2 Create new table Evas_Object.
- * @step 3 Set data of the table - pointer to local integer variable.
+ * @step 2 Create new smart Evas_Object.
+ * @step 3 Set data of the smart object to newly allocated buffer
* @step 4 Get the data from the box and compare it with data, which was set.
*
* @passcondition Function sets data successfully, pointer returned by 'evas_object_smart_data_get'
*/
START_TEST(utc_evas_object_smart_data_set_p)
{
- Ecore_Evas *ee = ecore_evas_buffer_new(320, 240);
- Evas *evas = ecore_evas_get(ee);
- Evas_Object *obj = evas_object_table_add(evas);
- void *data = (void *)malloc(2);
-
- if (!data)
+ Evas *evas = evas_new();
+ if (!evas)
{
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memmory is not allocated..", __FILE__, __LINE__);
- return;
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Evas object is not created..", __FILE__, __LINE__);
}
+ Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("smart_data_set");
+ sc.add = _smart_add;
+ Evas_Smart *smart = evas_smart_class_new(&sc);
+ Evas_Object *obj = evas_object_smart_add(evas, smart);
if (!obj)
{
+ evas_free(evas);
free(data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Evas_Object is not created..", __FILE__, __LINE__);
- return;
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Smart Evas_Object is not created..", __FILE__, __LINE__);
}
- evas_object_smart_data_set(obj, data);
if (data != evas_object_smart_data_get(obj))
{
+ evas_free(evas);
free(data);
ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- return;
}
+ evas_free(evas);
free(data);
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
* @objective Negative test case checks if function doesn't cause segmentation fault
* if it is called with NULL instead of any argument.
* @n Input Data:
- * @li pointer to table Evas_Object;
+ * @li pointer to smart Evas_Object;
* @li pointer to user data to store in the object.
*
* @procedure
* @step 1 Create new Evas object.
- * @step 2 Create new table Evas_Object.
+ * @step 2 Create new smart Evas_Object.
* @step 3 Call function 2 times and pass (in turn) NULL instead of one from valid arguments.
*
* @passcondition Function doesn't cause segmentation fault.
*/
START_TEST(utc_evas_object_smart_data_set_n)
{
- Ecore_Evas *ee = ecore_evas_buffer_new(1, 1);
- Evas *evas = ecore_evas_get(ee);
- Evas_Object *obj = evas_object_table_add(evas);
- void *data = (void *)malloc(2);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memmory is not allocated..", __FILE__, __LINE__);
- return;
- }
- if (!obj)
- {
- free(data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Evas_Object is not created..", __FILE__, __LINE__);
- return;
- }
-
- UNITEST_FUNC_NEG(evas_object_smart_data_set, obj, data);
-
+ Evas *evas = evas_new();
+ if (!evas)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Evas object is not created..", __FILE__, __LINE__);
+ }
+ Evas_Smart_Class sc = EVAS_SMART_CLASS_INIT_NAME_VERSION("smart_data_set_n");
+ sc.add = _smart_add_negative;
+ Evas_Smart *smart = evas_smart_class_new(&sc);
+ Evas_Object *obj = evas_object_smart_add(evas, smart);
+ if (!obj)
+ {
+ evas_free(evas);
+ free(data);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Smart Evas_Object is not created..", __FILE__, __LINE__);
+ }
+
+ evas_free(evas);
free(data);
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}