-utc_eet_data_image_colorspace_get.c
-utc_eet_data_image_decode.c
-utc_eet_data_image_decode_cipher.c
-utc_eet_data_image_decode_to_cspace_surface_cipher.c
-utc_eet_data_image_decode_to_surface.c
-utc_eet_data_image_decode_to_surface_cipher.c
-utc_eet_data_image_encode.c
-utc_eet_data_image_encode_cipher.c
-utc_eet_data_image_header_decode.c
-utc_eet_data_image_header_decode_cipher.c
-utc_eet_data_image_header_read.c
-utc_eet_data_image_header_read_cipher.c
-utc_eet_data_image_read.c
-utc_eet_data_image_read_cipher.c
-utc_eet_data_image_read_to_cspace_surface_cipher.c
-utc_eet_data_image_read_to_surface.c
-utc_eet_data_image_read_to_surface_cipher.c
-utc_eet_data_image_write.c
-utc_eet_data_image_write_cipher.c
+utc_eet_data_image.c
-utc_eet_data_image_colorspace_get.c
-utc_eet_data_image_decode.c
-utc_eet_data_image_decode_cipher.c
-utc_eet_data_image_decode_to_cspace_surface_cipher.c
-utc_eet_data_image_decode_to_surface.c
-utc_eet_data_image_decode_to_surface_cipher.c
-utc_eet_data_image_encode.c
-utc_eet_data_image_encode_cipher.c
-utc_eet_data_image_header_decode.c
-utc_eet_data_image_header_decode_cipher.c
-utc_eet_data_image_header_read.c
-utc_eet_data_image_header_read_cipher.c
-utc_eet_data_image_read.c
-utc_eet_data_image_read_cipher.c
-utc_eet_data_image_read_to_cspace_surface_cipher.c
-utc_eet_data_image_read_to_surface.c
-utc_eet_data_image_read_to_surface_cipher.c
-utc_eet_data_image_write.c
-utc_eet_data_image_write_cipher.c
+utc_eet_data_image.c
-#utc_eet_data_image_colorspace_get.c
-#utc_eet_data_image_decode.c
-#utc_eet_data_image_decode_cipher.c
-#utc_eet_data_image_decode_to_cspace_surface_cipher.c
-#utc_eet_data_image_decode_to_surface.c
-#utc_eet_data_image_decode_to_surface_cipher.c
-#utc_eet_data_image_encode.c
-#utc_eet_data_image_encode_cipher.c
-#utc_eet_data_image_header_decode.c
-#utc_eet_data_image_header_decode_cipher.c
-#utc_eet_data_image_header_read.c
-#utc_eet_data_image_header_read_cipher.c
-#utc_eet_data_image_read.c
-#utc_eet_data_image_read_cipher.c
-#utc_eet_data_image_read_to_cspace_surface_cipher.c
-#utc_eet_data_image_read_to_surface.c
-#utc_eet_data_image_read_to_surface_cipher.c
-#utc_eet_data_image_write.c
-#utc_eet_data_image_write_cipher.c
+#utc_eet_data_image.c
-#utc_eet_data_image_colorspace_get.c
-#utc_eet_data_image_decode.c
-#utc_eet_data_image_decode_cipher.c
-#utc_eet_data_image_decode_to_cspace_surface_cipher.c
-#utc_eet_data_image_decode_to_surface.c
-#utc_eet_data_image_decode_to_surface_cipher.c
-#utc_eet_data_image_encode.c
-#utc_eet_data_image_encode_cipher.c
-#utc_eet_data_image_header_decode.c
-#utc_eet_data_image_header_decode_cipher.c
-#utc_eet_data_image_header_read.c
-#utc_eet_data_image_header_read_cipher.c
-#utc_eet_data_image_read.c
-#utc_eet_data_image_read_cipher.c
-#utc_eet_data_image_read_to_cspace_surface_cipher.c
-#utc_eet_data_image_read_to_surface.c
-#utc_eet_data_image_read_to_surface_cipher.c
-#utc_eet_data_image_write.c
-#utc_eet_data_image_write_cipher.c
+#utc_eet_data_image.c
--- /dev/null
+#include <check.h>
+#include "../utc_eet_utils.h"
+
+Eet_File *ef = NULL;
+
+/**
+ * @addtogroup eet
+ * @{
+ * @defgroup eet_data_image
+ *
+ *
+ * @precondition
+ * @step 1 eet initialized with eet_init()
+ * @step 2 Create and open Eet_File object
+ * @step 3 Write test image to the file
+ */
+static void
+setup(void)
+{
+ printf(" ============ Startup ============ \n");
+ eet_init();
+
+ ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
+ if (!ef)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
+ }
+}
+
+static void
+teardown(void)
+{
+ printf(" ============ Cleanup ============ \n");
+ eet_close(ef);
+ eet_shutdown();
+}
+
+/**
+ * @addtogroup eet_data_image
+ * @{
+ * @defgroup eet_data_image_pack_p
+ * @li eet_data_image_write()
+ * @li eet_data_image_read()
+ * @li eet_data_image_encode()
+ * @li eet_data_image_decode()
+ * @li eet_data_image_colorspace_get()
+ * @li eet_data_image_header_decode()
+ * @li eet_data_image_header_read()
+ * @{
+ * @objective Positive test case 01 checks if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Write image 3 times and pass (in turn) NULL instead of opened file,
+ * entry's name and image data to be saved.
+ * @step 2 Write correct image by call eet_data_image_write().
+ * @step 3 Check returned value.
+ * @step 4 Read written image from the file by call eet_data_image_read().
+ * @step 5 Compare initial and read data .
+ * @step 6 Read image header by call eet_data_image_header_read().
+ * @step 7 Check returned value.
+ * @step 8 Encode image data by call eet_data_image_encode().
+ * @step 9 Decode image data by call eet_data_image_decode.
+ * @step 10 Check returned value.
+ * @step 11 Decode image data header y call eet_data_image_header_decode().
+ * @step 12 Check returned value.
+ * @step 13 Get color space from image data by call eet_data_image_colorspace_get().
+ * @step 14 Check returned value.
+ * @step 15 Check cspaces out value.
+ *
+ * @passcondition Function executes successfully and returns non-zero value. Without segmentation fault.
+ * @}
+ * @}
+ */
+
+START_TEST(utc_eet_data_image_pack_p)
+{
+ int ret = 0, ret1 = 0, ret2 = 0, ret3 = 0;
+ int size = 0;
+ unsigned int w = 0, h = 0;
+ int alpha = 0, compress = 0, quality = 0;
+ Eet_Image_Encoding lossy = 0;
+ void *encoded_data = NULL;
+ void *data = NULL;
+ Eet_Colorspace *cspaces = NULL;
+
+ ret1 = eet_data_image_write(NULL, utc_eet_entry_name, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ ret2 = eet_data_image_write(ef, NULL, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ ret3 = eet_data_image_write(ef, utc_eet_entry_name, NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+
+ if (ret1 || ret2 || ret3)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ ret = eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+
+ if (!ret)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+
+ data = eet_data_image_read(ef, utc_eet_entry_name, NULL, NULL, NULL, NULL, NULL, NULL);
+ if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read and written data don't match..", __FILE__, __LINE__);
+ }
+ free(data);
+ data = eet_data_image_read(ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read and written data don't match..", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+ free(data);
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_header_read(ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+
+ encoded_data = eet_data_image_encode(test_noalpha.color, &size, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ if (!encoded_data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ data = eet_data_image_decode(encoded_data, size, NULL, NULL, NULL, NULL, NULL, NULL);
+ if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
+ }
+ free(data);
+ data = eet_data_image_decode(encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+ free(data);
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_header_decode(encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+
+ ret = eet_data_image_colorspace_get(ef, utc_eet_entry_name, utc_eet_cipher, &cspaces);
+ if (!ret)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ if (cspaces)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function can return cspaces = NULL", __FILE__, __LINE__);
+ }
+
+ free(encoded_data);
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup eet_data_image
+ * @{
+ * @defgroup eet_data_image_pack_p2
+ * @li eet_data_image_write_cipher()
+ * @li eet_data_image_read_cipher()
+ * @li eet_data_image_encode_cipher()
+ * @li eet_data_image_decode_cipher()
+ * @li eet_data_image_header_read_cipher()
+ * @li eet_data_image_header_decode_cipher()
+ * @{
+ * @objective Positive test case 02 checks if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Write image cipher data by call eet_data_image_write_cipher().
+ * @step 2 Check returned value.
+ * @step 3 Read written image cipher from the file by call eet_data_image_read_cipher().
+ * @step 4 Compare initial and read data.
+ * @step 5 Read image header by call eet_data_image_header_read_cipher().
+ * @step 6 Check the value returned if it is not 0.
+ * @step 7 Encode image data by call eet_data_image_encode_cipher().
+ * @step 8 Decode image data by call eet_data_image_decode_cipher().
+ * @step 9 Check returned value.
+ * @step 10 Decode image data header by call eet_data_image_header_decode_cipher().
+ * @step 11 Check returned value.
+ *
+ * @passcondition Function executes successfully and returns non-zero value. Without segmentation fault.
+ * @}
+ * @}
+ */
+START_TEST(utc_eet_data_image_pack_p2)
+{
+ int ret = 0, ret1 = 0, ret2 = 0, ret3 = 0;
+ int size = 0;
+ unsigned int w = 0, h = 0;
+ int alpha = 0, compress = 0, quality = 0;
+ Eet_Image_Encoding lossy = 0;
+ void *encoded_data = NULL;
+ void *data = NULL;
+
+ ret1 = eet_data_image_write_cipher(NULL, utc_eet_entry_name, utc_eet_cipher,
+ test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ ret2 = eet_data_image_write_cipher(ef, NULL, utc_eet_cipher,
+ test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ ret3 = eet_data_image_write_cipher(ef, utc_eet_entry_name, utc_eet_cipher,
+ NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ if (ret1 || ret2 || ret3)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+
+ ret = eet_data_image_write_cipher(ef, utc_eet_entry_name, utc_eet_cipher,
+ test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ if (!ret)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ ret = 0;
+
+ data = eet_data_image_read_cipher(ef, utc_eet_entry_name, utc_eet_cipher, NULL, NULL, NULL, NULL, NULL, NULL);
+ if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read and written data don't match..", __FILE__, __LINE__);
+ }
+ free(data);
+ data = eet_data_image_read_cipher(ef, utc_eet_entry_name, utc_eet_cipher, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read and written data don't match..", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+ free(data);
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_header_read_cipher(ef, utc_eet_entry_name, utc_eet_cipher, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (ret == 0)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_LOSSLESS, &size);
+ if (!encoded_data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
+ }
+ free(encoded_data);
+ encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_JPEG, &size);
+ if (!encoded_data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
+ }
+ free(encoded_data);
+ encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_ETC1_ALPHA, &size);
+ if (!encoded_data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
+ }
+ free(encoded_data);
+ encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
+ if (!encoded_data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
+ }
+
+ data = eet_data_image_decode_cipher(encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!data)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+ free(data);
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_header_decode_cipher(encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || lossy != 0)
+ {
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+
+ free(encoded_data);
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup eet_data_image
+ * @{
+ * @defgroup eet_data_image_pack_p3
+ * @li eet_data_image_read_to_surface()
+ * @li eet_data_image_decode_to_surface()
+ * @li eet_data_image_read_to_surface_cipher()
+ * @li eet_data_image_decode_to_surface_cipher()
+ * @li eet_data_image_read_to_cspace_surface_cipher()
+ * @li eet_data_image_decode_to_cspace_surface_cipher()
+ * @{
+ * @objective Positive test case 03 checks if the functions works correctly and without errors.
+ *
+ * @procedure
+ * @step 1 Write image.
+ * @step 2 Read image data by call eet_data_image_read_to_surface().
+ * @step 3 Check returned value.
+ * @step 4 Encode image data.
+ * @step 5 Decode image data by call eet_data_image_decode_to_surface().
+ * @step 6 Check returned value.
+ * @step 7 Write image cipher data.
+ * @step 8 Read image cipher data by call eet_data_image_read_to_surface_cipher().
+ * @step 9 Check the value returned.
+ * @step 10 Decode image cipher data by call eet_data_image_decode_to_surface_cipher().
+ * @step 11 Check returned value.
+ * @step 2 Read image data to cspace surface cipher by call eet_data_image_read_to_cspace_surface_cipher().
+ * @step 13 Check returned value.
+ * @step 14 Decode image cspace cipher data by call eet_data_image_decode_to_cspace_surface_cipher().
+ * @step 15 Check returned value.
+ *
+ * @passcondition Function executes successfully and returns non-zero value. Without segmentation fault.
+ * @}
+ * @}
+ */
+START_TEST(utc_eet_data_image_pack_p3)
+{
+ unsigned int w = 0, h = 0;
+ int alpha = 0, compress = 0, quality = 0;
+ Eet_Image_Encoding lossy = 0;
+ int size = 0;
+ unsigned int *data = NULL;
+ void *encoded_data = NULL;
+ void *res_data = NULL;
+ Eet_Colorspace cspace = EET_COLORSPACE_ARGB8888;
+ int ret = 0;
+
+ ret = eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ if (!ret)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ ret = 0;
+
+ data = malloc(test_noalpha.w * test_noalpha.h * 4);
+ if (!data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
+ }
+
+ ret = eet_data_image_read_to_surface(ef, utc_eet_entry_name, 0, 0, data, test_noalpha.w, test_noalpha.h, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ encoded_data = eet_data_image_encode(test_noalpha.color, &size, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ if (!encoded_data)
+ {
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
+ }
+
+ ret = eet_data_image_decode_to_surface(encoded_data, size, 0, 0, data, test_noalpha.w, test_noalpha.h,
+ test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_write_cipher(ef, "sample.jpg", utc_eet_cipher, test_noalpha.color,
+ test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
+ if (!ret)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ ret = 0;
+
+ ret = eet_data_image_read_to_surface_cipher(ef, "sample.jpg", utc_eet_cipher, 0, 0, data, test_noalpha.w, test_noalpha.h,
+ test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
+ if (ret == 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 0, 0, data,
+ test_noalpha.w, test_noalpha.h, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ ret = eet_data_image_read_to_cspace_surface_cipher(ef, utc_eet_entry_name, NULL, 0, 0, data, test_noalpha.w, test_noalpha.h,
+ test_noalpha.w * 4, cspace, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
+ }
+ ret = 0;
+ w = 0;
+ h = 0;
+ alpha = 0;
+ compress = 0;
+ quality = 0;
+
+ res_data = eet_read_cipher(ef, utc_eet_entry_name, &size, utc_eet_cipher);
+ if ((!res_data) || (size == 0))
+ {
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ ret = eet_data_image_decode_to_cspace_surface_cipher(res_data, utc_eet_cipher, size, 0, 0, data, test_noalpha.w, test_noalpha.h,
+ test_noalpha.w * 4, cspace, &alpha, &compress, &quality, &lossy);
+ if (!ret)
+ {
+ free(res_data);
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
+ }
+ else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
+ {
+ free(res_data);
+ free(data);
+ free(encoded_data);
+ eet_close(ef);
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
+ }
+ free(res_data);
+
+ free(data);
+ free(encoded_data);
+
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+Suite *
+test_suite(void)
+{
+ Suite *suite = suite_create("utc_eet_data_image");
+
+ TCase *tcase = tcase_create("TCase");
+ tcase_set_timeout(tcase, 30);
+ tcase_add_checked_fixture(tcase, setup, teardown);
+ tcase_add_test(tcase, utc_eet_data_image_pack_p);
+ tcase_add_test(tcase, utc_eet_data_image_pack_p2);
+ tcase_add_test(tcase, utc_eet_data_image_pack_p3);
+
+ suite_add_tcase(suite, tcase);
+
+ return suite;
+}
+
+int
+main()
+{
+ int number_failed;
+
+ Suite *suite = test_suite();
+ SRunner *srunner = srunner_create(suite);
+ srunner_set_log(srunner, "utc_eet_data_image.log");
+ srunner_set_xml(srunner, "utc_eet_data_image.xml");
+ srunner_run_all(srunner, CK_NORMAL);
+ number_failed = srunner_ntests_failed(srunner);
+ srunner_free(srunner);
+
+ return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}
+
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../utc_eet_utils.h"
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_colorspace_get eet_data_image_colorspace_get()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- * @step 2 Create and open Eet_File object
- * @step 3 Write test image to the file
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- else if (!eet_data_image_write_cipher(ef,
- utc_eet_entry_name,
- utc_eet_cipher,
- test_noalpha.color,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.alpha,
- 9,
- 100,
- 0)) {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Image is not written into file..", __FILE__, __LINE__);
- eet_close(ef);
- ef = NULL;
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_colorspace_get
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li utc_eet_cipher - cipher that data were encoded with;
- * @li cspaces - a list of possible decoding colorspace finished by EET_COLORSPACE_ARGB8888,
- * if NULL, only EET_COLORSPACE_ARGB8888 is supported;
- *
- * @procedure
- * @step 1 Read image data.
- * @step 2 Check returned value.
- * @step 3 Check cspaces out value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_colorspace_get_p)
-{
- Eet_Colorspace *cspaces = NULL;
-
- int ret = eet_data_image_colorspace_get(ef, utc_eet_entry_name, utc_eet_cipher, &cspaces);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
-
- if (cspaces)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function can return cspaces = NULL", __FILE__, __LINE__);
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed.. \n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_colorspace_get");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_colorspace_get_p);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_colorspace_get.log");
- srunner_set_xml(srunner, "utc_eet_data_image_colorspace_get.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_decode eet_data_image_decode()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_decode
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Decode image data.
- * @step 3 Check returned value.
- *
- * @passcondition Function returns pointer to decoded data, not NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_p)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = eet_data_image_decode(encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
- free(data);
-
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function 6 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 3-8).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_n)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,1,1,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_decode, encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of pointer to encoded image data.
- * @n Input Data:
- * @li NULL as pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function once and pass NULL instead of data to be decoded, but pass real
- * size of encoded data, which is not 0.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_n2)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(1,0,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_data_image_decode, encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not NULL..", __FILE__, __LINE__);
- }
- else if (w || h || alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- result_of_testing = TEST_FAIL;
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_decode");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_decode_p);
- tcase_add_test(tcase, utc_eet_data_image_decode_n);
- tcase_add_test(tcase, utc_eet_data_image_decode_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_decode.log");
- srunner_set_xml(srunner, "utc_eet_data_image_decode.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_decode_cipher eet_data_image_decode_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_decode_cipher
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Decode image data.
- * @step 3 Check returned value.
- *
- * @passcondition Function returns pointer to decoded data, not NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_cipher_p)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = eet_data_image_decode_cipher(encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
- free(data);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_cipher
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function 6 times and pass (in turn) NULL instead of all pointers to write properties
- * of decoded image (parameters 4-9).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_cipher_n)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,0,1,1,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_decode_cipher, encoded_data, utc_eet_cipher, size,
- &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_cipher
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of pointer to encoded image pixel data.
- * @n Input Data:
- * @li pointer to encoded image pixel data (is replaced with NULL);
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function once and pass NULL instead of data to be decoded, but pass real
- * size of encoded data, which is not 0.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_cipher_n2)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(1,0,0,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_data_image_decode_cipher, encoded_data, utc_eet_cipher, size,
- &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not NULL..", __FILE__, __LINE__);
- }
- else if (w || h || alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- result_of_testing = TEST_FAIL;
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_decode_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_decode_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_decode_cipher_n);
- tcase_add_test(tcase, utc_eet_data_image_decode_cipher_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_decode_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_decode_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../utc_eet_utils.h"
-
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_decode_to_cspace_surface_cipher eet_data_image_decode_to_cspace_surface_cipher()
- *
- *
- * @precondition
- * @step 1 Initialize eet library with eet_init().
- * @step 2 Create and open Eet_File object.
- * @step 3 Write test image to the file.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- else if (!eet_data_image_write_cipher(ef,
- utc_eet_entry_name,
- utc_eet_cipher,
- test_noalpha.color,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.alpha,
- 9,
- 100,
- 0))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Image is not written into file..", __FILE__, __LINE__);
- eet_close(ef);
- ef = NULL;
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_decode_to_cspace_surface_cipher
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li utc_eet_cipher - cipher that data were encoded with;
- * @li size of encoded data;
- * @li 0 - starting x coordinate;
- * @li 0 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li test_noalpha.w - expected width;
- * @li test_noalpha.h - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li cspace - decoding colorspace EET_COLORSPACE_ARGB8888;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Read and check encode image data.
- * @step 2 Decode image data.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_cspace_surface_cipher_p)
-{
- int size = 0;
- int alpha = 0;
- int compress = 0;
- int quality = 0;
- int lossy = 0;
- Eet_Colorspace cspace = EET_COLORSPACE_ARGB8888;
- void *data = eet_read_cipher(ef, utc_eet_entry_name, &size, utc_eet_cipher);
- unsigned int *res_data = NULL;
-
- if ((!data) || (size == 0))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- res_data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!res_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
-
- int ret = eet_data_image_decode_to_cspace_surface_cipher(data,
- utc_eet_cipher,
- size,
- 0,
- 0,
- res_data,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.w * 4,
- cspace,
- &alpha,
- &compress,
- &quality,
- &lossy);
-
- free(data);
- free(res_data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_decode_to_cspace_surface_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_cspace_surface_cipher_p);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_decode_to_cspace_surface_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_decode_to_cspace_surface_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_decode_to_surface eet_data_image_decode_to_surface()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_decode_to_surface
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li 0 - starting x coordinate;
- * @li 0 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li test_noalpha.w - expected width;
- * @li test_noalpha.h - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Decode image data.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_p)
-{
- int size = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- free(encoded_data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_decode_to_surface(encoded_data, size, 0, 0, data, test_noalpha.w, test_noalpha.h,
- test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- free(data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_to_surface
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function 4 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 9-12).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_n)
-{
- int size = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- free(encoded_data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,0,0,0,0,0,0,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_decode_to_surface, encoded_data, size, 4, 4,
- data, 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_to_surface
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function 2 times and pass (in turn) NULL instead of pointer to encoded data
- * and pointer to the allocated pixel surface. Also real size of encoded data (which is not 0)
- * is passed.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_n2)
-{
- int size = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- free(encoded_data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(1,0,0,0,1,0,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_data_image_decode_to_surface, encoded_data, size, 4, 4,
- data, 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not 0", __FILE__, __LINE__);
- }
- else if (alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
- free(data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_decode_to_surface");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_p);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_n);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_decode_to_surface.log");
- srunner_set_xml(srunner, "utc_eet_data_image_decode_to_surface.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_decode_to_surface_cipher eet_data_image_decode_to_surface_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_decode_to_surface_cipher
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li 0 - starting x coordinate;
- * @li 0 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li test_noalpha.w - expected width;
- * @li test_noalpha.h - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Decode image data.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_cipher_p)
-{
- int size = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- free(encoded_data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 0, 0, data,
- test_noalpha.w, test_noalpha.h, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- free(data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_to_surface_cipher
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of encoded data.
- * @n Input Data:
- * @li NULL instead of pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li 0 - size of encoded data;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of pointer to encoded data.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_cipher_n)
-{
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_decode_to_surface_cipher(NULL, utc_eet_cipher, 0, 4, 4, data,
- 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- free(data);
-
- if (ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned %d", __FILE__, __LINE__, ret);
- }
- else if (alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_to_surface_cipher
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of allocated pixel surface.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to encode/decode data;
- * @li size of encoded data;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li NULL instead of pointer to the allocated pixel surface to write decoded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Call function and pass NULL instead of pointer to allocated pixel surface.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_cipher_n2)
-{
- int size = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 4, 4, NULL,
- 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
-
- if (ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned %d", __FILE__, __LINE__, ret);
- }
- else if (alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_decode_to_surface_cipher
- * @{
- * @objective Negative test case 3 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of output arguments to write image's properties.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to encode/decode data;
- * @li size of encoded data;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write decoded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Call function 4 times and pass (in turn) NULL instead of pointer to write properties
- * of the image, it are last argument: alpha, compression, quality, lossiness.
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_decode_to_surface_cipher_n3)
-{
- int size = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- void *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- free(encoded_data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 4, 4, data,
- 2, 2, test_noalpha.w * 4, NULL, &compress, &quality, &lossy);
- printf("[TEST_MSG]:: %s[%d] : Function was called with NULL as alpha..", __FILE__, __LINE__);
-
- eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 4, 4, data,
- 2, 2, test_noalpha.w * 4, &alpha, NULL, &quality, &lossy);
- printf("[TEST_MSG]:: %s[%d] : Function was called with NULL as compress..", __FILE__, __LINE__);
-
- eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 4, 4, data,
- 2, 2, test_noalpha.w * 4, &alpha, &compress, NULL, &lossy);
- printf("[TEST_MSG]:: %s[%d] : Function was called with NULL as quality..", __FILE__, __LINE__);
-
- eet_data_image_decode_to_surface_cipher(encoded_data, utc_eet_cipher, size, 4, 4, data,
- 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, NULL);
- printf("[TEST_MSG]:: %s[%d] : Function was called with NULL as lossy..", __FILE__, __LINE__);
-
- free(encoded_data);
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_decode_to_surface_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_cipher_n);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_cipher_n2);
- tcase_add_test(tcase, utc_eet_data_image_decode_to_surface_cipher_n3);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_decode_to_surface_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_decode_to_surface_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_encode eet_data_image_encode()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_encode
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li test_noalpha.color - pointer to the image pixel data;
- * @li pointer to variable to write size of returned data;
- * @li test_noalpha.w (8) - width of the image;
- * @li test_noalpha.h (8) - height of the image;
- * @li test_noalpha.alpha (0) - alpha channel flag;
- * @li 9 - compression level;
- * @li 100 - quality encoding amount;
- * @li 0 - lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Check returned value.
- * @step 3 Decode encoded image data.
- * @step 4 Compare initial and decoded data.
- *
- * @passcondition Function returns pointer to encoded data, not NULL. Initial and decoded data must be equal.
- * @}
- */
-START_TEST(utc_eet_data_image_encode_p)
-{
- int size = 0;
-
- void *data = eet_data_image_encode(test_noalpha.color, &size, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
- }
- void *data2 = eet_data_image_decode(data, size, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (!data2 || memcmp(data2, test_noalpha.color, sizeof test_noalpha.color))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Initial and decoded data don't match..", __FILE__, __LINE__);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
- free(data2);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_encode
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of pointer to image pixel data.
- * @n Input Data:
- * @li test_noalpha.color - pointer to image pixel data (is replaced with NULL);
- * @li pointer to variable to write size of returned data;
- * @li test_noalpha.w (8) - width of the image;
- * @li test_noalpha.h (8) - height of the image;
- * @li test_noalpha.alpha (0) - alpha channel flag;
- * @li 9 - compression level;
- * @li 100 - quality encoding amount;
- * @li 0 - lossiness flag.
- *
- * @procedure
- * @step 1 Call function once and pass NULL instead of data to be encoded.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_encode_n)
-{
- int size = 0;
-
- if (eet_data_image_encode(NULL, &size, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0))
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_encode");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_encode_p);
- tcase_add_test(tcase, utc_eet_data_image_encode_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_encode.log");
- srunner_set_xml(srunner, "utc_eet_data_image_encode.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-
-typedef struct _Eet_Test_Image Eet_Test_Image;
-struct _Eet_Test_Image
-{
- unsigned int w;
- unsigned int h;
- int alpha;
- unsigned int color[64];
-};
-static const Eet_Test_Image test_noalpha =
-{
- 8, 8, 0,
- {
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA,
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA
- }
-};
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_encode_cipher eet_data_image_encode_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_encode_cipher
- * @{
- * @objective Positive test case 01
- * Test case checks if the function is invoked successfully.
- * @procedure
- * @step 1 Encode image data (lossless).
- * @step 2 Check the value returned if it is not NULL.
- * @step 3 Encode image data (jpeg).
- * @step 4 Check the value returned if it is not NULL.
- * @step 5 Encode image data (etc1_alpha or rgba).
- * @step 6 Check the value returned if it is not NULL.
- *
- * @passcondition : API Executes successfully, returning non-NULL value
- * @}
- */
-START_TEST(utc_eet_data_image_encode_cipher_p)
-{
-
- void* ret = NULL;
- int size;
-
- ret = eet_data_image_encode_cipher(test_noalpha.color, NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_LOSSLESS, &size);
-
- if (ret == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- ret = eet_data_image_encode_cipher(test_noalpha.color, NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_JPEG, &size);
-
- if (ret == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- ret = eet_data_image_encode_cipher(test_noalpha.color, NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_ETC1_ALPHA, &size);
-
- if (ret == NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_encode_cipher
- * @{
- * @objective Negative test case 01
- * Test case checks if the function is invoked successfully, when data is NULL.
- * @procedure
- * @step 1 Encode NULL image data.
- * @step 2 Check the value returned if it is NULL.
- *
- * @passcondition : API Executes successfully, returning NULL
- * @}
- */
-START_TEST(utc_eet_data_image_encode_cipher_n)
-{
-
- void* ret = NULL;
- int size;
-
- ret = eet_data_image_encode_cipher(NULL, NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
-
- if (ret != NULL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_encode_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_encode_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_encode_cipher_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_encode_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_encode_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_header_decode eet_data_image_header_decode()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_header_decode
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Decode image data header.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_p)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_header_decode(encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_decode
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function 6 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 3-8).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_n)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,1,1,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_header_decode, encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_decode
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of pointer to encoded image pixel data.
- * @n Input Data:
- * @li pointer to encoded image pixel data (is replaced with NULL);
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function once and pass NULL instead of data to get decoded header,
- * but pass real size of encoded data, which is not 0.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_n2)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
- void *encoded_data = eet_data_image_encode(test_noalpha.color, &size,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(1,0,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_data_image_header_decode, encoded_data, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not NULL..", __FILE__, __LINE__);
- }
- else if (w || h || alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_header_decode");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_p);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_n);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_header_decode.log");
- srunner_set_xml(srunner, "utc_eet_data_image_header_decode.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_header_decode_cipher eet_data_image_header_decode_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_header_decode_cipher
- * @{
- * @objective Positive test case 1 checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness enum.
- *
- * @procedure
- * @step 1 Encode image data with EET_IMAGE_LOSSLESS.
- * @step 2 Decode image data header.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns values that were set by encode.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_cipher_p)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0;
- Eet_Image_Encoding lossy;
-
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_LOSSLESS, &size);
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_header_decode_cipher(encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != EET_IMAGE_LOSSLESS)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_decode_cipher
- * @{
- * @objective Positive test case 2 checks if the function is invoked successfully.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness enum.
- *
- * @procedure
- * @step 1 Encode image data with EET_IMAGE_JPEG.
- * @step 2 Decode image data header.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns values that were set by encode
- * except quality & compress.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_cipher_p2)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0;
- Eet_Image_Encoding lossy;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, EET_IMAGE_JPEG, &size);
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
- int ret = eet_data_image_header_decode_cipher(encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || lossy != EET_IMAGE_JPEG)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_decode_cipher
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li pointer to encoded image pixel data;
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness enum.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function 6 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 4-9).
- *
- * @passcondition Function returns 0 and doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_cipher_n)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0;
- Eet_Image_Encoding lossy = EET_IMAGE_LOSSLESS;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,0,1,1,1,1,1,1);
- UNITEST_FUNC_NEG_CA_RET(0, eet_data_image_header_decode_cipher, encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- free(encoded_data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_decode_cipher
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of pointer to encoded image pixel data.
- * @n Input Data:
- * @li pointer to encoded image pixel data (is replaced with NULL);
- * @li "This is crypto key" - cipher to decode data;
- * @li size of encoded data;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness enum.
- *
- * @procedure
- * @step 1 Encode image data.
- * @step 2 Call function once and pass NULL instead of data to get decoded header,
- * but pass real size of encoded data, which is not 0.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_header_decode_cipher_n2)
-{
- int size = 0;
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0;
- Eet_Image_Encoding lossy = EET_IMAGE_LOSSLESS;
- void *encoded_data = eet_data_image_encode_cipher(test_noalpha.color, utc_eet_cipher,
- test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0, &size);
-
- if (!encoded_data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Image is not encoded..", __FILE__, __LINE__);
- }
-
- CREATE_CHECKED_ARGS_ARRAY(1,0,0,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_data_image_header_decode_cipher, encoded_data, utc_eet_cipher, size, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not 0", __FILE__, __LINE__);
- }
- else if (w || h || alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(encoded_data);
-
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_header_decode_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_cipher_p2);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_cipher_n);
- tcase_add_test(tcase, utc_eet_data_image_header_decode_cipher_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_header_decode_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_header_decode_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_header_read eet_data_image_header_read()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- * @step 2 Create and open Eet_File object
- * @step 3 Write test image to the file
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- else if (!eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w,
- test_noalpha.h, test_noalpha.alpha, 9, 100, 0)) {
- eet_close(ef);
- ef = NULL;
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Image is not written into file..", __FILE__, __LINE__);
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_header_read
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Read image header.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_header_read_p)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- int ret = eet_data_image_header_read(ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_read
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Call function 6 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 3-8).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_header_read_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,1,1,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_header_read, ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_read
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened file
- * and entry's name.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_header_read_n2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(1,1,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_data_image_header_read, ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not 0", __FILE__, __LINE__);
- }
- else if (w || h || alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_header_read");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_header_read_p);
- tcase_add_test(tcase, utc_eet_data_image_header_read_n);
- tcase_add_test(tcase, utc_eet_data_image_header_read_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_header_read.log");
- srunner_set_xml(srunner, "utc_eet_data_image_header_read.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-static const char *key= "Cryptographic key";
-
-typedef struct _Eet_Test_Image Eet_Test_Image;
-struct _Eet_Test_Image
-{
- unsigned int w;
- unsigned int h;
- int alpha;
- unsigned int color[64];
-};
-static const Eet_Test_Image test_noalpha =
-{
- 8, 8, 0,
- {
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA,
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA
- }
-};
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_header_read_cipher eet_data_image_header_read_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_header_read_cipher
- * @{
- * @objective Positive test case 01
- * Test case checks if the function is invoked successfully.
- * @procedure
- * @step 1 Create and open EET_File object.
- * @step 2 Write image data.
- * @step 3 Read image header.
- * @step 4 Check the value returned if it is not 0.
- *
- * @passcondition : API Executes successfully, returning non-zero value
- * @}
- */
-START_TEST(utc_eet_data_image_header_read_cipher_p)
-{
-
- int ret = 0;
- int result = 0;
-
- Eet_File* ef = NULL;
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test prerequisites failed.. File could not be opened", __FILE__, __LINE__);
- }
-
- unsigned int w;
- unsigned int h;
- int alpha;
- int compress;
- int quality;
- int lossy;
-
- result = eet_data_image_write_cipher(ef, "sample.jpg", key,
- test_noalpha.color,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.alpha,
- 9,
- 100,
- 0);
-
- ret = eet_data_image_header_read_cipher(ef, "sample.jpg", key, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (ret == 0)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
- eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_header_read_cipher
- * @{
- * @objective Negative test case 01
- * Test case checks if the function is invoked successfully, when the name of entry is NULL.
- * @procedure
- * @step 1 Create and open EET_File object.
- * @step 2 Read image header with NULL entry.
- * @step 3 Check the value returned if it is 0.
- *
- * @passcondition : API Executes successfully, returning 0
- * @}
- */
-START_TEST(utc_eet_data_image_header_read_cipher_n)
-{
-
- int ret = 0;
-
- Eet_File* ef = NULL;
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- unsigned int w;
- unsigned int h;
- int alpha;
- int compress;
- int quality;
- int lossy;
-
- ret = eet_data_image_header_read_cipher(ef, NULL, key, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (ret == 1)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
- eet_close(ef);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_header_read_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_header_read_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_header_read_cipher_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_header_read_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_header_read_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_read eet_data_image_read()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- * @step 2 Create and open Eet_File object
- * @step 3 Write test image to the file
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- else if (!eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w,
- test_noalpha.h, test_noalpha.alpha, 9, 100, 0)) {
- eet_close(ef);
- ef = NULL;
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Image is not written into file..", __FILE__, __LINE__);
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_read
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Read image from the file and check result.
- *
- * @passcondition Function returns pointer to loaded data, not NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_read_p)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- void *data = eet_data_image_read(ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned NULL..", __FILE__, __LINE__);
- }
- else if (w != test_noalpha.w || h != test_noalpha.h || alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_read
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Call function 6 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 3-8).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_read_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,1,1,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_read, ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_read
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li pointer to variable to write image's width;
- * @li pointer to variable to write image's height;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Call function 2 times and pass (in turn) NULL instead of opened file
- * and entry's name.
- *
- * @passcondition Function doesn't cause segmentation fault and returns NULL.
- * @}
- */
-START_TEST(utc_eet_data_image_read_n2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(1,1,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(NULL, eet_data_image_read, ef, utc_eet_entry_name, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not NULL..", __FILE__, __LINE__);
- }
- else if (w || h || alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. w=%d, h=%d, alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, w, h, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_read");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_read_p);
- tcase_add_test(tcase, utc_eet_data_image_read_n);
- tcase_add_test(tcase, utc_eet_data_image_read_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_read.log");
- srunner_set_xml(srunner, "utc_eet_data_image_read.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-
-typedef struct _Eet_Test_Image Eet_Test_Image;
-struct _Eet_Test_Image
-{
- unsigned int w;
- unsigned int h;
- int alpha;
- unsigned int color[64];
-};
-static const char *key= "Cryptographic key";
-static const Eet_Test_Image test_noalpha =
-{
- 8, 8, 0,
- {
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA,
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA
- }
-};
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_read_cipher eet_data_image_read_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_read_cipher
- * @{
- * @objective Positive test case 01
- * Test case checks if the function is invoked successfully.
- * @procedure
- * @step 1 Create and open EET_File object.
- * @step 2 Write image data.
- * @step 3 Read image data.
- * @step 4 Check the value returned if it is not NULL.
- *
- * @passcondition : API Executes successfully, returning non-NULL value
- * @}
- */
-START_TEST(utc_eet_data_image_read_cipher_p)
-{
- int result = 0;
-
-
- Eet_File* ef = NULL;
- ef = eet_open("test1.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test prerequisites failed.. File could not be opened", __FILE__, __LINE__);
- }
-
- unsigned int w;
- unsigned int h;
- int alpha;
- int compress;
- int quality;
- int lossy;
-
- result = eet_data_image_write_cipher(ef, "sample.jpg", key,
- test_noalpha.color,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.alpha,
- 9,
- 100,
- 0);
- if (result == 0)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test prerequisites failed.. Image could not be written.", __FILE__, __LINE__);
- }
-
- void* ret = NULL;
- ret = eet_data_image_read_cipher(ef, "sample.jpg", key, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (ret == NULL)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
- eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_read_cipher
- * @{
- * @objective Negative test case 01
- * Test case checks if the function is invoked successfully, when the name of entry is NULL.
- * @procedure
- * @step 1 Create and open EET_File object.
- * @step 2 Read image data with NULL entry.
- * @step 3 Check the value returned if it is NULL.
- *
- * @passcondition : API Executes successfully, returning NULL
- * @}
- */
-START_TEST(utc_eet_data_image_read_cipher_n)
-{
-
- Eet_File* ef = NULL;
- ef = eet_open("test2.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test prerequisites failed.. File could not be opened", __FILE__, __LINE__);
- }
-
- unsigned int w;
- unsigned int h;
- int alpha;
- int compress;
- int quality;
- int lossy;
-
- void* ret = NULL;
- ret = eet_data_image_read_cipher(ef, NULL, key, &w, &h, &alpha, &compress, &quality, &lossy);
-
- if (ret != NULL)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
- eet_close(ef);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_read_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_read_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_read_cipher_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_read_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_read_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_read_to_cspace_surface_cipher eet_data_image_read_to_cspace_surface_cipher()
- *
- *
- * @precondition
- * @step 1 Initialize eet library with eet_init().
- * @step 2 Create and open Eet_File object.
- * @step 3 Write test image to the file.
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- else if (!eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w,
- test_noalpha.h, test_noalpha.alpha, 9, 100, 0)) {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Image is not written into file..", __FILE__, __LINE__);
- eet_close(ef);
- ef = NULL;
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_read_to_cspace_surface_cipher
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li NULL - don't use cipler;
- * @li 0 - starting x coordinate;
- * @li 0 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write loaded data;
- * @li test_noalpha.w - expected width;
- * @li test_noalpha.h - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li cspace - the color space of the pixels bsurface;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Read image data.
- * @step 2 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_read_to_cspace_surface_cipher_p)
-{
- unsigned int *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
-
- int alpha = 0;
- int compression = 0;
- int quality = 0;
- int lossy = 0;
- Eet_Colorspace cspace = EET_COLORSPACE_ARGB8888;
-
- int ret = eet_data_image_read_to_cspace_surface_cipher(ef,
- utc_eet_entry_name,
- NULL,
- 0,
- 0,
- data,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.w * 4,
- cspace,
- &alpha,
- &compression,
- &quality,
- &lossy);
-
- free(data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (alpha != test_noalpha.alpha || compression != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compression=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compression, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_read_to_cspace_surface_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_read_to_cspace_surface_cipher_p);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_read_to_cspace_surface_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_read_to_cspace_surface_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-Eet_File *ef = NULL;
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_read_to_surface eet_data_image_read_to_surface()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- * @step 2 Create and open Eet_File object
- * @step 3 Write test image to the file
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
- ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- else if (!eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w,
- test_noalpha.h, test_noalpha.alpha, 9, 100, 0)) {
- eet_close(ef);
- ef = NULL;
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Prerequisites has failed.. Image is not written into file..", __FILE__, __LINE__);
- }
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_close(ef);
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_read_to_surface
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li 0 - starting x coordinate;
- * @li 0 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write loaded data;
- * @li test_noalpha.w - expected width;
- * @li test_noalpha.h - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Read image data.
- * @step 3 Check returned value.
- *
- * @passcondition Function executes successfully and returns non-zero value.
- * @}
- */
-START_TEST(utc_eet_data_image_read_to_surface_p)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- int ret = eet_data_image_read_to_surface(ef, utc_eet_entry_name, 0, 0, data, test_noalpha.w, test_noalpha.h, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
- free(data);
-
- if (!ret)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- else if (alpha != test_noalpha.alpha || compress != 9 || quality != 100 || lossy != 0)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_read_to_surface
- * @{
- * @objective Negative test case 1 checks if function doesn't cause segmentation fault
- * if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write loaded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Call function 4 times and pass (in turn) NULL instead of all pointers to write properties
- * of the image (parameters 9-12).
- *
- * @passcondition Function doesn't cause segmentation fault.
- * @}
- */
-START_TEST(utc_eet_data_image_read_to_surface_n)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(0,0,0,0,0,0,0,0,1,1,1,1);
- UNITEST_FUNC_NEG_CA(eet_data_image_read_to_surface, ef, utc_eet_entry_name,
- 4, 4, data, 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_read_to_surface
- * @{
- * @objective Negative test case 2 checks if function doesn't cause segmentation fault
- * and returns 0 if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "/key/to_store/at" - entry's name;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write loaded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Check if file with image is opened.
- * @step 2 Call function 3 times and pass (in turn) NULL instead of opened file,
- * entry's name and pointer to the allocated pixel surface.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_read_to_surface_n2)
-{
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- unsigned int *data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- if (!data)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Memory allocation error ..", __FILE__, __LINE__);
- }
- int alpha = 0, compress = 0, quality = 0, lossy = 0;
-
- CREATE_CHECKED_ARGS_ARRAY(1,1,0,0,1,0,0,0,0,0,0,0);
- UNITEST_FUNC_NEG_CA_RET(0, eet_data_image_read_to_surface, ef, utc_eet_entry_name,
- 4, 4, data, 2, 2, test_noalpha.w * 4, &alpha, &compress, &quality, &lossy);
-
- if (result_of_testing == TEST_FAIL)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned not NULL..", __FILE__, __LINE__);
- }
- else if (alpha || compress || quality || lossy)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. alpha=%d, compress=%d, quality=%d, lossy=%d", __FILE__, __LINE__, alpha, compress, quality, lossy);
- }
- else
- {
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
- }
- free(data);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_read_to_surface");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_read_to_surface_p);
- tcase_add_test(tcase, utc_eet_data_image_read_to_surface_n);
- tcase_add_test(tcase, utc_eet_data_image_read_to_surface_n2);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_read_to_surface.log");
- srunner_set_xml(srunner, "utc_eet_data_image_read_to_surface.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-
-typedef struct _Eet_Test_Image Eet_Test_Image;
-struct _Eet_Test_Image
-{
- unsigned int w;
- unsigned int h;
- int alpha;
- unsigned int color[64];
-};
-static const char *key= "Cryptographic key";
-static const Eet_Test_Image test_noalpha =
-{
- 8, 8, 0,
- {
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA,
- 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00,
- 0x000000AA, 0x00110000,
- 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA,
- 0x00110000, 0x00AA0000,
- 0x000000AA, 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000,
- 0x00AA0000, 0x0000AA00,
- 0x00110000, 0x00AA0000, 0x0000AA00, 0x000000AA, 0x00110000, 0x00AA0000,
- 0x0000AA00, 0x000000AA
- }
-};
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_read_to_surface_cipher eet_data_image_read_to_surface_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_read_to_surface_cipher
- * @{
- * @objective Positive test case 01
- * Test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li "sample.jpg" - entry's name;
- * @li "Cryptographic key" - The key to use as cipher;
- * @li 0 - starting x coordinate;
- * @li 0 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write loaded data;
- * @li test_noalpha.w - expected width;
- * @li test_noalpha.h - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- *
- * @procedure
- * @step 1 Create and open EET_File object.
- * @step 2 Write image data.
- * @step 3 Read image data.
- * @step 4 Check the value returned.
- *
- * @passcondition : API Executes successfully, returning non-zero value
- * @}
- */
-START_TEST(utc_eet_data_image_read_to_surface_cipher_p)
-{
-
- int ret = 0;
- int result = 0;
-
- Eet_File* ef = NULL;
- ef = eet_open("test3.eet", EET_FILE_MODE_READ_WRITE);
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test prerequisites failed.. File could not be opened", __FILE__, __LINE__);
- }
-
- unsigned int *data;
- int alpha;
- int compress;
- int quality;
- int lossy;
- data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- result = eet_data_image_write_cipher(ef, "sample.jpg", key,
- test_noalpha.color,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.alpha,
- 9,
- 100,
- 0);
- ret = eet_data_image_read_to_surface_cipher(ef, "sample.jpg",
- key,
- 0,
- 0,
- data,
- test_noalpha.w,
- test_noalpha.h,
- test_noalpha.w * 4,
- &alpha,
- &compress,
- &quality,
- &lossy);
- if (ret == 0)
- {
- free(data);
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
-
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
- free(data);
- eet_close(ef);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_read_to_surface_cipher
- * @{
- * @objective Negative test case 01
- * Test case checks if the function is invoked successfully, when the name of entry is NULL.
- * @n Input Data:
- * @li opened eet file with image to read from;
- * @li NULL instead of entry's name;
- * @li "Cryptographic key" - The key to use as cipher;
- * @li 4 - starting x coordinate;
- * @li 4 - starting y coordinate;
- * @li pointer to the allocated pixel surface to write loaded data;
- * @li 2 - expected width;
- * @li 2 - expected height;
- * @li test_noalpha.w * 4 - length of a pixels line;
- * @li pointer to variable to write image's alpha channel flag;
- * @li pointer to variable to write image's compression level;
- * @li pointer to variable to write image's quality encoding amount;
- * @li pointer to variable to write image's lossiness flag.
- * @procedure
- * @step 1 Create and open EET_File object.
- * @step 2 Read image data with NULL entry.
- * @step 3 Check the value returned.
- *
- * @passcondition : API Executes successfully, returning 0
- * @}
- */
-START_TEST(utc_eet_data_image_read_to_surface_cipher_n)
-{
-
- int ret = 0;
-
- Eet_File* ef = NULL;
- ef = eet_open("test3.eet", EET_FILE_MODE_READ_WRITE);
-
- unsigned int *data;
- int alpha;
- int compress;
- int quality;
- int lossy;
- data = malloc(test_noalpha.w * test_noalpha.h * 4);
-
- ret = eet_data_image_read_to_surface_cipher(ef, NULL,
- key,
- 4,
- 4,
- data,
- 2,
- 2,
- test_noalpha.w * 4,
- &alpha,
- &compress,
- &quality,
- &lossy);
- if (ret == 1)
- {
- free(data);
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
- free(data);
- eet_close(ef);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_read_to_surface_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_read_to_surface_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_read_to_surface_cipher_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_read_to_surface_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_read_to_surface_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_write eet_data_image_write()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_write
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file to write data;
- * @li "/key/to_store/at" - entry's name;
- * @li test_noalpha.color - pointer to the image pixel data to be saved;
- * @li test_noalpha.w (8) - width of the image;
- * @li test_noalpha.h (8) - height of the image;
- * @li test_noalpha.alpha (0) - alpha channel flag;
- * @li 9 - compression level;
- * @li 100 - quality encoding amount;
- * @li 0 - lossiness flag.
- *
- * @procedure
- * @step 1 Create and open Eet_File object.
- * @step 2 Write image.
- * @step 3 Check returned value.
- * @step 4 Read written image from the file.
- * @step 5 Compare initial and read data.
- *
- * @passcondition Function executes successfully and returns non-zero value. Initial and read image data must be equal.
- * @}
- */
-START_TEST(utc_eet_data_image_write_p)
-{
- Eet_File *ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
- int ret = eet_data_image_write(ef, utc_eet_entry_name, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!ret)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- void *data = eet_data_image_read(ef, utc_eet_entry_name, NULL, NULL, NULL, NULL, NULL, NULL);
- eet_close(ef);
-
- if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
- {
- free(data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read and written data don't match..", __FILE__, __LINE__);
- }
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_write
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file to write data;
- * @li "/key/to_store/at" - entry's name;
- * @li test_noalpha.color - pointer to the image pixel data to be saved;
- * @li test_noalpha.w (8) - width of the image;
- * @li test_noalpha.h (8) - height of the image;
- * @li test_noalpha.alpha (0) - alpha channel flag;
- * @li 9 - compression level;
- * @li 100 - quality encoding amount;
- * @li 0 - lossiness flag.
- *
- * @procedure
- * @step 1 Create and open Eet_File object.
- * @step 2 Call function 3 times and pass (in turn) NULL instead of opened file,
- * entry's name and image data to be saved.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_write_n)
-{
- Eet_File *ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
- int ret1 = 0, ret2 = 0, ret3 = 0;
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
-
- ret1 = eet_data_image_write(NULL, utc_eet_entry_name, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
- ret2 = eet_data_image_write(ef, NULL, test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
- ret3 = eet_data_image_write(ef, utc_eet_entry_name, NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (ret1 || ret2 || ret3)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_write");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_write_p);
- tcase_add_test(tcase, utc_eet_data_image_write_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_write.log");
- srunner_set_xml(srunner, "utc_eet_data_image_write.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}
+++ /dev/null
-#include <check.h>
-#include <Eina.h>
-#include <Ecore.h>
-#include <Eet.h>
-#include "../../utc_negative_unitest.h"
-#include "../utc_eet_utils.h"
-
-/**
- * @addtogroup eet_image
- * @{
- * @defgroup eet_data_image_write_cipher eet_data_image_write_cipher()
- *
- *
- * @precondition
- * @step 1 eet initialized with eet_init()
- */
-static void
-setup(void)
-{
- printf(" ============ Startup ============ \n");
- eet_init();
-}
-
-static void
-teardown(void)
-{
- printf(" ============ Cleanup ============ \n");
- eet_shutdown();
-}
-
-/**
- * @addtogroup eet_data_image_write_cipher
- * @{
- * @objective Positive test case checks if the function is invoked successfully.
- * @n Input Data:
- * @li opened eet file to write data;
- * @li "/key/to_store/at" - entry's name;
- * @li "This is crypto key" - cipher to encode data;
- * @li test_noalpha.color - pointer to the image pixel data to be saved;
- * @li test_noalpha.w (8) - width of the image;
- * @li test_noalpha.h (8) - height of the image;
- * @li test_noalpha.alpha (0) - alpha channel flag;
- * @li 9 - compression level;
- * @li 100 - quality encoding amount;
- * @li 0 - lossiness flag.
- *
- * @procedure
- * @step 1 Create and open Eet_File object.
- * @step 2 Write image data.
- * @step 3 Check returned value.
- * @step 4 Read written image from the file.
- * @step 5 Compare initial and read data.
- *
- * @passcondition Function executes successfully and returns non-zero value. Initial and read image data must be equal.
- * @}
- */
-START_TEST(utc_eet_data_image_write_cipher_p)
-{
- Eet_File *ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
-
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test prerequisites failed.. File could not be opened", __FILE__, __LINE__);
- }
- int ret = eet_data_image_write_cipher(ef, utc_eet_entry_name, utc_eet_cipher,
- test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (!ret)
- {
- eet_close(ef);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Function has returned 0", __FILE__, __LINE__);
- }
- void *data = eet_data_image_read_cipher(ef, utc_eet_entry_name, utc_eet_cipher, NULL, NULL, NULL, NULL, NULL, NULL);
- eet_close(ef);
-
- if (!data || memcmp(data, test_noalpha.color, sizeof test_noalpha.color))
- {
- free(data);
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Read and written data don't match..", __FILE__, __LINE__);
- }
- free(data);
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-}
-END_TEST
-
-/**
- * @addtogroup eet_data_image_write_cipher
- * @{
- * @objective Negative test case checks if function doesn't cause segmentation fault
- * and returns NULL if it is called with NULL instead of some arguments.
- * @n Input Data:
- * @li opened eet file to write data;
- * @li "/key/to_store/at" - entry's name;
- * @li "This is crypto key" - cipher to encode data;
- * @li test_noalpha.color - pointer to the image pixel data to be saved;
- * @li test_noalpha.w (8) - width of the image;
- * @li test_noalpha.h (8) - height of the image;
- * @li test_noalpha.alpha (0) - alpha channel flag;
- * @li 9 - compression level;
- * @li 100 - quality encoding amount;
- * @li 0 - lossiness flag.
- *
- * @procedure
- * @step 1 Create and open Eet_File object.
- * @step 2 Call function 3 times and pass (in turn) NULL instead of opened file,
- * entry's name and image data to be saved.
- *
- * @passcondition Function doesn't cause segmentation fault and returns 0.
- * @}
- */
-START_TEST(utc_eet_data_image_write_cipher_n)
-{
- Eet_File *ef = eet_open("test.eet", EET_FILE_MODE_READ_WRITE);
- int ret1 = 0, ret2 = 0, ret3 = 0;
- if (!ef)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed.. Eet_File is not opened..", __FILE__,__LINE__);
- }
-
- ret1 = eet_data_image_write_cipher(NULL, utc_eet_entry_name, utc_eet_cipher,
- test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
- ret2 = eet_data_image_write_cipher(ef, NULL, utc_eet_cipher,
- test_noalpha.color, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
- ret3 = eet_data_image_write_cipher(ef, utc_eet_entry_name, utc_eet_cipher,
- NULL, test_noalpha.w, test_noalpha.h, test_noalpha.alpha, 9, 100, 0);
-
- if (ret1 || ret2 || ret3)
- {
- ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
- }
- printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
-
-}
-END_TEST
-/**
- *@}
- */
-Suite *
-test_suite(void)
-{
- Suite *suite = suite_create("utc_eet_data_image_write_cipher");
-
- TCase *tcase = tcase_create("TCase");
- tcase_set_timeout(tcase, 30);
- tcase_add_checked_fixture(tcase, setup, teardown);
- tcase_add_test(tcase, utc_eet_data_image_write_cipher_p);
- tcase_add_test(tcase, utc_eet_data_image_write_cipher_n);
- suite_add_tcase(suite, tcase);
-
- return suite;
-}
-
-int
-main()
-{
- int number_failed;
-
- Suite *suite = test_suite();
- SRunner *srunner = srunner_create(suite);
- srunner_set_log(srunner, "utc_eet_data_image_write_cipher.log");
- srunner_set_xml(srunner, "utc_eet_data_image_write_cipher.xml");
- srunner_run_all(srunner, CK_NORMAL);
- number_failed = srunner_ntests_failed(srunner);
- srunner_free(srunner);
-
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}