mirror of
https://github.com/reactos/reactos.git
synced 2025-01-15 08:03:53 +08:00
[GDIPLUS_WINETEST] Sync with Wine Staging 3.3. CORE-14434
This commit is contained in:
parent
5f279f2d12
commit
e3f6657f95
@ -18,7 +18,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
||||
|
@ -18,7 +18,9 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)
|
||||
|
@ -19,7 +19,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
|
||||
#define expect_(expected, got, precision) ok(abs((expected) - (got)) <= (precision), "Expected %d, got %d\n", (expected), (got))
|
||||
|
@ -19,7 +19,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))
|
||||
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
|
||||
|
@ -18,7 +18,10 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
#include <math.h>
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(fabs(expected - got) < 2.0, "Expected %.2f, got %.2f\n", expected, got)
|
||||
@ -1298,6 +1301,7 @@ static void test_empty_rect(void)
|
||||
{
|
||||
GpPath *path;
|
||||
GpStatus status;
|
||||
INT count;
|
||||
BOOL result;
|
||||
|
||||
status = GdipCreatePath(FillModeAlternate, &path);
|
||||
@ -1306,19 +1310,42 @@ static void test_empty_rect(void)
|
||||
status = GdipAddPathRectangle(path, 0.0, 0.0, -5.0, 5.0);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipGetPointCount(path, &count);
|
||||
expect(Ok, status);
|
||||
expect(0, count);
|
||||
|
||||
status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result);
|
||||
expect(Ok, status);
|
||||
expect(FALSE, status);
|
||||
expect(FALSE, result);
|
||||
|
||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, -5.0);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipGetPointCount(path, &count);
|
||||
expect(Ok, status);
|
||||
expect(0, count);
|
||||
|
||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipGetPointCount(path, &count);
|
||||
expect(Ok, status);
|
||||
expect(0, count);
|
||||
|
||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipGetPointCount(path, &count);
|
||||
expect(Ok, status);
|
||||
expect(0, count);
|
||||
|
||||
status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.1);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipGetPointCount(path, &count);
|
||||
expect(Ok, status);
|
||||
expect(4, count);
|
||||
|
||||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
|
@ -19,10 +19,20 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#define COBJMACROS
|
||||
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "initguid.h"
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#ifdef __REACTOS__
|
||||
#include <ole2.h>
|
||||
#endif
|
||||
|
||||
/* FIXME: They belong to gdipluseffects.h */
|
||||
DEFINE_GUID(BlurEffectGuid, 0x633c80a4, 0x1843, 0x482b, 0x9e, 0xf2, 0xbe, 0x28, 0x34, 0xc5, 0xfd, 0xd4);
|
||||
@ -41,6 +51,8 @@ static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat,UINT*);
|
||||
static GpStatus (WINAPI *pGdipBitmapGetHistogram)(GpBitmap*,HistogramFormat,UINT,UINT*,UINT*,UINT*,UINT*);
|
||||
static GpStatus (WINAPI *pGdipImageSetAbort)(GpImage*,GdiplusAbort*);
|
||||
|
||||
static GpStatus (WINGDIPAPI *pGdipInitializePalette)(ColorPalette*,PaletteType,INT,BOOL,GpBitmap*);
|
||||
|
||||
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got))
|
||||
#define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))
|
||||
|
||||
@ -3248,8 +3260,6 @@ static GpImage *load_image(const BYTE *image_data, UINT image_size)
|
||||
ok(refcount == 1, "expected stream refcount 1, got %d\n", refcount);
|
||||
|
||||
status = GdipLoadImageFromStream(stream, &image);
|
||||
ok(status == Ok || broken(status == InvalidParameter), /* XP */
|
||||
"GdipLoadImageFromStream error %d\n", status);
|
||||
if (status != Ok)
|
||||
{
|
||||
IStream_Release(stream);
|
||||
@ -4804,14 +4814,13 @@ static void test_supported_encoders(void)
|
||||
{
|
||||
LPCWSTR mime;
|
||||
const GUID *format;
|
||||
BOOL todo;
|
||||
} td[] =
|
||||
{
|
||||
{ bmp_mimetype, &ImageFormatBMP, FALSE },
|
||||
{ jpeg_mimetype, &ImageFormatJPEG, FALSE },
|
||||
{ gif_mimetype, &ImageFormatGIF, TRUE },
|
||||
{ tiff_mimetype, &ImageFormatTIFF, FALSE },
|
||||
{ png_mimetype, &ImageFormatPNG, FALSE }
|
||||
{ bmp_mimetype, &ImageFormatBMP },
|
||||
{ jpeg_mimetype, &ImageFormatJPEG },
|
||||
{ gif_mimetype, &ImageFormatGIF },
|
||||
{ tiff_mimetype, &ImageFormatTIFF },
|
||||
{ png_mimetype, &ImageFormatPNG }
|
||||
};
|
||||
GUID format, clsid;
|
||||
BOOL ret;
|
||||
@ -4837,8 +4846,7 @@ static void test_supported_encoders(void)
|
||||
ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
|
||||
|
||||
status = GdipSaveImageToStream((GpImage *)bm, stream, &clsid, NULL);
|
||||
todo_wine_if (td[i].todo)
|
||||
ok(status == Ok, "GdipSaveImageToStream error %d\n", status);
|
||||
ok(status == Ok, "GdipSaveImageToStream error %d\n", status);
|
||||
|
||||
IStream_Release(stream);
|
||||
}
|
||||
@ -5168,6 +5176,360 @@ static void test_png_color_formats(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void test_GdipLoadImageFromStream(void)
|
||||
{
|
||||
IStream *stream;
|
||||
GpStatus status;
|
||||
GpImage *image;
|
||||
HGLOBAL hglob;
|
||||
BYTE *data;
|
||||
HRESULT hr;
|
||||
|
||||
status = GdipLoadImageFromStream(NULL, NULL);
|
||||
ok(status == InvalidParameter, "Unexpected return value %d.\n", status);
|
||||
|
||||
image = (void *)0xdeadbeef;
|
||||
status = GdipLoadImageFromStream(NULL, &image);
|
||||
ok(status == InvalidParameter, "Unexpected return value %d.\n", status);
|
||||
ok(image == (void *)0xdeadbeef, "Unexpected image pointer.\n");
|
||||
|
||||
hglob = GlobalAlloc(0, sizeof(pngimage));
|
||||
data = GlobalLock (hglob);
|
||||
memcpy(data, pngimage, sizeof(pngimage));
|
||||
GlobalUnlock(hglob);
|
||||
|
||||
hr = CreateStreamOnHGlobal(hglob, TRUE, &stream);
|
||||
ok(hr == S_OK, "Failed to create a stream.\n");
|
||||
|
||||
status = GdipLoadImageFromStream(stream, NULL);
|
||||
ok(status == InvalidParameter, "Unexpected return value %d.\n", status);
|
||||
|
||||
IStream_Release(stream);
|
||||
}
|
||||
|
||||
static BYTE *init_bitmap(UINT *width, UINT *height, UINT *stride)
|
||||
{
|
||||
BYTE *src;
|
||||
UINT i, j, scale;
|
||||
|
||||
*width = 256;
|
||||
*height = 256;
|
||||
*stride = (*width * 3 + 3) & ~3;
|
||||
trace("width %d, height %d, stride %d\n", *width, *height, *stride);
|
||||
|
||||
src = HeapAlloc(GetProcessHeap(), 0, *stride * *height);
|
||||
|
||||
scale = 256 / *width;
|
||||
if (!scale) scale = 1;
|
||||
|
||||
for (i = 0; i < *height; i++)
|
||||
{
|
||||
for (j = 0; j < *width; j++)
|
||||
{
|
||||
src[i * *stride + j*3 + 0] = scale * i;
|
||||
src[i * *stride + j*3 + 1] = scale * (255 - (i+j)/2);
|
||||
src[i * *stride + j*3 + 2] = scale * j;
|
||||
}
|
||||
}
|
||||
|
||||
return src;
|
||||
}
|
||||
|
||||
static void test_GdipInitializePalette(void)
|
||||
{
|
||||
GpStatus status;
|
||||
BYTE *data;
|
||||
GpBitmap *bitmap;
|
||||
ColorPalette *palette;
|
||||
UINT width, height, stride;
|
||||
|
||||
pGdipInitializePalette = (void *)GetProcAddress(GetModuleHandleA("gdiplus.dll"), "GdipInitializePalette");
|
||||
if (!pGdipInitializePalette)
|
||||
{
|
||||
win_skip("GdipInitializePalette is not supported on this platform\n");
|
||||
return;
|
||||
}
|
||||
|
||||
data = init_bitmap(&width, &height, &stride);
|
||||
|
||||
status = GdipCreateBitmapFromScan0(width, height, stride, PixelFormat24bppRGB, data, &bitmap);
|
||||
expect(Ok, status);
|
||||
|
||||
palette = GdipAlloc(sizeof(*palette) + sizeof(ARGB) * 255);
|
||||
|
||||
palette->Flags = 0;
|
||||
palette->Count = 15;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, bitmap);
|
||||
expect(GenericError, status);
|
||||
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
memset(palette->Entries, 0x11, sizeof(ARGB) * 256);
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeCustom, 16, FALSE, NULL);
|
||||
expect(Ok, status);
|
||||
expect(0, palette->Flags);
|
||||
expect(256, palette->Count);
|
||||
expect(0x11111111, palette->Entries[0]);
|
||||
expect(0x11111111, palette->Entries[128]);
|
||||
expect(0x11111111, palette->Entries[255]);
|
||||
|
||||
memset(palette->Entries, 0x11, sizeof(ARGB) * 256);
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeFixedBW, 0, FALSE, bitmap);
|
||||
expect(Ok, status);
|
||||
todo_wine
|
||||
expect(0x200, palette->Flags);
|
||||
expect(2, palette->Count);
|
||||
expect(0xff000000, palette->Entries[0]);
|
||||
expect(0xffffffff, palette->Entries[1]);
|
||||
|
||||
memset(palette->Entries, 0x11, sizeof(ARGB) * 256);
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone8, 1, FALSE, NULL);
|
||||
expect(Ok, status);
|
||||
todo_wine
|
||||
expect(0x300, palette->Flags);
|
||||
expect(16, palette->Count);
|
||||
expect(0xff000000, palette->Entries[0]);
|
||||
expect(0xffc0c0c0, palette->Entries[8]);
|
||||
expect(0xff008080, palette->Entries[15]);
|
||||
|
||||
memset(palette->Entries, 0x11, sizeof(ARGB) * 256);
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone8, 1, FALSE, bitmap);
|
||||
expect(Ok, status);
|
||||
todo_wine
|
||||
expect(0x300, palette->Flags);
|
||||
expect(16, palette->Count);
|
||||
expect(0xff000000, palette->Entries[0]);
|
||||
expect(0xffc0c0c0, palette->Entries[8]);
|
||||
expect(0xff008080, palette->Entries[15]);
|
||||
|
||||
memset(palette->Entries, 0x11, sizeof(ARGB) * 256);
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeFixedHalftone252, 1, FALSE, bitmap);
|
||||
expect(Ok, status);
|
||||
todo_wine
|
||||
expect(0x800, palette->Flags);
|
||||
expect(252, palette->Count);
|
||||
expect(0xff000000, palette->Entries[0]);
|
||||
expect(0xff990066, palette->Entries[128]);
|
||||
expect(0xffffffff, palette->Entries[251]);
|
||||
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeOptimal, 1, FALSE, bitmap);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeOptimal, 2, FALSE, bitmap);
|
||||
expect(Ok, status);
|
||||
expect(0, palette->Flags);
|
||||
expect(2, palette->Count);
|
||||
|
||||
palette->Flags = 0;
|
||||
palette->Count = 256;
|
||||
status = pGdipInitializePalette(palette, PaletteTypeOptimal, 16, FALSE, bitmap);
|
||||
expect(Ok, status);
|
||||
expect(0, palette->Flags);
|
||||
expect(16, palette->Count);
|
||||
|
||||
/* passing invalid enumeration palette type crashes under most Windows versions */
|
||||
|
||||
GdipFree(palette);
|
||||
GdipDisposeImage((GpImage *)bitmap);
|
||||
}
|
||||
|
||||
#include "pshpack2.h"
|
||||
static const struct tiff_1x1_data
|
||||
{
|
||||
USHORT byte_order;
|
||||
USHORT version;
|
||||
ULONG dir_offset;
|
||||
USHORT number_of_entries;
|
||||
struct IFD_entry entry[12];
|
||||
ULONG next_IFD;
|
||||
struct IFD_rational res;
|
||||
short palette_data[3][256];
|
||||
short bps_data[4];
|
||||
BYTE pixel_data[32];
|
||||
} tiff_1x1_data =
|
||||
{
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
'M' | 'M' << 8,
|
||||
#else
|
||||
'I' | 'I' << 8,
|
||||
#endif
|
||||
42,
|
||||
FIELD_OFFSET(struct tiff_1x1_data, number_of_entries),
|
||||
12,
|
||||
{
|
||||
{ 0xff, IFD_SHORT, 1, 0 }, /* SUBFILETYPE */
|
||||
{ 0x100, IFD_LONG, 1, 1 }, /* IMAGEWIDTH */
|
||||
{ 0x101, IFD_LONG, 1, 1 }, /* IMAGELENGTH */
|
||||
{ 0x102, IFD_SHORT, 3, FIELD_OFFSET(struct tiff_1x1_data, bps_data) }, /* BITSPERSAMPLE */
|
||||
{ 0x103, IFD_SHORT, 1, 1 }, /* COMPRESSION: XP doesn't accept IFD_LONG here */
|
||||
{ 0x106, IFD_SHORT, 1, 2 }, /* PHOTOMETRIC */
|
||||
{ 0x111, IFD_LONG, 1, FIELD_OFFSET(struct tiff_1x1_data, pixel_data) }, /* STRIPOFFSETS */
|
||||
{ 0x115, IFD_SHORT, 1, 3 }, /* SAMPLESPERPIXEL */
|
||||
{ 0x11a, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) },
|
||||
{ 0x11b, IFD_RATIONAL, 1, FIELD_OFFSET(struct tiff_1x1_data, res) },
|
||||
{ 0x128, IFD_SHORT, 1, 2 }, /* RESOLUTIONUNIT */
|
||||
{ 0x140, IFD_SHORT, 256*3, FIELD_OFFSET(struct tiff_1x1_data, palette_data) } /* COLORMAP */
|
||||
},
|
||||
0,
|
||||
{ 96, 1 },
|
||||
{ { 0 } },
|
||||
{ 8,8,8,0 },
|
||||
{ 1,0,2,3,4,5,6,7,8,9,0,1,2,3,4,5 }
|
||||
};
|
||||
#include "poppack.h"
|
||||
|
||||
static void test_tiff_color_formats(void)
|
||||
{
|
||||
static const struct
|
||||
{
|
||||
int photometric; /* PhotometricInterpretation */
|
||||
int samples; /* SamplesPerPixel */
|
||||
int bps; /* BitsPerSample */
|
||||
PixelFormat format;
|
||||
} td[] =
|
||||
{
|
||||
/* 2 - RGB */
|
||||
{ 2, 3, 1, PixelFormat24bppRGB },
|
||||
{ 2, 3, 4, PixelFormat24bppRGB },
|
||||
{ 2, 3, 8, PixelFormat24bppRGB },
|
||||
{ 2, 3, 16, PixelFormat48bppRGB },
|
||||
{ 2, 3, 24, 0 },
|
||||
#if 0 /* FIXME */
|
||||
{ 2, 3, 32, 0 },
|
||||
#endif
|
||||
{ 2, 4, 1, PixelFormat32bppARGB },
|
||||
{ 2, 4, 4, PixelFormat32bppARGB },
|
||||
{ 2, 4, 8, PixelFormat32bppARGB },
|
||||
{ 2, 4, 16, PixelFormat48bppRGB },
|
||||
{ 2, 4, 24, 0 },
|
||||
{ 2, 4, 32, 0 },
|
||||
/* 1 - BlackIsZero (Bilevel) */
|
||||
{ 1, 1, 1, PixelFormat1bppIndexed },
|
||||
#if 0 /* FIXME: PNG vs TIFF mismatch */
|
||||
{ 1, 1, 4, PixelFormat8bppIndexed },
|
||||
#endif
|
||||
{ 1, 1, 8, PixelFormat8bppIndexed },
|
||||
{ 1, 1, 16, PixelFormat32bppARGB },
|
||||
{ 1, 1, 24, 0 },
|
||||
{ 1, 1, 32, PixelFormat32bppARGB },
|
||||
/* 3 - Palette Color */
|
||||
{ 3, 1, 1, PixelFormat1bppIndexed },
|
||||
{ 3, 1, 4, PixelFormat4bppIndexed },
|
||||
{ 3, 1, 8, PixelFormat8bppIndexed },
|
||||
#if 0 /* FIXME: for some reason libtiff replaces photometric 3 by 1 for bps > 8 */
|
||||
{ 3, 1, 16, 0 },
|
||||
{ 3, 1, 24, 0 },
|
||||
{ 3, 1, 32, 0 },
|
||||
#endif
|
||||
/* 5 - Separated */
|
||||
{ 5, 4, 1, 0 },
|
||||
{ 5, 4, 4, 0 },
|
||||
{ 5, 4, 8, PixelFormat32bppCMYK },
|
||||
{ 5, 4, 16, PixelFormat48bppRGB },
|
||||
{ 5, 4, 24, 0 },
|
||||
{ 5, 4, 32, 0 },
|
||||
};
|
||||
BYTE buf[sizeof(tiff_1x1_data)];
|
||||
GpStatus status;
|
||||
GpImage *image;
|
||||
UINT count, i;
|
||||
struct IFD_entry *tag, *tag_photo = NULL, *tag_bps = NULL, *tag_samples = NULL, *tag_colormap = NULL;
|
||||
short *bps;
|
||||
ImageType type;
|
||||
PixelFormat format;
|
||||
|
||||
memcpy(buf, &tiff_1x1_data, sizeof(tiff_1x1_data));
|
||||
|
||||
count = *(short *)(buf + tiff_1x1_data.dir_offset);
|
||||
tag = (struct IFD_entry *)(buf + tiff_1x1_data.dir_offset + sizeof(short));
|
||||
|
||||
/* verify the TIFF structure */
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (tag[i].id == 0x102) /* BitsPerSample */
|
||||
tag_bps = &tag[i];
|
||||
else if (tag[i].id == 0x106) /* PhotometricInterpretation */
|
||||
tag_photo = &tag[i];
|
||||
else if (tag[i].id == 0x115) /* SamplesPerPixel */
|
||||
tag_samples = &tag[i];
|
||||
else if (tag[i].id == 0x140) /* ColorMap */
|
||||
tag_colormap = &tag[i];
|
||||
}
|
||||
|
||||
ok(tag_bps && tag_photo && tag_samples && tag_colormap, "tag 0x102,0x106,0x115 or 0x140 is missing\n");
|
||||
if (!tag_bps || !tag_photo || !tag_samples || !tag_colormap) return;
|
||||
|
||||
ok(tag_bps->type == IFD_SHORT, "tag 0x102 should have type IFD_SHORT\n");
|
||||
bps = (short *)(buf + tag_bps->value);
|
||||
ok(bps[0] == 8 && bps[1] == 8 && bps[2] == 8 && bps[3] == 0,
|
||||
"expected bps 8,8,8,0 got %d,%d,%d,%d\n", bps[0], bps[1], bps[2], bps[3]);
|
||||
|
||||
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
|
||||
{
|
||||
tag_colormap->count = (1 << td[i].bps) * 3;
|
||||
tag_photo->value = td[i].photometric;
|
||||
tag_bps->count = td[i].samples;
|
||||
tag_samples->value = td[i].samples;
|
||||
|
||||
if (td[i].samples == 1)
|
||||
tag_bps->value = td[i].bps;
|
||||
else if (td[i].samples == 2)
|
||||
tag_bps->value = MAKELONG(td[i].bps, td[i].bps);
|
||||
else if (td[i].samples == 3)
|
||||
{
|
||||
tag_bps->value = (BYTE *)bps - buf;
|
||||
bps[0] = bps[1] = bps[2] = td[i].bps;
|
||||
}
|
||||
else if (td[i].samples == 4)
|
||||
{
|
||||
tag_bps->value = (BYTE *)bps - buf;
|
||||
bps[0] = bps[1] = bps[2] = bps[3] = td[i].bps;
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(0, "%u: unsupported samples count %d\n", i, td[i].samples);
|
||||
continue;
|
||||
}
|
||||
|
||||
image = load_image(buf, sizeof(buf));
|
||||
if (!td[i].format)
|
||||
ok(!image,
|
||||
"%u: (%d,%d,%d) TIFF image loading should have failed\n", i, td[i].photometric, td[i].samples, td[i].bps);
|
||||
else
|
||||
ok(image != NULL || broken(!image) /* XP */, "%u: failed to load TIFF image data (%d,%d,%d)\n",
|
||||
i, td[i].photometric, td[i].samples, td[i].bps);
|
||||
if (!image) continue;
|
||||
|
||||
status = GdipGetImageType(image, &type);
|
||||
ok(status == Ok, "%u: GdipGetImageType error %d\n", i, status);
|
||||
ok(type == ImageTypeBitmap, "%u: wrong image type %d\n", i, type);
|
||||
|
||||
status = GdipGetImagePixelFormat(image, &format);
|
||||
expect(Ok, status);
|
||||
ok(format == td[i].format,
|
||||
"%u: expected %#x, got %#x\n", i, td[i].format, format);
|
||||
|
||||
GdipDisposeImage(image);
|
||||
}
|
||||
}
|
||||
|
||||
START_TEST(image)
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA("gdiplus.dll");
|
||||
@ -5192,6 +5554,8 @@ START_TEST(image)
|
||||
pGdipBitmapGetHistogram = (void*)GetProcAddress(mod, "GdipBitmapGetHistogram");
|
||||
pGdipImageSetAbort = (void*)GetProcAddress(mod, "GdipImageSetAbort");
|
||||
|
||||
test_tiff_color_formats();
|
||||
test_GdipInitializePalette();
|
||||
test_png_color_formats();
|
||||
test_supported_encoders();
|
||||
test_CloneBitmapArea();
|
||||
@ -5241,6 +5605,7 @@ START_TEST(image)
|
||||
test_getadjustedpalette();
|
||||
test_histogram();
|
||||
test_imageabort();
|
||||
test_GdipLoadImageFromStream();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
@ -18,7 +18,12 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
||||
|
@ -18,7 +18,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
|
||||
|
@ -18,7 +18,9 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
|
||||
|
@ -18,7 +18,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(fabs(got - expected) < 0.1, "Expected %.2f, got %.2f\n", expected, got)
|
||||
|
@ -1,3 +1,4 @@
|
||||
|
||||
#ifndef _GDIPLUS_WINETEST_PRECOMP_H_
|
||||
#define _GDIPLUS_WINETEST_PRECOMP_H_
|
||||
|
||||
@ -6,9 +7,11 @@
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
#define COBJMACROS
|
||||
|
||||
#include <wine/test.h>
|
||||
|
||||
#include <wingdi.h>
|
||||
#include <winnls.h>
|
||||
#include <objbase.h>
|
||||
|
@ -19,7 +19,11 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include <math.h>
|
||||
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define RGNDATA_RECT 0x10000000
|
||||
#define RGNDATA_PATH 0x10000001
|
||||
|
@ -18,7 +18,9 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
#include "objbase.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)
|
||||
|
Loading…
Reference in New Issue
Block a user