/**
* @addtogroup eet_data_image_header_decode_cipher
* @{
- * @objective Positive test case checks if the function is invoked successfully.
+ * @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 flag;
+ * @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 flag.
+ * @li pointer to variable to write image's lossiness enum.
*
* @procedure
- * @step 1 Encode image data.
+ * @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 non-zero 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, lossy = 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, 0, &size);
+ 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__);
{
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)
+ 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);
}
* @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 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 flag.
+ * @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 doesn't cause segmentation fault.
+ * @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, lossy = 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)
* @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 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 flag.
+ * @li pointer to variable to write image's lossiness enum.
*
* @procedure
* @step 1 Encode image data.
{
int size = 0;
unsigned int w = 0, h = 0;
- int alpha = 0, compress = 0, quality = 0, lossy = 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);
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);