2014-09-28 19:02:39 +04:00
|
|
|
|
|
|
|
#include <winpr/crt.h>
|
2014-09-28 19:14:30 +04:00
|
|
|
#include <winpr/path.h>
|
|
|
|
#include <winpr/print.h>
|
2014-09-28 19:02:39 +04:00
|
|
|
#include <winpr/image.h>
|
|
|
|
|
2014-09-28 19:14:30 +04:00
|
|
|
int test_image_png_to_bmp()
|
|
|
|
{
|
|
|
|
int status;
|
|
|
|
wImage* image;
|
|
|
|
|
|
|
|
if (!PathFileExistsA("/tmp/test.png"))
|
|
|
|
return 1; /* skip */
|
|
|
|
|
|
|
|
image = winpr_image_new();
|
|
|
|
|
|
|
|
if (!image)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
status = winpr_image_read(image, "/tmp/test.png");
|
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
image->type = WINPR_IMAGE_BITMAP;
|
|
|
|
status = winpr_image_write(image, "/tmp/test_out.bmp");
|
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
image->type = WINPR_IMAGE_PNG;
|
|
|
|
status = winpr_image_write(image, "/tmp/test_out.png");
|
|
|
|
|
|
|
|
if (status < 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
winpr_image_free(image, TRUE);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-09-28 19:02:39 +04:00
|
|
|
int TestImage(int argc, char* argv[])
|
|
|
|
{
|
2014-09-28 19:14:30 +04:00
|
|
|
test_image_png_to_bmp();
|
|
|
|
|
2014-09-28 19:02:39 +04:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|