mirror of
https://github.com/reactos/reactos.git
synced 2025-02-20 15:35:04 +00:00
[GDIPLUS_WINETEST]
* Sync with Wine 1.7.17. CORE-8080 svn path=/trunk/; revision=62889
This commit is contained in:
parent
86c5b8463d
commit
f201819ae8
7 changed files with 823 additions and 121 deletions
|
@ -742,7 +742,7 @@ static void test_font_substitution(void)
|
|||
WCHAR ms_shell_dlg[LF_FACESIZE];
|
||||
HDC hdc;
|
||||
HFONT hfont;
|
||||
LOGFONT lf;
|
||||
LOGFONTA lf;
|
||||
GpStatus status;
|
||||
GpGraphics *graphics;
|
||||
GpFont *font;
|
||||
|
@ -757,9 +757,9 @@ static void test_font_substitution(void)
|
|||
ok(hfont != 0, "GetStockObject(DEFAULT_GUI_FONT) failed\n");
|
||||
|
||||
memset(&lf, 0xfe, sizeof(lf));
|
||||
ret = GetObject(hfont, sizeof(lf), &lf);
|
||||
ret = GetObjectA(hfont, sizeof(lf), &lf);
|
||||
ok(ret == sizeof(lf), "GetObject failed\n");
|
||||
ok(!lstrcmp(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
|
||||
ok(!lstrcmpA(lf.lfFaceName, "MS Shell Dlg"), "wrong face name %s\n", lf.lfFaceName);
|
||||
MultiByteToWideChar(CP_ACP, 0, lf.lfFaceName, -1, ms_shell_dlg, LF_FACESIZE);
|
||||
|
||||
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
|
@ -767,8 +767,8 @@ static void test_font_substitution(void)
|
|||
memset(&lf, 0xfe, sizeof(lf));
|
||||
status = GdipGetLogFontA(font, graphics, &lf);
|
||||
expect(Ok, status);
|
||||
ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
|
||||
!lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
|
||||
ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
|
||||
!lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
status = GdipCreateFontFamilyFromName(ms_shell_dlg, NULL, &family);
|
||||
|
@ -778,21 +778,21 @@ static void test_font_substitution(void)
|
|||
memset(&lf, 0xfe, sizeof(lf));
|
||||
status = GdipGetLogFontA(font, graphics, &lf);
|
||||
expect(Ok, status);
|
||||
ok(!lstrcmp(lf.lfFaceName, "Microsoft Sans Serif") ||
|
||||
!lstrcmp(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
|
||||
ok(!lstrcmpA(lf.lfFaceName, "Microsoft Sans Serif") ||
|
||||
!lstrcmpA(lf.lfFaceName, "Tahoma"), "wrong face name %s\n", lf.lfFaceName);
|
||||
GdipDeleteFont(font);
|
||||
GdipDeleteFontFamily(family);
|
||||
|
||||
status = GdipCreateFontFamilyFromName(nonexistent, NULL, &family);
|
||||
ok(status == FontFamilyNotFound, "expected FontFamilyNotFound, got %d\n", status);
|
||||
|
||||
lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
|
||||
lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
|
||||
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
expect(Ok, status);
|
||||
memset(&lf, 0xfe, sizeof(lf));
|
||||
status = GdipGetLogFontA(font, graphics, &lf);
|
||||
expect(Ok, status);
|
||||
ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
|
||||
ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
/* empty FaceName */
|
||||
|
@ -802,13 +802,13 @@ static void test_font_substitution(void)
|
|||
memset(&lf, 0xfe, sizeof(lf));
|
||||
status = GdipGetLogFontA(font, graphics, &lf);
|
||||
expect(Ok, status);
|
||||
ok(!lstrcmp(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
|
||||
ok(!lstrcmpA(lf.lfFaceName, "Arial"), "wrong face name %s\n", lf.lfFaceName);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
/* zeroing out lfWeight and lfCharSet leads to font creation failure */
|
||||
lf.lfWeight = 0;
|
||||
lf.lfCharSet = 0;
|
||||
lstrcpy(lf.lfFaceName, "ThisFontShouldNotExist");
|
||||
lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
|
||||
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
todo_wine
|
||||
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
|
||||
|
@ -830,7 +830,7 @@ static void test_font_transform(void)
|
|||
static const WCHAR string[] = { 'A',0 };
|
||||
GpStatus status;
|
||||
HDC hdc;
|
||||
LOGFONT lf;
|
||||
LOGFONTA lf;
|
||||
GpFont *font;
|
||||
GpGraphics *graphics;
|
||||
GpMatrix *matrix;
|
||||
|
@ -852,7 +852,7 @@ static void test_font_transform(void)
|
|||
expect(Ok, status);
|
||||
|
||||
memset(&lf, 0, sizeof(lf));
|
||||
lstrcpy(lf.lfFaceName, "Tahoma");
|
||||
lstrcpyA(lf.lfFaceName, "Tahoma");
|
||||
lf.lfHeight = -100;
|
||||
lf.lfWidth = 100;
|
||||
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#define _INC_WINDOWS
|
||||
|
@ -66,7 +65,7 @@ static REAL units_to_pixels(REAL units, GpUnit unit, REAL dpi)
|
|||
case UnitMillimeter:
|
||||
return units * dpi / mm_per_inch;
|
||||
default:
|
||||
assert(0);
|
||||
ok(0, "Unsupported unit: %d\n", unit);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -88,7 +87,7 @@ static REAL pixels_to_units(REAL pixels, GpUnit unit, REAL dpi)
|
|||
case UnitMillimeter:
|
||||
return pixels * mm_per_inch / dpi;
|
||||
default:
|
||||
assert(0);
|
||||
ok(0, "Unsupported unit: %d\n", unit);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -5502,6 +5501,52 @@ static void test_clipping_2(void)
|
|||
DeleteDC(hdc);
|
||||
}
|
||||
|
||||
|
||||
static void test_GdipFillRectangles(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpBrush *brush = NULL;
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpRectF rects[2] = {{0,0,10,10}, {10,10,10,10}};
|
||||
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
ok(graphics != NULL, "Expected graphics to be initialized\n");
|
||||
|
||||
status = GdipCreateSolidFill((ARGB)0xffff00ff, (GpSolidFill**)&brush);
|
||||
expect(Ok, status);
|
||||
ok(brush != NULL, "Expected brush to be initialized\n");
|
||||
|
||||
status = GdipFillRectangles(NULL, brush, rects, 2);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipFillRectangles(graphics, NULL, rects, 2);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipFillRectangles(graphics, brush, NULL, 2);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipFillRectangles(graphics, brush, rects, 0);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipFillRectangles(graphics, brush, rects, -1);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipFillRectangles(graphics, brush, rects, 1);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipFillRectangles(graphics, brush, rects, 2);
|
||||
expect(Ok, status);
|
||||
|
||||
GdipDeleteBrush(brush);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
START_TEST(graphics)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -5513,8 +5558,8 @@ START_TEST(graphics)
|
|||
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
class.lpfnWndProc = DefWindowProcA;
|
||||
class.hInstance = GetModuleHandleA(0);
|
||||
class.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
class.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
class.hIcon = LoadIconA(0, (LPCSTR)IDI_APPLICATION);
|
||||
class.hCursor = LoadCursorA(0, (LPCSTR)IDC_ARROW);
|
||||
class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
RegisterClassA( &class );
|
||||
hwnd = CreateWindowA( "gdiplus_test", "graphics test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
|
@ -5574,6 +5619,7 @@ START_TEST(graphics)
|
|||
test_getdc_scaled();
|
||||
test_alpha_hdc();
|
||||
test_bitmapfromgraphics();
|
||||
test_GdipFillRectangles();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
DestroyWindow( hwnd );
|
||||
|
|
|
@ -162,15 +162,16 @@ static void test_getpathdata(void)
|
|||
GpStatus status;
|
||||
INT count;
|
||||
|
||||
GdipCreatePath(FillModeAlternate, &path);
|
||||
status = GdipCreatePath(FillModeAlternate, &path);
|
||||
expect(Ok, status);
|
||||
status = GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
|
||||
expect(Ok, status);
|
||||
|
||||
/* Prepare storage. Made by wrapper class. */
|
||||
status = GdipGetPointCount(path, &count);
|
||||
expect(Ok, status);
|
||||
expect(2, count);
|
||||
|
||||
data.Count = 2;
|
||||
data.Count = count;
|
||||
data.Types = GdipAlloc(sizeof(BYTE) * count);
|
||||
data.Points = GdipAlloc(sizeof(PointF) * count);
|
||||
|
||||
|
|
|
@ -3221,8 +3221,10 @@ static void test_tiff_properties(void)
|
|||
ok(td[i].id == prop_item->id, "%u: expected id %#x, got %#x\n", i, td[i].id, prop_item->id);
|
||||
prop_size -= sizeof(*prop_item);
|
||||
ok(prop_item->length == prop_size, "%u: expected length %u, got %u\n", i, prop_size, prop_item->length);
|
||||
ok(td[i].length == prop_item->length, "%u: expected length %u, got %u\n", i, td[i].length, prop_item->length);
|
||||
ok(td[i].length == prop_size, "%u: expected length %u, got %u\n", i, td[i].length, prop_size);
|
||||
ok(td[i].length == prop_item->length || broken(td[i].id == 0xf00f && td[i].length == prop_item->length+1) /* XP */,
|
||||
"%u: expected length %u, got %u\n", i, td[i].length, prop_item->length);
|
||||
ok(td[i].length == prop_size || broken(td[i].id == 0xf00f && td[i].length == prop_size+1) /* XP */,
|
||||
"%u: expected length %u, got %u\n", i, td[i].length, prop_size);
|
||||
if (td[i].length == prop_item->length)
|
||||
{
|
||||
int match = memcmp(td[i].value, prop_item->value, td[i].length) == 0;
|
||||
|
@ -3231,10 +3233,10 @@ static void test_tiff_properties(void)
|
|||
{
|
||||
UINT j;
|
||||
BYTE *data = prop_item->value;
|
||||
printf("id %#x:", prop_item->id);
|
||||
trace("id %#x:", prop_item->id);
|
||||
for (j = 0; j < prop_item->length; j++)
|
||||
printf(" %02x", data[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", data[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, prop_item);
|
||||
|
@ -3337,10 +3339,10 @@ static void test_GdipGetAllPropertyItems(void)
|
|||
{
|
||||
UINT j;
|
||||
BYTE *data = prop_item->value;
|
||||
printf("id %#x:", prop_item->id);
|
||||
trace("id %#x:", prop_item->id);
|
||||
for (j = 0; j < prop_item->length; j++)
|
||||
printf(" %02x", data[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", data[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, prop_item);
|
||||
|
@ -3399,10 +3401,10 @@ static void test_GdipGetAllPropertyItems(void)
|
|||
{
|
||||
UINT j;
|
||||
BYTE *data = prop_item[i].value;
|
||||
printf("id %#x:", prop_item[i].id);
|
||||
trace("id %#x:", prop_item[i].id);
|
||||
for (j = 0; j < prop_item[i].length; j++)
|
||||
printf(" %02x", data[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", data[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
item_data += prop_item[i].length;
|
||||
|
@ -3631,10 +3633,10 @@ static void test_bitmapbits(void)
|
|||
if (!match)
|
||||
{
|
||||
BYTE *bits = data.Scan0;
|
||||
printf("%u: data mismatch for format %#x:", i, td[i].format);
|
||||
trace("%u: data mismatch for format %#x:", i, td[i].format);
|
||||
for (j = 0; j < td[i].size; j++)
|
||||
printf(" %02x", bits[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", bits[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3662,10 +3664,10 @@ static void test_bitmapbits(void)
|
|||
{
|
||||
UINT j;
|
||||
BYTE *bits = data.Scan0;
|
||||
printf("%u: data mismatch for format %#x:", i, td[i].format);
|
||||
trace("%u: data mismatch for format %#x:", i, td[i].format);
|
||||
for (j = 0; j < 48; j++)
|
||||
printf(" %02x", bits[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", bits[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3717,8 +3719,8 @@ static void test_DrawImage(void)
|
|||
UINT i, size = sizeof(white_2x2);
|
||||
BYTE *bits = white_2x2;
|
||||
for (i = 0; i < size; i++)
|
||||
printf(" %02x", bits[i]);
|
||||
printf("\n");
|
||||
trace(" %02x", bits[i]);
|
||||
trace("\n");
|
||||
}
|
||||
|
||||
status = GdipDeleteGraphics(graphics);
|
||||
|
@ -3769,8 +3771,8 @@ static void test_GdipDrawImagePointRect(void)
|
|||
UINT i, size = sizeof(white_2x2);
|
||||
BYTE *bits = white_2x2;
|
||||
for (i = 0; i < size; i++)
|
||||
printf(" %02x", bits[i]);
|
||||
printf("\n");
|
||||
trace(" %02x", bits[i]);
|
||||
trace("\n");
|
||||
}
|
||||
|
||||
status = GdipDeleteGraphics(graphics);
|
||||
|
@ -3817,7 +3819,7 @@ static void test_image_format(void)
|
|||
else
|
||||
{
|
||||
expect(Ok, status);
|
||||
ret = GetObject(hbitmap, sizeof(bm), &bm);
|
||||
ret = GetObjectW(hbitmap, sizeof(bm), &bm);
|
||||
expect(sizeof(bm), ret);
|
||||
expect(0, bm.bmType);
|
||||
expect(1, bm.bmWidth);
|
||||
|
@ -3976,8 +3978,8 @@ static void test_DrawImage_scale(void)
|
|||
UINT i, size = sizeof(dst_8x1);
|
||||
const BYTE *bits = dst_8x1;
|
||||
for (i = 0; i < size; i++)
|
||||
printf(" %02x", bits[i]);
|
||||
printf("\n");
|
||||
trace(" %02x", bits[i]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4102,10 +4104,10 @@ static void test_gif_properties(void)
|
|||
{
|
||||
UINT j;
|
||||
BYTE *data = prop_item->value;
|
||||
printf("id %#x:", prop_item->id);
|
||||
trace("id %#x:", prop_item->id);
|
||||
for (j = 0; j < prop_item->length; j++)
|
||||
printf(" %02x", data[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", data[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, prop_item);
|
||||
|
@ -4164,10 +4166,10 @@ static void test_gif_properties(void)
|
|||
{
|
||||
UINT j;
|
||||
BYTE *data = prop_item[i].value;
|
||||
printf("id %#x:", prop_item[i].id);
|
||||
trace("id %#x:", prop_item[i].id);
|
||||
for (j = 0; j < prop_item[i].length; j++)
|
||||
printf(" %02x", data[j]);
|
||||
printf("\n");
|
||||
trace(" %02x", data[j]);
|
||||
trace("\n");
|
||||
}
|
||||
}
|
||||
item_data += prop_item[i].length;
|
||||
|
@ -4248,6 +4250,32 @@ static void test_ARGB_conversion(void)
|
|||
GdipDisposeImage((GpImage *)bitmap);
|
||||
}
|
||||
|
||||
|
||||
static void test_CloneBitmapArea(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpBitmap *bitmap, *copy;
|
||||
BitmapData data, data2;
|
||||
|
||||
status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bitmap);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead | ImageLockModeWrite, PixelFormat24bppRGB, &data);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat24bppRGB, &data2);
|
||||
expect(WrongState, status);
|
||||
|
||||
status = GdipCloneBitmapAreaI(0, 0, 1, 1, PixelFormat24bppRGB, bitmap, ©);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipBitmapUnlockBits(bitmap, &data);
|
||||
expect(Ok, status);
|
||||
|
||||
GdipDisposeImage((GpImage *)copy);
|
||||
GdipDisposeImage((GpImage *)bitmap);
|
||||
}
|
||||
|
||||
START_TEST(image)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -4260,6 +4288,7 @@ START_TEST(image)
|
|||
|
||||
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||
|
||||
test_CloneBitmapArea();
|
||||
test_ARGB_conversion();
|
||||
test_DrawImage_scale();
|
||||
test_image_format();
|
||||
|
|
|
@ -83,6 +83,9 @@ static void test_transform(void)
|
|||
|
||||
GdipCreateMatrix2(1.0, -2.0, 30.0, 40.0, -500.0, 600.0, &matrix);
|
||||
|
||||
status = GdipTransformMatrixPoints(matrix, pts, 0);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipTransformMatrixPoints(matrix, pts, 10);
|
||||
expect(Ok, status);
|
||||
|
||||
|
|
|
@ -22,19 +22,23 @@
|
|||
#define _INC_WINDOWS
|
||||
#define COM_NO_WINDOWS_H
|
||||
|
||||
//#include "windows.h"
|
||||
#include <math.h>
|
||||
|
||||
#include <wine/test.h>
|
||||
#include <wingdi.h>
|
||||
#include <objbase.h>
|
||||
#include <gdiplus.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 %f, got %f\n", (expected), (got))
|
||||
|
||||
static BOOL save_metafiles;
|
||||
|
||||
typedef struct emfplus_record
|
||||
{
|
||||
ULONG todo;
|
||||
BOOL todo;
|
||||
ULONG record_type;
|
||||
ULONG playback_todo;
|
||||
BOOL playback_todo;
|
||||
} emfplus_record;
|
||||
|
||||
typedef struct emfplus_check_state
|
||||
|
@ -94,7 +98,7 @@ static int CALLBACK enum_emf_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETAR
|
|||
|
||||
if (state->expected[state->count].record_type)
|
||||
{
|
||||
actual.todo = 0;
|
||||
actual.todo = FALSE;
|
||||
actual.record_type = record->Type;
|
||||
|
||||
check_record(state->count, state->desc, &state->expected[state->count], &actual);
|
||||
|
@ -117,7 +121,7 @@ static int CALLBACK enum_emf_proc(HDC hDC, HANDLETABLE *lpHTable, const ENHMETAR
|
|||
|
||||
if (state->expected[state->count].record_type)
|
||||
{
|
||||
actual.todo = 0;
|
||||
actual.todo = FALSE;
|
||||
actual.record_type = lpEMFR->iType;
|
||||
|
||||
check_record(state->count, state->desc, &state->expected[state->count], &actual);
|
||||
|
@ -154,7 +158,7 @@ static BOOL CALLBACK enum_metafile_proc(EmfPlusRecordType record_type, unsigned
|
|||
emfplus_check_state *state = (emfplus_check_state*)userdata;
|
||||
emfplus_record actual;
|
||||
|
||||
actual.todo = 0;
|
||||
actual.todo = FALSE;
|
||||
actual.record_type = record_type;
|
||||
|
||||
if (dataSize == 0)
|
||||
|
@ -251,6 +255,29 @@ static void play_metafile(GpMetafile *metafile, GpGraphics *graphics, const emfp
|
|||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
static void save_metafile(GpMetafile *metafile, const char *filename)
|
||||
{
|
||||
if (save_metafiles)
|
||||
{
|
||||
GpMetafile *clone;
|
||||
HENHMETAFILE hemf;
|
||||
GpStatus stat;
|
||||
|
||||
stat = GdipCloneImage((GpImage*)metafile, (GpImage**)&clone);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetHemfFromMetafile(clone, &hemf);
|
||||
expect(Ok, stat);
|
||||
|
||||
DeleteEnhMetaFile(CopyEnhMetaFileA(hemf, filename));
|
||||
|
||||
DeleteEnhMetaFile(hemf);
|
||||
|
||||
stat = GdipDisposeImage((GpImage*)clone);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
}
|
||||
|
||||
static const emfplus_record empty_records[] = {
|
||||
{0, EMR_HEADER},
|
||||
{0, EmfPlusRecordTypeHeader},
|
||||
|
@ -313,6 +340,8 @@ static void test_empty(void)
|
|||
|
||||
check_metafile(metafile, empty_records, "empty metafile", dst_points, &frame, UnitPixel);
|
||||
|
||||
save_metafile(metafile, "empty.emf");
|
||||
|
||||
stat = GdipGetHemfFromMetafile(metafile, &hemf);
|
||||
expect(Ok, stat);
|
||||
|
||||
|
@ -402,6 +431,8 @@ static void test_getdc(void)
|
|||
|
||||
check_metafile(metafile, getdc_records, "getdc metafile", dst_points, &frame, UnitPixel);
|
||||
|
||||
save_metafile(metafile, "getdc.emf");
|
||||
|
||||
stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
|
@ -535,6 +566,8 @@ static void test_emfonly(void)
|
|||
|
||||
check_metafile(metafile, emfonly_records, "emfonly metafile", dst_points, &frame, UnitPixel);
|
||||
|
||||
save_metafile(metafile, "emfonly.emf");
|
||||
|
||||
stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
|
@ -607,10 +640,323 @@ static void test_emfonly(void)
|
|||
ok(ret != 0, "Failed to delete enhmetafile %p\n", hemf);
|
||||
}
|
||||
|
||||
static const emfplus_record fillrect_records[] = {
|
||||
{0, EMR_HEADER},
|
||||
{0, EmfPlusRecordTypeHeader},
|
||||
{0, EmfPlusRecordTypeFillRects},
|
||||
{0, EmfPlusRecordTypeEndOfFile},
|
||||
{0, EMR_EOF},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void test_fillrect(void)
|
||||
{
|
||||
GpStatus stat;
|
||||
GpMetafile *metafile;
|
||||
GpGraphics *graphics;
|
||||
HDC hdc;
|
||||
HENHMETAFILE hemf;
|
||||
static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
|
||||
static const GpPointF dst_points[3] = {{0.0,0.0},{100.0,0.0},{0.0,100.0}};
|
||||
static const GpPointF dst_points_half[3] = {{0.0,0.0},{50.0,0.0},{0.0,50.0}};
|
||||
static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
|
||||
GpBitmap *bitmap;
|
||||
ARGB color;
|
||||
GpBrush *brush;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
|
||||
stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitPixel, description, &metafile);
|
||||
expect(Ok, stat);
|
||||
|
||||
DeleteDC(hdc);
|
||||
|
||||
if (stat != Ok)
|
||||
return;
|
||||
|
||||
stat = GdipGetHemfFromMetafile(metafile, &hemf);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipCreateSolidFill((ARGB)0xff0000ff, (GpSolidFill**)&brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipFillRectangleI(graphics, brush, 25, 25, 75, 75);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteBrush(brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
check_metafile(metafile, fillrect_records, "fillrect metafile", dst_points, &frame, UnitPixel);
|
||||
|
||||
save_metafile(metafile, "fillrect.emf");
|
||||
|
||||
stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
play_metafile(metafile, graphics, fillrect_records, "fillrect playback", dst_points, &frame, UnitPixel);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 15, 15, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 50, 50, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
stat = GdipBitmapSetPixel(bitmap, 50, 50, 0);
|
||||
expect(Ok, stat);
|
||||
|
||||
play_metafile(metafile, graphics, fillrect_records, "fillrect playback", dst_points_half, &frame, UnitPixel);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 15, 15, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 50, 50, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0, color);
|
||||
|
||||
stat = GdipBitmapSetPixel(bitmap, 15, 15, 0);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDrawImagePointsRect(graphics, (GpImage*)metafile, dst_points, 3,
|
||||
0.0, 0.0, 100.0, 100.0, UnitPixel, NULL, NULL, NULL);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 15, 15, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 50, 50, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDisposeImage((GpImage*)bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDisposeImage((GpImage*)metafile);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
static const emfplus_record pagetransform_records[] = {
|
||||
{0, EMR_HEADER},
|
||||
{0, EmfPlusRecordTypeHeader},
|
||||
{0, EmfPlusRecordTypeFillRects},
|
||||
{0, EmfPlusRecordTypeSetPageTransform},
|
||||
{0, EmfPlusRecordTypeFillRects},
|
||||
{0, EmfPlusRecordTypeSetPageTransform},
|
||||
{0, EmfPlusRecordTypeFillRects},
|
||||
{0, EmfPlusRecordTypeSetPageTransform},
|
||||
{0, EmfPlusRecordTypeFillRects},
|
||||
{0, EmfPlusRecordTypeSetPageTransform},
|
||||
{0, EmfPlusRecordTypeFillRects},
|
||||
{0, EmfPlusRecordTypeEndOfFile},
|
||||
{0, EMR_EOF},
|
||||
{0}
|
||||
};
|
||||
|
||||
static void test_pagetransform(void)
|
||||
{
|
||||
GpStatus stat;
|
||||
GpMetafile *metafile;
|
||||
GpGraphics *graphics;
|
||||
HDC hdc;
|
||||
static const GpRectF frame = {0.0, 0.0, 5.0, 5.0};
|
||||
static const GpPointF dst_points[3] = {{0.0,0.0},{100.0,0.0},{0.0,100.0}};
|
||||
static const WCHAR description[] = {'w','i','n','e','t','e','s','t',0};
|
||||
GpBitmap *bitmap;
|
||||
ARGB color;
|
||||
GpBrush *brush;
|
||||
GpUnit unit;
|
||||
REAL scale, dpix, dpiy;
|
||||
UINT width, height;
|
||||
|
||||
hdc = CreateCompatibleDC(0);
|
||||
|
||||
stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame, MetafileFrameUnitInch, description, &metafile);
|
||||
expect(Ok, stat);
|
||||
|
||||
DeleteDC(hdc);
|
||||
|
||||
if (stat != Ok)
|
||||
return;
|
||||
|
||||
stat = GdipGetImageHorizontalResolution((GpImage*)metafile, &dpix);
|
||||
todo_wine expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetImageVerticalResolution((GpImage*)metafile, &dpiy);
|
||||
todo_wine expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetImageWidth((GpImage*)metafile, &width);
|
||||
todo_wine expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetImageHeight((GpImage*)metafile, &height);
|
||||
todo_wine expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* initial scale */
|
||||
stat = GdipGetPageUnit(graphics, &unit);
|
||||
expect(Ok, stat);
|
||||
expect(UnitDisplay, unit);
|
||||
|
||||
stat = GdipGetPageScale(graphics, &scale);
|
||||
expect(Ok, stat);
|
||||
expectf(1.0, scale);
|
||||
|
||||
stat = GdipGetDpiX(graphics, &dpix);
|
||||
expect(Ok, stat);
|
||||
expectf(96.0, dpix);
|
||||
|
||||
stat = GdipGetDpiY(graphics, &dpiy);
|
||||
expect(Ok, stat);
|
||||
expectf(96.0, dpiy);
|
||||
|
||||
stat = GdipCreateSolidFill((ARGB)0xff0000ff, (GpSolidFill**)&brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipFillRectangleI(graphics, brush, 1, 2, 1, 1);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteBrush(brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* page unit = pixels */
|
||||
stat = GdipSetPageUnit(graphics, UnitPixel);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetPageUnit(graphics, &unit);
|
||||
expect(Ok, stat);
|
||||
expect(UnitPixel, unit);
|
||||
|
||||
stat = GdipCreateSolidFill((ARGB)0xff00ff00, (GpSolidFill**)&brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipFillRectangleI(graphics, brush, 0, 1, 1, 1);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteBrush(brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* page scale = 3, unit = pixels */
|
||||
stat = GdipSetPageScale(graphics, 3.0);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetPageScale(graphics, &scale);
|
||||
expect(Ok, stat);
|
||||
expectf(3.0, scale);
|
||||
|
||||
stat = GdipCreateSolidFill((ARGB)0xff00ffff, (GpSolidFill**)&brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipFillRectangleI(graphics, brush, 0, 1, 2, 2);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteBrush(brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* page scale = 3, unit = inches */
|
||||
stat = GdipSetPageUnit(graphics, UnitInch);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetPageUnit(graphics, &unit);
|
||||
expect(Ok, stat);
|
||||
expect(UnitInch, unit);
|
||||
|
||||
stat = GdipCreateSolidFill((ARGB)0xffff0000, (GpSolidFill**)&brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipFillRectangle(graphics, brush, 1.0/96.0, 0, 1, 1);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteBrush(brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
/* page scale = 3, unit = display */
|
||||
stat = GdipSetPageUnit(graphics, UnitDisplay);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetPageUnit(graphics, &unit);
|
||||
expect(Ok, stat);
|
||||
expect(UnitDisplay, unit);
|
||||
|
||||
stat = GdipCreateSolidFill((ARGB)0xffff00ff, (GpSolidFill**)&brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipFillRectangle(graphics, brush, 3, 3, 2, 2);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteBrush(brush);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
check_metafile(metafile, pagetransform_records, "pagetransform metafile", dst_points, &frame, UnitPixel);
|
||||
|
||||
save_metafile(metafile, "pagetransform.emf");
|
||||
|
||||
stat = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat32bppARGB, NULL, &bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
play_metafile(metafile, graphics, pagetransform_records, "pagetransform playback", dst_points, &frame, UnitPixel);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 50, 50, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 30, 50, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 10, 30, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff00ff00, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 20, 80, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff00ffff, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 80, 20, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xffff0000, color);
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap, 80, 80, &color);
|
||||
expect(Ok, stat);
|
||||
expect(0xffff00ff, color);
|
||||
|
||||
stat = GdipDeleteGraphics(graphics);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDisposeImage((GpImage*)bitmap);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipDisposeImage((GpImage*)metafile);
|
||||
expect(Ok, stat);
|
||||
}
|
||||
|
||||
START_TEST(metafile)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
ULONG_PTR gdiplusToken;
|
||||
int myARGC;
|
||||
char **myARGV;
|
||||
|
||||
gdiplusStartupInput.GdiplusVersion = 1;
|
||||
gdiplusStartupInput.DebugEventCallback = NULL;
|
||||
|
@ -619,9 +965,16 @@ START_TEST(metafile)
|
|||
|
||||
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
||||
|
||||
myARGC = winetest_get_mainargs( &myARGV );
|
||||
|
||||
if (myARGC >= 3 && !strcmp(myARGV[2], "save"))
|
||||
save_metafiles = TRUE;
|
||||
|
||||
test_empty();
|
||||
test_getdc();
|
||||
test_emfonly();
|
||||
test_fillrect();
|
||||
test_pagetransform();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Unit test suite for gdiplus regions
|
||||
*
|
||||
* Copyright (C) 2008 Huw Davies
|
||||
* Copyright (C) 2013 Dmitry Timoshkov
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -37,20 +38,13 @@
|
|||
#define RGNDATA_MAGIC 0xdbc01001
|
||||
#define RGNDATA_MAGIC2 0xdbc01002
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#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))
|
||||
#define expectf(expected, got) expectf_((expected), (got), 0.001)
|
||||
|
||||
#define expectf_(expected, got, precision) ok(fabs(expected - got) < precision, "Expected %.2f, got %.2f\n", expected, got)
|
||||
#define expectf(expected, got) expectf_(expected, got, 0.0001)
|
||||
|
||||
#define expect_magic(value) ok(*value == RGNDATA_MAGIC || *value == RGNDATA_MAGIC2, "Expected a known magic value, got %8x\n", *value)
|
||||
|
||||
#define expect_dword(value, expected) ok(*(value) == expected, "expected %08x got %08x\n", expected, *(value))
|
||||
|
||||
static inline void expect_float(DWORD *value, FLOAT expected)
|
||||
{
|
||||
FLOAT valuef = *(FLOAT*)value;
|
||||
ok(valuef == expected, "expected %f got %f\n", expected, valuef);
|
||||
}
|
||||
#define expect_magic(value) ok(*(value) == RGNDATA_MAGIC || *(value) == RGNDATA_MAGIC2, "Expected a known magic value, got %8x\n", *(value))
|
||||
#define expect_dword(value, expected) expect((expected), *(value))
|
||||
#define expect_float(value, expected) expectf((expected), *(FLOAT *)(value))
|
||||
|
||||
/* We get shorts back, not INTs like a GpPoint */
|
||||
typedef struct RegionDataPoint
|
||||
|
@ -91,7 +85,9 @@ static void verify_region(HRGN hrgn, const RECT *rc)
|
|||
{
|
||||
rect = (const RECT *)rgn.data.Buffer;
|
||||
trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
|
||||
ok(EqualRect(rect, rc), "rects don't match\n");
|
||||
ok(EqualRect(rect, rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
|
||||
rc->left, rc->top, rc->right, rc->bottom,
|
||||
rect->left, rect->top, rect->right, rect->bottom);
|
||||
}
|
||||
|
||||
ok(rgn.data.rdh.dwSize == sizeof(rgn.data.rdh), "expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
|
||||
|
@ -106,7 +102,9 @@ static void verify_region(HRGN hrgn, const RECT *rc)
|
|||
ok(rgn.data.rdh.nCount == 1, "expected 1, got %u\n", rgn.data.rdh.nCount);
|
||||
ok(rgn.data.rdh.nRgnSize == sizeof(RECT), "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
|
||||
}
|
||||
ok(EqualRect(&rgn.data.rdh.rcBound, rc), "rects don't match\n");
|
||||
ok(EqualRect(&rgn.data.rdh.rcBound, rc), "expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
|
||||
rc->left, rc->top, rc->right, rc->bottom,
|
||||
rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top, rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
|
||||
}
|
||||
|
||||
static void test_getregiondata(void)
|
||||
|
@ -115,54 +113,75 @@ static void test_getregiondata(void)
|
|||
GpRegion *region, *region2;
|
||||
RegionDataPoint *point;
|
||||
UINT needed;
|
||||
DWORD buf[100];
|
||||
DWORD buf[256];
|
||||
GpRect rect;
|
||||
GpPath *path;
|
||||
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
GpMatrix *matrix;
|
||||
|
||||
status = GdipCreateRegion(®ion);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
|
||||
needed = 0;
|
||||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(20, needed);
|
||||
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, 0, &needed);
|
||||
ok(status == InvalidParameter, "status %08x\n", status);
|
||||
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, 4, &needed);
|
||||
ok(status == InsufficientBuffer, "status %08x\n", status);
|
||||
expect(4, needed);
|
||||
expect_dword(buf, 0xeeeeeeee);
|
||||
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(20, needed);
|
||||
expect_dword(buf, 12);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
|
||||
expect_dword(buf + 6, 0xeeeeeeee);
|
||||
|
||||
status = GdipSetEmpty(region);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(20, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(20, needed);
|
||||
expect_dword(buf, 12);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_EMPTY_RECT);
|
||||
expect_dword(buf + 6, 0xeeeeeeee);
|
||||
|
||||
status = GdipSetInfinite(region);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(20, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(20, needed);
|
||||
expect_dword(buf, 12);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
|
||||
expect_dword(buf + 6, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeleteRegion(region);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
|
@ -176,18 +195,21 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(36, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(36, needed);
|
||||
expect_dword(buf, 28);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_RECT);
|
||||
expect_float(buf + 5, 10.0);
|
||||
expect_float(buf + 6, 20.0);
|
||||
expect_float(buf + 7, 100.0);
|
||||
expect_float(buf + 8, 200.0);
|
||||
expect_dword(buf + 10, 0xeeeeeeee);
|
||||
|
||||
rect.X = 50;
|
||||
rect.Y = 30;
|
||||
|
@ -228,12 +250,14 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(156, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(156, needed);
|
||||
expect_dword(buf, 148);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 10);
|
||||
expect_dword(buf + 4, CombineModeExclude);
|
||||
expect_dword(buf + 5, CombineModeComplement);
|
||||
|
@ -270,6 +294,7 @@ static void test_getregiondata(void)
|
|||
expect_float(buf + 36, 500.0);
|
||||
expect_float(buf + 37, 22.0);
|
||||
expect_float(buf + 38, 55.0);
|
||||
expect_dword(buf + 39, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeleteRegion(region2);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
|
@ -287,16 +312,18 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(72, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(72, needed);
|
||||
expect_dword(buf, 64);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 0x00000030);
|
||||
expect_magic((DWORD*)(buf + 6));
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 0x00000004);
|
||||
expect_dword(buf + 8, 0x00000000);
|
||||
expect_float(buf + 9, 12.5);
|
||||
|
@ -308,7 +335,7 @@ static void test_getregiondata(void)
|
|||
expect_float(buf + 15, 12.5);
|
||||
expect_float(buf + 16, 28.0);
|
||||
expect_dword(buf + 17, 0x81010100);
|
||||
|
||||
expect_dword(buf + 18, 0xeeeeeeee);
|
||||
|
||||
rect.X = 50;
|
||||
rect.Y = 30;
|
||||
|
@ -319,17 +346,19 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(96, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(96, needed);
|
||||
expect_dword(buf, 88);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 2);
|
||||
expect_dword(buf + 4, CombineModeIntersect);
|
||||
expect_dword(buf + 5, RGNDATA_PATH);
|
||||
expect_dword(buf + 6, 0x00000030);
|
||||
expect_magic((DWORD*)(buf + 7));
|
||||
expect_magic(buf + 7);
|
||||
expect_dword(buf + 8, 0x00000004);
|
||||
expect_dword(buf + 9, 0x00000000);
|
||||
expect_float(buf + 10, 12.5);
|
||||
|
@ -346,6 +375,7 @@ static void test_getregiondata(void)
|
|||
expect_float(buf + 21, 30.0);
|
||||
expect_float(buf + 22, 10.0);
|
||||
expect_float(buf + 23, 20.0);
|
||||
expect_dword(buf + 24, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeleteRegion(region);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
|
@ -360,22 +390,31 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
expect(Ok, status);
|
||||
expect(36, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
expect(Ok, status);
|
||||
expect(36, needed);
|
||||
expect_dword(buf, 28);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
|
||||
/* Second signature for pathdata */
|
||||
expect_dword(buf + 5, 12);
|
||||
expect_magic((DWORD*)(buf + 6));
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 0);
|
||||
/* flags 0x4000 means its a path of shorts instead of FLOAT */
|
||||
ok((*(buf + 8) & (~ 0x00004000)) == 0x00000000,
|
||||
"expected 00000000 got %08x\n", *(buf + 8) & (~ 0x00004000));
|
||||
/* flags 0 means that a path is an array of FLOATs */
|
||||
ok(*(buf + 8) == 0x4000 /* before win7 */ || *(buf + 8) == 0,
|
||||
"expected 0x4000 or 0, got %08x\n", *(buf + 8));
|
||||
expect_dword(buf + 10, 0xeeeeeeee);
|
||||
|
||||
/* Transform an empty region */
|
||||
status = GdipCreateMatrix(&matrix);
|
||||
expect(Ok, status);
|
||||
status = GdipTransformRegion(region, matrix);
|
||||
expect(Ok, status);
|
||||
GdipDeleteMatrix(matrix);
|
||||
|
||||
status = GdipDeleteRegion(region);
|
||||
expect(Ok, status);
|
||||
|
@ -392,21 +431,23 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
expect(Ok, status);
|
||||
expect(56, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
expect(Ok, status);
|
||||
expect(56, needed);
|
||||
expect_dword(buf, 48);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3 , 0);
|
||||
expect_dword(buf + 4 , RGNDATA_PATH);
|
||||
|
||||
expect_dword(buf + 5, 32);
|
||||
expect_magic((DWORD*)(buf + 6));
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 4);
|
||||
expect_dword(buf + 8, 0x00004000); /* ?? */
|
||||
/* flags 0x4000 means that a path is an array of shorts instead of FLOATs */
|
||||
expect_dword(buf + 8, 0x4000);
|
||||
|
||||
point = (RegionDataPoint*)buf + 9;
|
||||
point = (RegionDataPoint*)(buf + 9);
|
||||
expect(5, point[0].X);
|
||||
expect(6, point[0].Y);
|
||||
expect(7, point[1].X); /* buf + 10 */
|
||||
|
@ -416,6 +457,34 @@ static void test_getregiondata(void)
|
|||
expect(5, point[3].X); /* buf + 12 */
|
||||
expect(6, point[3].Y);
|
||||
expect_dword(buf + 13, 0x81010100); /* 0x01010100 if we don't close the path */
|
||||
expect_dword(buf + 14, 0xeeeeeeee);
|
||||
|
||||
status = GdipTranslateRegion(region, 0.6, 0.8);
|
||||
expect(Ok, status);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
expect(Ok, status);
|
||||
expect(72, needed);
|
||||
expect_dword(buf, 64);
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3 , 0);
|
||||
expect_dword(buf + 4 , RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 48);
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 4);
|
||||
/* flags 0 means that a path is an array of FLOATs */
|
||||
expect_dword(buf + 8, 0);
|
||||
expect_float(buf + 9, 5.6);
|
||||
expect_float(buf + 10, 6.8);
|
||||
expect_float(buf + 11, 7.6);
|
||||
expect_float(buf + 12, 8.8);
|
||||
expect_float(buf + 13, 8.6);
|
||||
expect_float(buf + 14, 1.8);
|
||||
expect_float(buf + 15, 5.6);
|
||||
expect_float(buf + 16, 6.8);
|
||||
expect_dword(buf + 17, 0x81010100); /* 0x01010100 if we don't close the path */
|
||||
expect_dword(buf + 18, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeletePath(path);
|
||||
expect(Ok, status);
|
||||
|
@ -434,17 +503,18 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
expect(Ok, status);
|
||||
expect(72, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
expect(Ok, status);
|
||||
expect(72, needed);
|
||||
expect_dword(buf, 64);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
|
||||
expect_dword(buf + 5, 48);
|
||||
expect_magic((DWORD*)(buf + 6));
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 4);
|
||||
expect_dword(buf + 8, 0);
|
||||
expect_float(buf + 9, 5.6);
|
||||
|
@ -455,6 +525,8 @@ static void test_getregiondata(void)
|
|||
expect_float(buf + 14, 1.6);
|
||||
expect_float(buf + 15, 5.6);
|
||||
expect_float(buf + 16, 6.2);
|
||||
expect_dword(buf + 17, 0x01010100);
|
||||
expect_dword(buf + 18, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeletePath(path);
|
||||
expect(Ok, status);
|
||||
|
@ -481,29 +553,29 @@ static void test_getregiondata(void)
|
|||
status = GdipGetRegionDataSize(region, &needed);
|
||||
expect(Ok, status);
|
||||
expect(116, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
expect(Ok, status);
|
||||
expect(116, needed);
|
||||
expect_dword(buf, 108);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 2);
|
||||
expect_dword(buf + 4, CombineModeUnion);
|
||||
expect_dword(buf + 5, RGNDATA_RECT);
|
||||
expect_float(buf + 6, 20);
|
||||
expect_float(buf + 7, 25);
|
||||
expect_float(buf + 8, 60);
|
||||
expect_float(buf + 9, 120);
|
||||
expect_float(buf + 6, 20.0);
|
||||
expect_float(buf + 7, 25.0);
|
||||
expect_float(buf + 8, 60.0);
|
||||
expect_float(buf + 9, 120.0);
|
||||
expect_dword(buf + 10, RGNDATA_PATH);
|
||||
|
||||
expect_dword(buf + 11, 68);
|
||||
expect_magic((DWORD*)(buf + 12));
|
||||
expect_magic(buf + 12);
|
||||
expect_dword(buf + 13, 6);
|
||||
expect_float(buf + 14, 0x0);
|
||||
|
||||
expect_float(buf + 15, 50);
|
||||
expect_float(buf + 14, 0.0);
|
||||
expect_float(buf + 15, 50.0);
|
||||
expect_float(buf + 16, 70.2);
|
||||
expect_float(buf + 17, 60);
|
||||
expect_float(buf + 17, 60.0);
|
||||
expect_float(buf + 18, 102.8);
|
||||
expect_float(buf + 19, 55.4);
|
||||
expect_float(buf + 20, 122.4);
|
||||
|
@ -511,11 +583,160 @@ static void test_getregiondata(void)
|
|||
expect_float(buf + 22, 60.2);
|
||||
expect_float(buf + 23, 45.6);
|
||||
expect_float(buf + 24, 20.2);
|
||||
expect_float(buf + 25, 50);
|
||||
expect_float(buf + 25, 50.0);
|
||||
expect_float(buf + 26, 70.2);
|
||||
expect_dword(buf + 27, 0x01010100);
|
||||
ok(*(buf + 28) == 0x00000101 || *(buf + 28) == 0x43050101 /* Win 7 */,
|
||||
"expected 00000101 or 43050101 got %08x\n", *(buf + 28));
|
||||
expect_dword(buf + 29, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeletePath(path);
|
||||
expect(Ok, status);
|
||||
status = GdipDeleteRegion(region);
|
||||
expect(Ok, status);
|
||||
|
||||
/* Test how shorts are stored in the region path data */
|
||||
status = GdipCreatePath(FillModeAlternate, &path);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
GdipAddPathRectangleI(path, -1969, -1974, 1995, 1997);
|
||||
|
||||
status = GdipCreateRegionPath(path, ®ion);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
needed = 0;
|
||||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(56, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(56, needed);
|
||||
expect_dword(buf, 48);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 32);
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 4);
|
||||
/* flags 0x4000 means that a path is an array of shorts instead of FLOATs */
|
||||
expect_dword(buf + 8, 0x4000);
|
||||
point = (RegionDataPoint*)(buf + 9);
|
||||
expect(-1969, point[0].X);
|
||||
expect(-1974, point[0].Y);
|
||||
expect(26, point[1].X); /* buf + 10 */
|
||||
expect(-1974, point[1].Y);
|
||||
expect(26, point[2].X); /* buf + 11 */
|
||||
expect(23, point[2].Y);
|
||||
expect(-1969, point[3].X); /* buf + 12 */
|
||||
expect(23, point[3].Y);
|
||||
expect_dword(buf + 13, 0x81010100); /* 0x01010100 if we don't close the path */
|
||||
expect_dword(buf + 14, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeletePath(path);
|
||||
expect(Ok, status);
|
||||
status = GdipDeleteRegion(region);
|
||||
expect(Ok, status);
|
||||
|
||||
/* Test with integers that can't be stored as shorts */
|
||||
status = GdipCreatePath(FillModeAlternate, &path);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
GdipAddPathRectangleI(path, -196900, -197400, 199500, 199700);
|
||||
|
||||
status = GdipCreateRegionPath(path, ®ion);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
needed = 0;
|
||||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(72, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(72, needed);
|
||||
expect_dword(buf, 64);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 48);
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 4);
|
||||
/* flags 0 means that a path is an array of FLOATs */
|
||||
expect_dword(buf + 8, 0);
|
||||
expect_float(buf + 9, -196900.0);
|
||||
expect_float(buf + 10, -197400.0);
|
||||
expect_float(buf + 11, 2600.0);
|
||||
expect_float(buf + 12, -197400.0);
|
||||
expect_float(buf + 13, 2600.0);
|
||||
expect_float(buf + 14, 2300.0);
|
||||
expect_float(buf + 15, -196900.0);
|
||||
expect_float(buf + 16, 2300.0);
|
||||
expect_dword(buf + 17, 0x81010100); /* 0x01010100 if we don't close the path */
|
||||
expect_dword(buf + 18, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeletePath(path);
|
||||
expect(Ok, status);
|
||||
status = GdipDeleteRegion(region);
|
||||
expect(Ok, status);
|
||||
|
||||
/* Test beziers */
|
||||
GdipCreatePath(FillModeAlternate, &path);
|
||||
/* Exactly 90 degrees */
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
|
||||
expect(Ok, status);
|
||||
/* Over 90 degrees */
|
||||
status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
|
||||
expect(Ok, status);
|
||||
status = GdipCreateRegionPath(path, ®ion);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
needed = 0;
|
||||
status = GdipGetRegionDataSize(region, &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(136, needed);
|
||||
memset(buf, 0xee, sizeof(buf));
|
||||
needed = 0;
|
||||
status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
expect(136, needed);
|
||||
expect_dword(buf, 128);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 112);
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 11);
|
||||
/* flags 0 means that a path is an array of FLOATs */
|
||||
expect_dword(buf + 8, 0);
|
||||
expect_float(buf + 9, 600.0);
|
||||
expect_float(buf + 10, 450.0);
|
||||
expect_float(buf + 11, 600.0);
|
||||
expect_float(buf + 12, 643.299561);
|
||||
expect_float(buf + 13, 488.071198);
|
||||
expect_float(buf + 14, 800.0);
|
||||
expect_float(buf + 15, 350.0);
|
||||
expect_float(buf + 16, 800.0);
|
||||
expect_float(buf + 17, 600.0);
|
||||
expect_float(buf + 18, 450.0);
|
||||
expect_float(buf + 19, 600.0);
|
||||
expect_float(buf + 20, 643.299622);
|
||||
expect_float(buf + 21, 488.071167);
|
||||
expect_float(buf + 22, 800.0);
|
||||
expect_float(buf + 23, 350.0);
|
||||
expect_float(buf + 24, 800.0);
|
||||
expect_float(buf + 25, 329.807129);
|
||||
expect_float(buf + 26, 800.0);
|
||||
expect_float(buf + 27, 309.688568);
|
||||
expect_float(buf + 28, 796.574890);
|
||||
expect_float(buf + 29, 290.084167);
|
||||
expect_float(buf + 30, 789.799561);
|
||||
expect_dword(buf + 31, 0x03030300);
|
||||
expect_dword(buf + 32, 0x03030301);
|
||||
ok(*(buf + 33) == 0x00030303 /* before win7 */ ||
|
||||
*(buf + 33) == 0x43030303 /* 32-bit win7 */ || *(buf + 33) == 0x4c030303 /* 64-bit win7 */,
|
||||
"expected 0x00030303 or 0x43030303 or 0x4c030303 got %08x\n", *(buf + 33));
|
||||
expect_dword(buf + 34, 0xeeeeeeee);
|
||||
|
||||
status = GdipDeletePath(path);
|
||||
expect(Ok, status);
|
||||
|
@ -640,7 +861,7 @@ static void test_combinereplace(void)
|
|||
expect(36, needed);
|
||||
expect_dword(buf, 28);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_RECT);
|
||||
|
||||
|
@ -660,7 +881,7 @@ static void test_combinereplace(void)
|
|||
expect(156, needed);
|
||||
expect_dword(buf, 148);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
GdipDeletePath(path);
|
||||
|
@ -679,7 +900,7 @@ static void test_combinereplace(void)
|
|||
expect(20, needed);
|
||||
expect_dword(buf, 12);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
|
||||
GdipDeleteRegion(region2);
|
||||
|
@ -706,7 +927,7 @@ static void test_combinereplace(void)
|
|||
expect(180, needed);
|
||||
expect_dword(buf, 172);
|
||||
trace("buf[1] = %08x\n", buf[1]);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 2);
|
||||
expect_dword(buf + 4, CombineModeUnion);
|
||||
|
||||
|
@ -770,11 +991,11 @@ static void test_fromhrgn(void)
|
|||
|
||||
expect(56, needed);
|
||||
expect_dword(buf, 48);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 0x00000020);
|
||||
expect_magic((DWORD*)(buf + 6));
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 0x00000004);
|
||||
todo_wine expect_dword(buf + 8, 0x00006000); /* ?? */
|
||||
|
||||
|
@ -817,11 +1038,11 @@ static void test_fromhrgn(void)
|
|||
expect(Ok, status);
|
||||
expect(216, needed);
|
||||
expect_dword(buf, 208);
|
||||
expect_magic((DWORD*)(buf + 2));
|
||||
expect_magic(buf + 2);
|
||||
expect_dword(buf + 3, 0);
|
||||
expect_dword(buf + 4, RGNDATA_PATH);
|
||||
expect_dword(buf + 5, 0x000000C0);
|
||||
expect_magic((DWORD*)(buf + 6));
|
||||
expect_magic(buf + 6);
|
||||
expect_dword(buf + 7, 0x00000024);
|
||||
todo_wine expect_dword(buf + 8, 0x00006000); /* ?? */
|
||||
}
|
||||
|
@ -861,12 +1082,10 @@ static void test_gethrgn(void)
|
|||
status = GdipGetRegionHRgn(region, NULL, &hrgn);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
ok(hrgn == NULL, "hrgn=%p\n", hrgn);
|
||||
DeleteObject(hrgn);
|
||||
|
||||
status = GdipGetRegionHRgn(region, graphics, &hrgn);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
ok(hrgn == NULL, "hrgn=%p\n", hrgn);
|
||||
DeleteObject(hrgn);
|
||||
|
||||
status = GdipSetEmpty(region);
|
||||
ok(status == Ok, "status %08x\n", status);
|
||||
|
@ -1868,6 +2087,56 @@ static void test_isvisiblerect(void)
|
|||
ReleaseDC(0, hdc);
|
||||
}
|
||||
|
||||
static void test_excludeinfinite(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpRegion *region;
|
||||
UINT count=0xdeadbeef;
|
||||
GpRectF scans[4];
|
||||
GpMatrix *identity;
|
||||
static const RectF rect_exclude = {0.0, 0.0, 1.0, 1.0};
|
||||
|
||||
status = GdipCreateMatrix(&identity);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCreateRegion(®ion);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCombineRegionRect(region, &rect_exclude, CombineModeExclude);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipGetRegionScansCount(region, &count, identity);
|
||||
expect(Ok, status);
|
||||
expect(4, count);
|
||||
|
||||
count = 4;
|
||||
status = GdipGetRegionScans(region, scans, (INT*)&count, identity);
|
||||
expect(Ok, status);
|
||||
|
||||
expectf(-4194304.0, scans[0].X);
|
||||
expectf(-4194304.0, scans[0].Y);
|
||||
expectf(8388608.0, scans[0].Width);
|
||||
expectf(4194304.0, scans[0].Height);
|
||||
|
||||
expectf(-4194304.0, scans[1].X);
|
||||
expectf(0.0, scans[1].Y);
|
||||
expectf(4194304.0, scans[1].Width);
|
||||
expectf(1.0, scans[1].Height);
|
||||
|
||||
expectf(1.0, scans[2].X);
|
||||
expectf(0.0, scans[2].Y);
|
||||
expectf(4194303.0, scans[2].Width);
|
||||
expectf(1.0, scans[2].Height);
|
||||
|
||||
expectf(-4194304.0, scans[3].X);
|
||||
expectf(1.0, scans[3].Y);
|
||||
expectf(8388608.0, scans[3].Width);
|
||||
expectf(4194303.0, scans[3].Height);
|
||||
|
||||
GdipDeleteRegion(region);
|
||||
GdipDeleteMatrix(identity);
|
||||
}
|
||||
|
||||
START_TEST(region)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -1893,6 +2162,7 @@ START_TEST(region)
|
|||
test_getbounds();
|
||||
test_isvisiblepoint();
|
||||
test_isvisiblerect();
|
||||
test_excludeinfinite();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue