2008-06-08 09:47:47 +00:00
|
|
|
/*
|
|
|
|
* Unit test suite for images
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Google (Evan Stade)
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "initguid.h"
|
2008-06-08 09:47:47 +00:00
|
|
|
#include "windows.h"
|
|
|
|
#include "gdiplus.h"
|
|
|
|
#include "wine/test.h"
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
#define expect(expected, got) ok((UINT)(got) == (UINT)(expected), "Expected %.8x, got %.8x\n", (UINT)(expected), (UINT)(got))
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
static BOOL color_match(ARGB c1, ARGB c2, BYTE max_diff)
|
|
|
|
{
|
|
|
|
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
|
|
|
|
c1 >>= 8; c2 >>= 8;
|
|
|
|
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
|
|
|
|
c1 >>= 8; c2 >>= 8;
|
|
|
|
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
|
|
|
|
c1 >>= 8; c2 >>= 8;
|
|
|
|
if (abs((c1 & 0xff) - (c2 & 0xff)) > max_diff) return FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
static void expect_guid(REFGUID expected, REFGUID got, int line, BOOL todo)
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
{
|
|
|
|
WCHAR bufferW[39];
|
|
|
|
char buffer[39];
|
|
|
|
char buffer2[39];
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
StringFromGUID2(got, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer, sizeof(buffer), NULL, NULL);
|
|
|
|
StringFromGUID2(expected, bufferW, sizeof(bufferW)/sizeof(bufferW[0]));
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, bufferW, sizeof(bufferW)/sizeof(bufferW[0]), buffer2, sizeof(buffer2), NULL, NULL);
|
|
|
|
if(todo)
|
2010-01-03 10:54:40 +00:00
|
|
|
todo_wine ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
else
|
2010-01-03 10:54:40 +00:00
|
|
|
ok_(__FILE__, line)(IsEqualGUID(expected, got), "Expected %s, got %s\n", buffer2, buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void expect_rawformat(REFGUID expected, GpImage *img, int line, BOOL todo)
|
|
|
|
{
|
|
|
|
GUID raw;
|
|
|
|
GpStatus stat;
|
|
|
|
|
|
|
|
stat = GdipGetImageRawFormat(img, &raw);
|
|
|
|
ok_(__FILE__, line)(stat == Ok, "GdipGetImageRawFormat failed with %d\n", stat);
|
|
|
|
if(stat != Ok) return;
|
|
|
|
expect_guid(expected, &raw, line, todo);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_bufferrawformat(void* buff, int size, REFGUID expected, int line, BOOL todo)
|
|
|
|
{
|
|
|
|
LPSTREAM stream;
|
|
|
|
HGLOBAL hglob;
|
|
|
|
LPBYTE data;
|
|
|
|
HRESULT hres;
|
|
|
|
GpStatus stat;
|
2010-03-04 13:32:28 +00:00
|
|
|
GpImage *img;
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
|
|
|
|
hglob = GlobalAlloc (0, size);
|
|
|
|
data = GlobalLock (hglob);
|
|
|
|
memcpy(data, buff, size);
|
|
|
|
GlobalUnlock(hglob); data = NULL;
|
|
|
|
|
|
|
|
hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
|
|
|
|
ok_(__FILE__, line)(hres == S_OK, "Failed to create a stream\n");
|
|
|
|
if(hres != S_OK) return;
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
stat = GdipLoadImageFromStream(stream, &img);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
ok_(__FILE__, line)(stat == Ok, "Failed to create a Bitmap\n");
|
|
|
|
if(stat != Ok){
|
|
|
|
IStream_Release(stream);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
expect_rawformat(expected, img, line, todo);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
GdipDisposeImage(img);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
IStream_Release(stream);
|
|
|
|
}
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
static void test_Scan0(void)
|
|
|
|
{
|
|
|
|
GpBitmap *bm;
|
|
|
|
GpStatus stat;
|
|
|
|
BYTE buff[360];
|
|
|
|
|
|
|
|
bm = NULL;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, -10, 10, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
2008-12-06 09:26:52 +00:00
|
|
|
ok( !bm, "expected null bitmap\n" );
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(-10, 10, 10, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
2008-12-06 09:26:52 +00:00
|
|
|
ok( !bm, "expected null bitmap\n" );
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 0, 10, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
2008-12-06 09:26:52 +00:00
|
|
|
ok( !bm, "expected null bitmap\n" );
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
bm = NULL;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 10, 12, PixelFormat24bppRGB, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
|
|
|
|
bm = (GpBitmap*) 0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, buff, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
2008-12-06 09:26:52 +00:00
|
|
|
ok( !bm, "expected null bitmap\n" );
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 10, 0, PixelFormat24bppRGB, buff, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
2008-12-06 09:26:52 +00:00
|
|
|
ok( bm == (GpBitmap*)0xdeadbeef, "expected deadbeef bitmap\n" );
|
|
|
|
|
|
|
|
bm = NULL;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 10, -8, PixelFormat24bppRGB, buff, &bm);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
2008-12-06 09:26:52 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 10, -10, PixelFormat24bppRGB, buff, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
ok( !bm, "expected null bitmap\n" );
|
2008-06-08 09:47:47 +00:00
|
|
|
}
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
static void test_FromGdiDib(void)
|
|
|
|
{
|
|
|
|
GpBitmap *bm;
|
|
|
|
GpStatus stat;
|
|
|
|
BYTE buff[400];
|
|
|
|
BYTE rbmi[sizeof(BITMAPINFOHEADER)+256*sizeof(RGBQUAD)];
|
|
|
|
BITMAPINFO *bmi = (BITMAPINFO*)rbmi;
|
|
|
|
PixelFormat format;
|
|
|
|
|
|
|
|
bm = NULL;
|
|
|
|
|
|
|
|
memset(rbmi, 0, sizeof(rbmi));
|
|
|
|
|
|
|
|
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
|
|
|
bmi->bmiHeader.biWidth = 10;
|
|
|
|
bmi->bmiHeader.biHeight = 10;
|
|
|
|
bmi->bmiHeader.biPlanes = 1;
|
|
|
|
bmi->bmiHeader.biBitCount = 32;
|
|
|
|
bmi->bmiHeader.biCompression = BI_RGB;
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(NULL, buff, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, NULL, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bm, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PixelFormat32bppRGB, format);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bmi->bmiHeader.biBitCount = 24;
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bm, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PixelFormat24bppRGB, format);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bmi->bmiHeader.biBitCount = 16;
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bm, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PixelFormat16bppRGB555, format);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bmi->bmiHeader.biBitCount = 8;
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bm, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PixelFormat8bppIndexed, format);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bmi->bmiHeader.biBitCount = 4;
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bm, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PixelFormat4bppIndexed, format);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bmi->bmiHeader.biBitCount = 1;
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(NULL != bm, "Expected bitmap to be initialized\n");
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bm, &format);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PixelFormat1bppIndexed, format);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
|
|
|
bmi->bmiHeader.biBitCount = 0;
|
|
|
|
stat = GdipCreateBitmapFromGdiDib(bmi, buff, &bm);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
}
|
|
|
|
|
2008-06-08 09:47:47 +00:00
|
|
|
static void test_GetImageDimension(void)
|
|
|
|
{
|
|
|
|
GpBitmap *bm;
|
|
|
|
GpStatus stat;
|
|
|
|
const REAL WIDTH = 10.0, HEIGHT = 20.0;
|
|
|
|
REAL w,h;
|
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
|
|
|
|
expect(Ok,stat);
|
|
|
|
ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n");
|
|
|
|
ok(NULL != bm, "Expected bitmap to not be NULL\n");
|
|
|
|
|
|
|
|
stat = GdipGetImageDimension(NULL,&w,&h);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageDimension((GpImage*)bm,NULL,&h);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageDimension((GpImage*)bm,&w,NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
w = -1;
|
|
|
|
h = -1;
|
|
|
|
stat = GdipGetImageDimension((GpImage*)bm,&w,&h);
|
|
|
|
expect(Ok, stat);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expectf(WIDTH, w);
|
|
|
|
expectf(HEIGHT, h);
|
2008-06-08 09:47:47 +00:00
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
2008-07-09 11:34:20 +00:00
|
|
|
static void test_GdipImageGetFrameDimensionsCount(void)
|
|
|
|
{
|
|
|
|
GpBitmap *bm;
|
|
|
|
GpStatus stat;
|
|
|
|
const REAL WIDTH = 10.0, HEIGHT = 20.0;
|
|
|
|
UINT w;
|
2010-01-03 10:54:40 +00:00
|
|
|
GUID dimension = {0};
|
|
|
|
UINT count;
|
|
|
|
ARGB color;
|
2008-07-09 11:34:20 +00:00
|
|
|
|
|
|
|
bm = (GpBitmap*)0xdeadbeef;
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB,NULL, &bm);
|
|
|
|
expect(Ok,stat);
|
|
|
|
ok((GpBitmap*)0xdeadbeef != bm, "Expected bitmap to not be 0xdeadbeef\n");
|
|
|
|
ok(NULL != bm, "Expected bitmap to not be NULL\n");
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsCount(NULL,&w);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
w = -1;
|
|
|
|
stat = GdipImageGetFrameDimensionsCount((GpImage*)bm,&w);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(1, w);
|
2010-01-03 10:54:40 +00:00
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsList((GpImage*)bm, &dimension, 1);
|
|
|
|
expect(Ok, stat);
|
2010-03-04 13:32:28 +00:00
|
|
|
expect_guid(&FrameDimensionPage, &dimension, __LINE__, FALSE);
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsList((GpImage*)bm, &dimension, 2);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsList((GpImage*)bm, &dimension, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
2010-01-03 10:54:40 +00:00
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
stat = GdipImageGetFrameCount(NULL, &dimension, &count);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* WinXP crashes on this test */
|
|
|
|
if(0)
|
|
|
|
{
|
|
|
|
stat = GdipImageGetFrameCount((GpImage*)bm, &dimension, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameCount((GpImage*)bm, NULL, &count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
count = 12345;
|
|
|
|
stat = GdipImageGetFrameCount((GpImage*)bm, &dimension, &count);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
|
|
|
expect(1, count);
|
2010-01-03 10:54:40 +00:00
|
|
|
|
|
|
|
GdipBitmapSetPixel(bm, 0, 0, 0xffffffff);
|
|
|
|
|
|
|
|
stat = GdipImageSelectActiveFrame((GpImage*)bm, &dimension, 0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* SelectActiveFrame has no effect on image data of memory bitmaps */
|
|
|
|
color = 0xdeadbeef;
|
|
|
|
GdipBitmapGetPixel(bm, 0, 0, &color);
|
|
|
|
expect(0xffffffff, color);
|
|
|
|
|
2008-07-09 11:34:20 +00:00
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
}
|
|
|
|
|
2008-06-08 09:47:47 +00:00
|
|
|
static void test_LoadingImages(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromFile(0, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromFile(0, (GpBitmap**)0xdeadbeef);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipLoadImageFromFile(0, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipLoadImageFromFile(0, (GpImage**)0xdeadbeef);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipLoadImageFromFileICM(0, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipLoadImageFromFileICM(0, (GpImage**)0xdeadbeef);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_SavingImages(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bm;
|
|
|
|
UINT n;
|
|
|
|
UINT s;
|
|
|
|
const REAL WIDTH = 10.0, HEIGHT = 20.0;
|
|
|
|
REAL w, h;
|
|
|
|
ImageCodecInfo *codecs;
|
2009-05-17 07:05:22 +00:00
|
|
|
static const CHAR filenameA[] = "a.bmp";
|
2008-06-08 09:47:47 +00:00
|
|
|
static const WCHAR filename[] = { 'a','.','b','m','p',0 };
|
|
|
|
|
|
|
|
codecs = NULL;
|
|
|
|
|
|
|
|
stat = GdipSaveImageToFile(0, 0, 0, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
bm = NULL;
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
if (!bm)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* invalid params */
|
|
|
|
stat = GdipSaveImageToFile((GpImage*)bm, 0, 0, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSaveImageToFile((GpImage*)bm, filename, 0, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* encoder tests should succeed -- already tested */
|
|
|
|
stat = GdipGetImageEncodersSize(&n, &s);
|
|
|
|
if (stat != Ok || n == 0) goto cleanup;
|
|
|
|
|
|
|
|
codecs = GdipAlloc(s);
|
|
|
|
if (!codecs) goto cleanup;
|
|
|
|
|
|
|
|
stat = GdipGetImageEncoders(n, s, codecs);
|
|
|
|
if (stat != Ok) goto cleanup;
|
|
|
|
|
|
|
|
stat = GdipSaveImageToFile((GpImage*)bm, filename, &codecs[0].Clsid, 0);
|
|
|
|
expect(stat, Ok);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
|
|
|
bm = 0;
|
|
|
|
|
|
|
|
/* re-load and check image stats */
|
|
|
|
stat = GdipLoadImageFromFile(filename, (GpImage**)&bm);
|
|
|
|
expect(stat, Ok);
|
|
|
|
if (stat != Ok) goto cleanup;
|
|
|
|
|
|
|
|
stat = GdipGetImageDimension((GpImage*)bm, &w, &h);
|
|
|
|
if (stat != Ok) goto cleanup;
|
|
|
|
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expectf(WIDTH, w);
|
|
|
|
expectf(HEIGHT, h);
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
cleanup:
|
|
|
|
GdipFree(codecs);
|
|
|
|
if (bm)
|
|
|
|
GdipDisposeImage((GpImage*)bm);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(DeleteFileA(filenameA), "Delete failed.\n");
|
2008-06-08 09:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_encoders(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
UINT n;
|
|
|
|
UINT s;
|
|
|
|
ImageCodecInfo *codecs;
|
|
|
|
int i;
|
|
|
|
int bmp_found;
|
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
static const CHAR bmp_format[] = "BMP";
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
stat = GdipGetImageEncodersSize(&n, &s);
|
|
|
|
expect(stat, Ok);
|
|
|
|
|
|
|
|
codecs = GdipAlloc(s);
|
|
|
|
if (!codecs)
|
|
|
|
return;
|
|
|
|
|
|
|
|
stat = GdipGetImageEncoders(n, s, NULL);
|
|
|
|
expect(GenericError, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageEncoders(0, s, codecs);
|
|
|
|
expect(GenericError, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageEncoders(n, s-1, codecs);
|
|
|
|
expect(GenericError, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageEncoders(n, s+1, codecs);
|
|
|
|
expect(GenericError, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageEncoders(n, s, codecs);
|
|
|
|
expect(stat, Ok);
|
|
|
|
|
|
|
|
bmp_found = FALSE;
|
|
|
|
for (i = 0; i < n; i++)
|
|
|
|
{
|
2009-05-17 07:05:22 +00:00
|
|
|
CHAR desc[32];
|
|
|
|
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, codecs[i].FormatDescription, -1,
|
|
|
|
desc, 32, 0, 0);
|
|
|
|
|
|
|
|
if (CompareStringA(LOCALE_SYSTEM_DEFAULT, 0,
|
|
|
|
desc, -1,
|
2008-06-08 09:47:47 +00:00
|
|
|
bmp_format, -1) == CSTR_EQUAL) {
|
|
|
|
bmp_found = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!bmp_found)
|
|
|
|
ok(FALSE, "No BMP codec found.\n");
|
|
|
|
|
|
|
|
GdipFree(codecs);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_LockBits(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bm;
|
|
|
|
GpRect rect;
|
|
|
|
BitmapData bd;
|
|
|
|
const INT WIDTH = 10, HEIGHT = 20;
|
|
|
|
|
|
|
|
bm = NULL;
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
rect.X = 2;
|
|
|
|
rect.Y = 3;
|
|
|
|
rect.Width = 4;
|
|
|
|
rect.Height = 5;
|
|
|
|
|
|
|
|
/* read-only */
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok) {
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read-only, with NULL rect -> whole bitmap lock */
|
|
|
|
stat = GdipBitmapLockBits(bm, NULL, ImageLockModeRead, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(bd.Width, WIDTH);
|
|
|
|
expect(bd.Height, HEIGHT);
|
|
|
|
|
|
|
|
if (stat == Ok) {
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read-only, consecutive */
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok) {
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* read x2 */
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(WrongState, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* write, no modification */
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok) {
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* write, consecutive */
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok) {
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* write, modify */
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeWrite, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok) {
|
|
|
|
if (bd.Scan0)
|
|
|
|
((char*)bd.Scan0)[2] = 0xff;
|
|
|
|
|
|
|
|
stat = GdipBitmapUnlockBits(bm, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* dispose locked */
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipBitmapLockBits(bm, &rect, ImageLockModeRead, PixelFormat24bppRGB, &bd);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipDisposeImage((GpImage*)bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_GdipCreateBitmapFromHBITMAP(void)
|
|
|
|
{
|
|
|
|
GpBitmap* gpbm = NULL;
|
|
|
|
HBITMAP hbm = NULL;
|
|
|
|
HPALETTE hpal = NULL;
|
|
|
|
GpStatus stat;
|
|
|
|
BYTE buff[1000];
|
|
|
|
LOGPALETTE* LogPal = NULL;
|
|
|
|
REAL width, height;
|
|
|
|
const REAL WIDTH1 = 5;
|
|
|
|
const REAL HEIGHT1 = 15;
|
|
|
|
const REAL WIDTH2 = 10;
|
|
|
|
const REAL HEIGHT2 = 20;
|
|
|
|
HDC hdc;
|
|
|
|
BITMAPINFO bmi;
|
2010-01-03 10:54:40 +00:00
|
|
|
BYTE *bits;
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromHBITMAP(NULL, NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
hbm = CreateBitmap(WIDTH1, HEIGHT1, 1, 1, NULL);
|
|
|
|
stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expectf(WIDTH1, width);
|
|
|
|
expectf(HEIGHT1, height);
|
2008-06-08 09:47:47 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
GdipDisposeImage((GpImage*)gpbm);
|
2009-05-17 07:05:22 +00:00
|
|
|
DeleteObject(hbm);
|
2008-06-08 09:47:47 +00:00
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
memset(buff, 0, sizeof(buff));
|
2008-06-08 09:47:47 +00:00
|
|
|
hbm = CreateBitmap(WIDTH2, HEIGHT2, 1, 1, &buff);
|
|
|
|
stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
|
|
|
|
expect(Ok, stat);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
/* raw format */
|
2010-01-03 10:54:40 +00:00
|
|
|
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)gpbm, __LINE__, FALSE);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
|
2008-06-08 09:47:47 +00:00
|
|
|
expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expectf(WIDTH2, width);
|
|
|
|
expectf(HEIGHT2, height);
|
2008-06-08 09:47:47 +00:00
|
|
|
if (stat == Ok)
|
|
|
|
GdipDisposeImage((GpImage*)gpbm);
|
2009-05-17 07:05:22 +00:00
|
|
|
DeleteObject(hbm);
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
hdc = CreateCompatibleDC(0);
|
|
|
|
ok(hdc != NULL, "CreateCompatibleDC failed\n");
|
|
|
|
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
|
|
|
|
bmi.bmiHeader.biHeight = HEIGHT1;
|
|
|
|
bmi.bmiHeader.biWidth = WIDTH1;
|
|
|
|
bmi.bmiHeader.biBitCount = 24;
|
|
|
|
bmi.bmiHeader.biPlanes = 1;
|
|
|
|
bmi.bmiHeader.biCompression = BI_RGB;
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
hbm = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
|
2008-06-08 09:47:47 +00:00
|
|
|
ok(hbm != NULL, "CreateDIBSection failed\n");
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
bits[0] = 0;
|
|
|
|
|
2008-06-08 09:47:47 +00:00
|
|
|
stat = GdipCreateBitmapFromHBITMAP(hbm, NULL, &gpbm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(Ok, GdipGetImageDimension((GpImage*) gpbm, &width, &height));
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expectf(WIDTH1, width);
|
|
|
|
expectf(HEIGHT1, height);
|
2008-06-08 09:47:47 +00:00
|
|
|
if (stat == Ok)
|
2010-01-03 10:54:40 +00:00
|
|
|
{
|
|
|
|
/* test whether writing to the bitmap affects the original */
|
|
|
|
stat = GdipBitmapSetPixel(gpbm, 0, 0, 0xffffffff);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
expect(0, bits[0]);
|
|
|
|
|
2008-06-08 09:47:47 +00:00
|
|
|
GdipDisposeImage((GpImage*)gpbm);
|
2010-01-03 10:54:40 +00:00
|
|
|
}
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
LogPal = GdipAlloc(sizeof(LOGPALETTE));
|
|
|
|
ok(LogPal != NULL, "unable to allocate LOGPALETTE\n");
|
|
|
|
LogPal->palVersion = 0x300;
|
2010-01-03 10:54:40 +00:00
|
|
|
LogPal->palNumEntries = 1;
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
hpal = CreatePalette(LogPal);
|
2008-06-08 09:47:47 +00:00
|
|
|
ok(hpal != NULL, "CreatePalette failed\n");
|
|
|
|
GdipFree(LogPal);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromHBITMAP(hbm, hpal, &gpbm);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
if (stat == Ok)
|
|
|
|
GdipDisposeImage((GpImage*)gpbm);
|
|
|
|
|
2009-05-17 07:05:22 +00:00
|
|
|
DeleteObject(hpal);
|
|
|
|
DeleteObject(hbm);
|
2008-06-08 09:47:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_GdipGetImageFlags(void)
|
|
|
|
{
|
|
|
|
GpImage *img;
|
|
|
|
GpStatus stat;
|
|
|
|
UINT flags;
|
|
|
|
|
|
|
|
img = (GpImage*)0xdeadbeef;
|
|
|
|
|
|
|
|
stat = GdipGetImageFlags(NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageFlags(NULL, &flags);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageFlags(img, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
}
|
|
|
|
|
2008-07-09 11:34:20 +00:00
|
|
|
static void test_GdipCloneImage(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpRectF rectF;
|
|
|
|
GpUnit unit;
|
|
|
|
GpBitmap *bm;
|
|
|
|
GpImage *image_src, *image_dest = NULL;
|
|
|
|
const INT WIDTH = 10, HEIGHT = 20;
|
|
|
|
|
|
|
|
/* Create an image, clone it, delete the original, make sure the copy works */
|
|
|
|
stat = GdipCreateBitmapFromScan0(WIDTH, HEIGHT, 0, PixelFormat24bppRGB, NULL, &bm);
|
|
|
|
expect(Ok, stat);
|
2010-01-03 10:54:40 +00:00
|
|
|
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bm, __LINE__, FALSE);
|
2008-12-06 09:26:52 +00:00
|
|
|
|
2008-07-09 11:34:20 +00:00
|
|
|
image_src = ((GpImage*)bm);
|
|
|
|
stat = GdipCloneImage(image_src, &image_dest);
|
|
|
|
expect(Ok, stat);
|
2010-01-03 10:54:40 +00:00
|
|
|
expect_rawformat(&ImageFormatMemoryBMP, image_dest, __LINE__, FALSE);
|
2008-12-06 09:26:52 +00:00
|
|
|
|
2008-07-09 11:34:20 +00:00
|
|
|
stat = GdipDisposeImage((GpImage*)bm);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetImageBounds(image_dest, &rectF, &unit);
|
|
|
|
expect(Ok, stat);
|
2008-12-06 09:26:52 +00:00
|
|
|
|
|
|
|
/* Treat FP values carefully */
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
expectf((REAL)WIDTH, rectF.Width);
|
|
|
|
expectf((REAL)HEIGHT, rectF.Height);
|
2008-12-06 09:26:52 +00:00
|
|
|
|
2008-07-09 11:34:20 +00:00
|
|
|
stat = GdipDisposeImage(image_dest);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
2008-12-06 09:26:52 +00:00
|
|
|
|
|
|
|
static void test_testcontrol(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
DWORD param;
|
|
|
|
|
|
|
|
param = 0;
|
|
|
|
stat = GdipTestControl(TestControlGetBuildNumber, ¶m);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(param != 0, "Build number expected, got %u\n", param);
|
2008-07-09 11:34:20 +00:00
|
|
|
}
|
|
|
|
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
static void test_fromhicon(void)
|
|
|
|
{
|
|
|
|
static const BYTE bmp_bits[1024];
|
|
|
|
HBITMAP hbmMask, hbmColor;
|
|
|
|
ICONINFO info;
|
|
|
|
HICON hIcon;
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bitmap = NULL;
|
|
|
|
UINT dim;
|
|
|
|
ImageType type;
|
|
|
|
PixelFormat format;
|
|
|
|
|
|
|
|
/* NULL */
|
|
|
|
stat = GdipCreateBitmapFromHICON(NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
stat = GdipCreateBitmapFromHICON(NULL, &bitmap);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* color icon 1 bit */
|
|
|
|
hbmMask = CreateBitmap(16, 16, 1, 1, bmp_bits);
|
|
|
|
ok(hbmMask != 0, "CreateBitmap failed\n");
|
|
|
|
hbmColor = CreateBitmap(16, 16, 1, 1, bmp_bits);
|
|
|
|
ok(hbmColor != 0, "CreateBitmap failed\n");
|
|
|
|
info.fIcon = TRUE;
|
|
|
|
info.xHotspot = 8;
|
|
|
|
info.yHotspot = 8;
|
|
|
|
info.hbmMask = hbmMask;
|
|
|
|
info.hbmColor = hbmColor;
|
|
|
|
hIcon = CreateIconIndirect(&info);
|
|
|
|
ok(hIcon != 0, "CreateIconIndirect failed\n");
|
|
|
|
DeleteObject(hbmMask);
|
|
|
|
DeleteObject(hbmColor);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromHICON(hIcon, &bitmap);
|
2009-05-17 07:05:22 +00:00
|
|
|
ok(stat == Ok ||
|
|
|
|
broken(stat == InvalidParameter), /* Win98 */
|
|
|
|
"Expected Ok, got %.8x\n", stat);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
if(stat == Ok){
|
|
|
|
/* check attributes */
|
|
|
|
stat = GdipGetImageHeight((GpImage*)bitmap, &dim);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(16, dim);
|
|
|
|
stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(16, dim);
|
|
|
|
stat = GdipGetImageType((GpImage*)bitmap, &type);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(ImageTypeBitmap, type);
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
|
|
|
|
expect(PixelFormat32bppARGB, format);
|
|
|
|
/* raw format */
|
2010-01-03 10:54:40 +00:00
|
|
|
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, FALSE);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
}
|
|
|
|
DestroyIcon(hIcon);
|
|
|
|
|
|
|
|
/* color icon 8 bpp */
|
|
|
|
hbmMask = CreateBitmap(16, 16, 1, 8, bmp_bits);
|
|
|
|
ok(hbmMask != 0, "CreateBitmap failed\n");
|
|
|
|
hbmColor = CreateBitmap(16, 16, 1, 8, bmp_bits);
|
|
|
|
ok(hbmColor != 0, "CreateBitmap failed\n");
|
|
|
|
info.fIcon = TRUE;
|
|
|
|
info.xHotspot = 8;
|
|
|
|
info.yHotspot = 8;
|
|
|
|
info.hbmMask = hbmMask;
|
|
|
|
info.hbmColor = hbmColor;
|
|
|
|
hIcon = CreateIconIndirect(&info);
|
|
|
|
ok(hIcon != 0, "CreateIconIndirect failed\n");
|
|
|
|
DeleteObject(hbmMask);
|
|
|
|
DeleteObject(hbmColor);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromHICON(hIcon, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
if(stat == Ok){
|
|
|
|
/* check attributes */
|
|
|
|
stat = GdipGetImageHeight((GpImage*)bitmap, &dim);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(16, dim);
|
|
|
|
stat = GdipGetImageWidth((GpImage*)bitmap, &dim);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(16, dim);
|
|
|
|
stat = GdipGetImageType((GpImage*)bitmap, &type);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(ImageTypeBitmap, type);
|
|
|
|
stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
|
|
|
|
expect(PixelFormat32bppARGB, format);
|
|
|
|
/* raw format */
|
2010-01-03 10:54:40 +00:00
|
|
|
expect_rawformat(&ImageFormatMemoryBMP, (GpImage*)bitmap, __LINE__, FALSE);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
}
|
|
|
|
DestroyIcon(hIcon);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 1x1 pixel png */
|
|
|
|
static const unsigned char pngimage[285] = {
|
|
|
|
0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a,0x00,0x00,0x00,0x0d,0x49,0x48,0x44,0x52,
|
|
|
|
0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x08,0x02,0x00,0x00,0x00,0x90,0x77,0x53,
|
|
|
|
0xde,0x00,0x00,0x00,0x09,0x70,0x48,0x59,0x73,0x00,0x00,0x0b,0x13,0x00,0x00,0x0b,
|
|
|
|
0x13,0x01,0x00,0x9a,0x9c,0x18,0x00,0x00,0x00,0x07,0x74,0x49,0x4d,0x45,0x07,0xd5,
|
|
|
|
0x06,0x03,0x0f,0x07,0x2d,0x12,0x10,0xf0,0xfd,0x00,0x00,0x00,0x0c,0x49,0x44,0x41,
|
|
|
|
0x54,0x08,0xd7,0x63,0xf8,0xff,0xff,0x3f,0x00,0x05,0xfe,0x02,0xfe,0xdc,0xcc,0x59,
|
|
|
|
0xe7,0x00,0x00,0x00,0x00,0x49,0x45,0x4e,0x44,0xae,0x42,0x60,0x82
|
|
|
|
};
|
|
|
|
/* 1x1 pixel gif */
|
|
|
|
static const unsigned char gifimage[35] = {
|
|
|
|
0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x00,0xff,0xff,0xff,
|
|
|
|
0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
|
|
|
|
0x01,0x00,0x3b
|
|
|
|
};
|
|
|
|
/* 1x1 pixel bmp */
|
|
|
|
static const unsigned char bmpimage[66] = {
|
|
|
|
0x42,0x4d,0x42,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x28,0x00,
|
|
|
|
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x04,0x00,0x00,0x00,0x12,0x0b,0x00,0x00,0x12,0x0b,0x00,0x00,0x02,0x00,
|
|
|
|
0x00,0x00,0x02,0x00,0x00,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0x00,0x00,0x00,
|
|
|
|
0x00,0x00
|
|
|
|
};
|
|
|
|
/* 1x1 pixel jpg */
|
|
|
|
static const unsigned char jpgimage[285] = {
|
|
|
|
0xff,0xd8,0xff,0xe0,0x00,0x10,0x4a,0x46,0x49,0x46,0x00,0x01,0x01,0x01,0x01,0x2c,
|
|
|
|
0x01,0x2c,0x00,0x00,0xff,0xdb,0x00,0x43,0x00,0x05,0x03,0x04,0x04,0x04,0x03,0x05,
|
|
|
|
0x04,0x04,0x04,0x05,0x05,0x05,0x06,0x07,0x0c,0x08,0x07,0x07,0x07,0x07,0x0f,0x0b,
|
|
|
|
0x0b,0x09,0x0c,0x11,0x0f,0x12,0x12,0x11,0x0f,0x11,0x11,0x13,0x16,0x1c,0x17,0x13,
|
|
|
|
0x14,0x1a,0x15,0x11,0x11,0x18,0x21,0x18,0x1a,0x1d,0x1d,0x1f,0x1f,0x1f,0x13,0x17,
|
|
|
|
0x22,0x24,0x22,0x1e,0x24,0x1c,0x1e,0x1f,0x1e,0xff,0xdb,0x00,0x43,0x01,0x05,0x05,
|
|
|
|
0x05,0x07,0x06,0x07,0x0e,0x08,0x08,0x0e,0x1e,0x14,0x11,0x14,0x1e,0x1e,0x1e,0x1e,
|
|
|
|
0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,
|
|
|
|
0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,
|
|
|
|
0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0x1e,0xff,0xc0,
|
|
|
|
0x00,0x11,0x08,0x00,0x01,0x00,0x01,0x03,0x01,0x22,0x00,0x02,0x11,0x01,0x03,0x11,
|
|
|
|
0x01,0xff,0xc4,0x00,0x15,0x00,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0xff,0xc4,0x00,0x14,0x10,0x01,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xc4,
|
|
|
|
0x00,0x14,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0xff,0xc4,0x00,0x14,0x11,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xda,0x00,0x0c,0x03,0x01,
|
|
|
|
0x00,0x02,0x11,0x03,0x11,0x00,0x3f,0x00,0xb2,0xc0,0x07,0xff,0xd9
|
|
|
|
};
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
/* 1x1 pixel tiff */
|
|
|
|
static const unsigned char tiffimage[] = {
|
|
|
|
0x49,0x49,0x2a,0x00,0x0c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0xfe,0x00,
|
|
|
|
0x04,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x00,0x01,0x00,
|
|
|
|
0x00,0x00,0x01,0x00,0x00,0x00,0x01,0x01,0x03,0x00,0x01,0x00,0x00,0x00,0x01,0x00,
|
|
|
|
0x00,0x00,0x02,0x01,0x03,0x00,0x03,0x00,0x00,0x00,0xd2,0x00,0x00,0x00,0x03,0x01,
|
|
|
|
0x03,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x06,0x01,0x03,0x00,0x01,0x00,
|
|
|
|
0x00,0x00,0x02,0x00,0x00,0x00,0x0d,0x01,0x02,0x00,0x1b,0x00,0x00,0x00,0xd8,0x00,
|
|
|
|
0x00,0x00,0x11,0x01,0x04,0x00,0x01,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x12,0x01,
|
|
|
|
0x03,0x00,0x01,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x15,0x01,0x03,0x00,0x01,0x00,
|
|
|
|
0x00,0x00,0x03,0x00,0x00,0x00,0x16,0x01,0x03,0x00,0x01,0x00,0x00,0x00,0x40,0x00,
|
|
|
|
0x00,0x00,0x17,0x01,0x04,0x00,0x01,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x1a,0x01,
|
|
|
|
0x05,0x00,0x01,0x00,0x00,0x00,0xf4,0x00,0x00,0x00,0x1b,0x01,0x05,0x00,0x01,0x00,
|
|
|
|
0x00,0x00,0xfc,0x00,0x00,0x00,0x1c,0x01,0x03,0x00,0x01,0x00,0x00,0x00,0x01,0x00,
|
|
|
|
0x00,0x00,0x28,0x01,0x03,0x00,0x01,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x08,0x00,0x08,0x00,0x08,0x00,0x2f,0x68,0x6f,0x6d,0x65,0x2f,0x6d,0x65,
|
|
|
|
0x68,0x2f,0x44,0x65,0x73,0x6b,0x74,0x6f,0x70,0x2f,0x74,0x65,0x73,0x74,0x2e,0x74,
|
|
|
|
0x69,0x66,0x00,0x00,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x48,
|
|
|
|
0x00,0x00,0x00,0x01
|
|
|
|
};
|
2010-03-04 13:32:28 +00:00
|
|
|
/* 320x320 twip wmf */
|
|
|
|
static const unsigned char wmfimage[180] = {
|
|
|
|
0xd7,0xcd,0xc6,0x9a,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x01,0x40,0x01,0xa0,0x05,
|
|
|
|
0x00,0x00,0x00,0x00,0xb1,0x52,0x01,0x00,0x09,0x00,0x00,0x03,0x4f,0x00,0x00,0x00,
|
|
|
|
0x0f,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x0b,0x02,0x00,0x00,
|
|
|
|
0x00,0x00,0x05,0x00,0x00,0x00,0x0c,0x02,0x40,0x01,0x40,0x01,0x04,0x00,0x00,0x00,
|
|
|
|
0x02,0x01,0x01,0x00,0x04,0x00,0x00,0x00,0x04,0x01,0x0d,0x00,0x08,0x00,0x00,0x00,
|
|
|
|
0xfa,0x02,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,
|
|
|
|
0x2d,0x01,0x00,0x00,0x07,0x00,0x00,0x00,0xfc,0x02,0x01,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0x00,0x00,0x04,0x00,0x00,0x00,0x2d,0x01,0x01,0x00,0x07,0x00,0x00,0x00,0xfc,0x02,
|
|
|
|
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x2d,0x01,0x02,0x00,
|
|
|
|
0x07,0x00,0x00,0x00,0x1b,0x04,0x40,0x01,0x40,0x01,0x00,0x00,0x00,0x00,0x04,0x00,
|
|
|
|
0x00,0x00,0xf0,0x01,0x00,0x00,0x04,0x00,0x00,0x00,0xf0,0x01,0x01,0x00,0x03,0x00,
|
|
|
|
0x00,0x00,0x00,0x00
|
|
|
|
};
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
static void test_getrawformat(void)
|
|
|
|
{
|
2010-01-03 10:54:40 +00:00
|
|
|
test_bufferrawformat((void*)pngimage, sizeof(pngimage), &ImageFormatPNG, __LINE__, FALSE);
|
|
|
|
test_bufferrawformat((void*)gifimage, sizeof(gifimage), &ImageFormatGIF, __LINE__, FALSE);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
test_bufferrawformat((void*)bmpimage, sizeof(bmpimage), &ImageFormatBMP, __LINE__, FALSE);
|
2010-01-03 10:54:40 +00:00
|
|
|
test_bufferrawformat((void*)jpgimage, sizeof(jpgimage), &ImageFormatJPEG, __LINE__, FALSE);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
test_bufferrawformat((void*)tiffimage, sizeof(tiffimage), &ImageFormatTIFF, __LINE__, FALSE);
|
2010-03-04 13:32:28 +00:00
|
|
|
test_bufferrawformat((void*)wmfimage, sizeof(wmfimage), &ImageFormatWMF, __LINE__, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_loadwmf(void)
|
|
|
|
{
|
|
|
|
LPSTREAM stream;
|
|
|
|
HGLOBAL hglob;
|
|
|
|
LPBYTE data;
|
|
|
|
HRESULT hres;
|
|
|
|
GpStatus stat;
|
|
|
|
GpImage *img;
|
|
|
|
GpRectF bounds;
|
|
|
|
GpUnit unit;
|
|
|
|
REAL res = 12345.0;
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
MetafileHeader header;
|
2010-03-04 13:32:28 +00:00
|
|
|
|
|
|
|
hglob = GlobalAlloc (0, sizeof(wmfimage));
|
|
|
|
data = GlobalLock (hglob);
|
|
|
|
memcpy(data, wmfimage, sizeof(wmfimage));
|
|
|
|
GlobalUnlock(hglob); data = NULL;
|
|
|
|
|
|
|
|
hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
|
|
|
|
ok(hres == S_OK, "Failed to create a stream\n");
|
|
|
|
if(hres != S_OK) return;
|
|
|
|
|
|
|
|
stat = GdipLoadImageFromStream(stream, &img);
|
|
|
|
ok(stat == Ok, "Failed to create a Bitmap\n");
|
|
|
|
if(stat != Ok){
|
|
|
|
IStream_Release(stream);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
stat = GdipGetImageBounds(img, &bounds, &unit);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine expect(UnitPixel, unit);
|
|
|
|
expectf(0.0, bounds.X);
|
|
|
|
expectf(0.0, bounds.Y);
|
|
|
|
todo_wine expectf(320.0, bounds.Width);
|
|
|
|
todo_wine expectf(320.0, bounds.Height);
|
|
|
|
|
|
|
|
stat = GdipGetImageHorizontalResolution(img, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine expectf(1440.0, res);
|
|
|
|
|
|
|
|
stat = GdipGetImageVerticalResolution(img, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine expectf(1440.0, res);
|
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
memset(&header, 0, sizeof(header));
|
|
|
|
stat = GdipGetMetafileHeaderFromMetafile((GpMetafile*)img, &header);
|
|
|
|
expect(Ok, stat);
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
todo_wine expect(MetafileTypeWmfPlaceable, header.Type);
|
|
|
|
todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size);
|
|
|
|
todo_wine expect(0x300, header.Version);
|
|
|
|
expect(0, header.EmfPlusFlags);
|
|
|
|
todo_wine expectf(1440.0, header.DpiX);
|
|
|
|
todo_wine expectf(1440.0, header.DpiY);
|
|
|
|
expect(0, header.X);
|
|
|
|
expect(0, header.Y);
|
|
|
|
todo_wine expect(320, header.Width);
|
|
|
|
todo_wine expect(320, header.Height);
|
|
|
|
todo_wine expect(1, U(header).WmfHeader.mtType);
|
|
|
|
expect(0, header.EmfPlusHeaderSize);
|
|
|
|
expect(0, header.LogicalDpiX);
|
|
|
|
expect(0, header.LogicalDpiY);
|
|
|
|
}
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
GdipDisposeImage(img);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_createfromwmf(void)
|
|
|
|
{
|
|
|
|
HMETAFILE hwmf;
|
|
|
|
GpImage *img;
|
|
|
|
GpStatus stat;
|
|
|
|
GpRectF bounds;
|
|
|
|
GpUnit unit;
|
|
|
|
REAL res = 12345.0;
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
MetafileHeader header;
|
2010-03-04 13:32:28 +00:00
|
|
|
|
|
|
|
hwmf = SetMetaFileBitsEx(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader),
|
|
|
|
wmfimage+sizeof(WmfPlaceableFileHeader));
|
|
|
|
ok(hwmf != 0, "SetMetaFileBitsEx failed\n");
|
|
|
|
|
|
|
|
stat = GdipCreateMetafileFromWmf(hwmf, TRUE,
|
|
|
|
(WmfPlaceableFileHeader*)wmfimage, (GpMetafile**)&img);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageBounds(img, &bounds, &unit);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(UnitPixel, unit);
|
2010-03-04 13:32:28 +00:00
|
|
|
expectf(0.0, bounds.X);
|
|
|
|
expectf(0.0, bounds.Y);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expectf(320.0, bounds.Width);
|
|
|
|
expectf(320.0, bounds.Height);
|
2010-03-04 13:32:28 +00:00
|
|
|
|
|
|
|
stat = GdipGetImageHorizontalResolution(img, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(1440.0, res);
|
|
|
|
|
|
|
|
stat = GdipGetImageVerticalResolution(img, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(1440.0, res);
|
|
|
|
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
memset(&header, 0, sizeof(header));
|
|
|
|
stat = GdipGetMetafileHeaderFromMetafile((GpMetafile*)img, &header);
|
|
|
|
expect(Ok, stat);
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
todo_wine expect(MetafileTypeWmfPlaceable, header.Type);
|
|
|
|
todo_wine expect(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader), header.Size);
|
|
|
|
todo_wine expect(0x300, header.Version);
|
|
|
|
expect(0, header.EmfPlusFlags);
|
|
|
|
todo_wine expectf(1440.0, header.DpiX);
|
|
|
|
todo_wine expectf(1440.0, header.DpiY);
|
|
|
|
expect(0, header.X);
|
|
|
|
expect(0, header.Y);
|
|
|
|
todo_wine expect(320, header.Width);
|
|
|
|
todo_wine expect(320, header.Height);
|
|
|
|
todo_wine expect(1, U(header).WmfHeader.mtType);
|
|
|
|
expect(0, header.EmfPlusHeaderSize);
|
|
|
|
expect(0, header.LogicalDpiX);
|
|
|
|
expect(0, header.LogicalDpiY);
|
|
|
|
}
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
GdipDisposeImage(img);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_resolution(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bitmap;
|
|
|
|
REAL res=-1.0;
|
|
|
|
HDC screendc;
|
|
|
|
int screenxres, screenyres;
|
|
|
|
|
|
|
|
/* create Bitmap */
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 32, PixelFormat24bppRGB, NULL, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* test invalid values */
|
|
|
|
stat = GdipGetImageHorizontalResolution(NULL, &res);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageVerticalResolution(NULL, &res);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageVerticalResolution((GpImage*)bitmap, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetResolution(NULL, 96.0, 96.0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetResolution(bitmap, 0.0, 0.0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* defaults to screen resolution */
|
|
|
|
screendc = GetDC(0);
|
|
|
|
|
|
|
|
screenxres = GetDeviceCaps(screendc, LOGPIXELSX);
|
|
|
|
screenyres = GetDeviceCaps(screendc, LOGPIXELSY);
|
|
|
|
|
|
|
|
ReleaseDC(0, screendc);
|
|
|
|
|
|
|
|
stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf((REAL)screenxres, res);
|
|
|
|
|
|
|
|
stat = GdipGetImageVerticalResolution((GpImage*)bitmap, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf((REAL)screenyres, res);
|
|
|
|
|
|
|
|
/* test changing the resolution */
|
|
|
|
stat = GdipBitmapSetResolution(bitmap, screenxres*2.0, screenyres*3.0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(screenxres*2.0, res);
|
|
|
|
|
|
|
|
stat = GdipGetImageVerticalResolution((GpImage*)bitmap, &res);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expectf(screenyres*3.0, res);
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
expect(Ok, stat);
|
2010-01-03 10:54:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_createhbitmap(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bitmap;
|
|
|
|
HBITMAP hbitmap, oldhbitmap;
|
|
|
|
BITMAP bm;
|
|
|
|
int ret;
|
|
|
|
HDC hdc;
|
|
|
|
COLORREF pixel;
|
|
|
|
BYTE bits[640];
|
|
|
|
|
|
|
|
memset(bits, 0x68, 640);
|
|
|
|
|
|
|
|
/* create Bitmap */
|
|
|
|
stat = GdipCreateBitmapFromScan0(10, 20, 32, PixelFormat24bppRGB, bits, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* test NULL values */
|
|
|
|
stat = GdipCreateHBITMAPFromBitmap(NULL, &hbitmap, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateHBITMAPFromBitmap(bitmap, NULL, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* create HBITMAP */
|
|
|
|
stat = GdipCreateHBITMAPFromBitmap(bitmap, &hbitmap, 0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
ret = GetObjectA(hbitmap, sizeof(BITMAP), &bm);
|
|
|
|
expect(sizeof(BITMAP), ret);
|
|
|
|
|
|
|
|
expect(0, bm.bmType);
|
|
|
|
expect(10, bm.bmWidth);
|
|
|
|
expect(20, bm.bmHeight);
|
|
|
|
expect(40, bm.bmWidthBytes);
|
|
|
|
expect(1, bm.bmPlanes);
|
|
|
|
expect(32, bm.bmBitsPixel);
|
|
|
|
ok(bm.bmBits != NULL, "got DDB, expected DIB\n");
|
|
|
|
|
|
|
|
hdc = CreateCompatibleDC(NULL);
|
|
|
|
|
|
|
|
oldhbitmap = SelectObject(hdc, hbitmap);
|
|
|
|
pixel = GetPixel(hdc, 5, 5);
|
|
|
|
SelectObject(hdc, oldhbitmap);
|
|
|
|
|
|
|
|
DeleteDC(hdc);
|
|
|
|
|
|
|
|
expect(0x686868, pixel);
|
|
|
|
|
|
|
|
DeleteObject(hbitmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
static void test_getthumbnail(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpImage *bitmap1, *bitmap2;
|
|
|
|
UINT width, height;
|
|
|
|
|
|
|
|
stat = GdipGetImageThumbnail(NULL, 0, 0, &bitmap2, NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(128, 128, 0, PixelFormat32bppRGB, NULL, (GpBitmap**)&bitmap1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageThumbnail(bitmap1, 0, 0, NULL, NULL, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageThumbnail(bitmap1, 0, 0, &bitmap2, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImageWidth(bitmap2, &width);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(120, width);
|
|
|
|
|
|
|
|
stat = GdipGetImageHeight(bitmap2, &height);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(120, height);
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap1);
|
|
|
|
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(64, 128, 0, PixelFormat32bppRGB, NULL, (GpBitmap**)&bitmap1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageThumbnail(bitmap1, 32, 32, &bitmap2, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImageWidth(bitmap2, &width);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(32, width);
|
|
|
|
|
|
|
|
stat = GdipGetImageHeight(bitmap2, &height);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(32, height);
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap2);
|
|
|
|
}
|
|
|
|
|
|
|
|
stat = GdipGetImageThumbnail(bitmap1, 0, 0, &bitmap2, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipGetImageWidth(bitmap2, &width);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(120, width);
|
|
|
|
|
|
|
|
stat = GdipGetImageHeight(bitmap2, &height);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(120, height);
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap2);
|
|
|
|
}
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap1);
|
|
|
|
}
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
static void test_getsetpixel(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bitmap;
|
|
|
|
ARGB color;
|
|
|
|
BYTE bits[16] = {0x00,0x00,0x00,0x00, 0x00,0xff,0xff,0x00,
|
|
|
|
0xff,0x00,0x00,0x00, 0xff,0xff,0xff,0x00};
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat32bppRGB, bits, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* null parameters */
|
|
|
|
stat = GdipBitmapGetPixel(NULL, 1, 1, &color);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 1, 1, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(NULL, 1, 1, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* out of bounds */
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, -1, 1, &color);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, -1, 1, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 1, -1, &color);
|
|
|
|
ok(stat == InvalidParameter ||
|
|
|
|
broken(stat == Ok), /* Older gdiplus */
|
|
|
|
"Expected InvalidParameter, got %.8x\n", stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 1, -1, 0);
|
|
|
|
ok(stat == InvalidParameter ||
|
|
|
|
broken(stat == Ok), /* Older gdiplus */
|
|
|
|
"Expected InvalidParameter, got %.8x\n", stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 2, 1, &color);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 2, 1, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 1, 2, &color);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 1, 2, 0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
/* valid use */
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 1, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffffffff, color);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff0000ff, color);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 1, 1, 0xff676869);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 0, 0, 0xff474849);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 1, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff676869, color);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff474849, color);
|
|
|
|
|
|
|
|
stat = GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void check_halftone_palette(ColorPalette *palette)
|
|
|
|
{
|
|
|
|
static const BYTE halftone_values[6]={0x00,0x33,0x66,0x99,0xcc,0xff};
|
|
|
|
UINT i;
|
|
|
|
|
|
|
|
for (i=0; i<palette->Count; i++)
|
|
|
|
{
|
|
|
|
ARGB expected=0xff000000;
|
|
|
|
if (i<8)
|
|
|
|
{
|
|
|
|
if (i&1) expected |= 0x800000;
|
|
|
|
if (i&2) expected |= 0x8000;
|
|
|
|
if (i&4) expected |= 0x80;
|
|
|
|
}
|
|
|
|
else if (i == 8)
|
|
|
|
{
|
|
|
|
expected = 0xffc0c0c0;
|
|
|
|
}
|
|
|
|
else if (i < 16)
|
|
|
|
{
|
|
|
|
if (i&1) expected |= 0xff0000;
|
|
|
|
if (i&2) expected |= 0xff00;
|
|
|
|
if (i&4) expected |= 0xff;
|
|
|
|
}
|
|
|
|
else if (i < 40)
|
|
|
|
{
|
|
|
|
expected = 0x00000000;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
expected |= halftone_values[(i-40)%6];
|
|
|
|
expected |= halftone_values[((i-40)/6)%6] << 8;
|
|
|
|
expected |= halftone_values[((i-40)/36)%6] << 16;
|
|
|
|
}
|
|
|
|
ok(expected == palette->Entries[i], "Expected %.8x, got %.8x, i=%u/%u\n",
|
|
|
|
expected, palette->Entries[i], i, palette->Count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_palette(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bitmap;
|
|
|
|
INT size;
|
|
|
|
BYTE buffer[1040];
|
|
|
|
ColorPalette *palette=(ColorPalette*)buffer;
|
2010-03-04 13:32:28 +00:00
|
|
|
ARGB color=0;
|
2010-01-03 10:54:40 +00:00
|
|
|
|
|
|
|
/* test initial palette from non-indexed bitmap */
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat32bppRGB, NULL, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB), size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0, palette->Count);
|
|
|
|
|
|
|
|
/* test setting palette on not-indexed bitmap */
|
|
|
|
palette->Count = 3;
|
|
|
|
|
|
|
|
stat = GdipSetImagePalette((GpImage*)bitmap, palette);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB)*3, size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(3, palette->Count);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
|
|
|
|
/* test initial palette on 1-bit bitmap */
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 4, PixelFormat1bppIndexed, NULL, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB)*2, size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PaletteFlagsGrayScale, palette->Flags);
|
|
|
|
expect(2, palette->Count);
|
|
|
|
|
|
|
|
expect(0xff000000, palette->Entries[0]);
|
|
|
|
expect(0xffffffff, palette->Entries[1]);
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
/* test getting/setting pixels */
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff000000, color);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 0, 1, 0xffffffff);
|
|
|
|
todo_wine ok((stat == Ok) ||
|
|
|
|
broken(stat == InvalidParameter) /* pre-win7 */, "stat=%.8x\n", stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffffffff, color);
|
|
|
|
}
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
|
|
|
|
/* test initial palette on 4-bit bitmap */
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 4, PixelFormat4bppIndexed, NULL, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB)*16, size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0, palette->Flags);
|
|
|
|
expect(16, palette->Count);
|
|
|
|
|
|
|
|
check_halftone_palette(palette);
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
/* test getting/setting pixels */
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff000000, color);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 0, 1, 0xffff00ff);
|
|
|
|
todo_wine ok((stat == Ok) ||
|
|
|
|
broken(stat == InvalidParameter) /* pre-win7 */, "stat=%.8x\n", stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffff00ff, color);
|
|
|
|
}
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
GdipDisposeImage((GpImage*)bitmap);
|
|
|
|
|
|
|
|
/* test initial palette on 8-bit bitmap */
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 8, PixelFormat8bppIndexed, NULL, &bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB)*256, size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PaletteFlagsHalftone, palette->Flags);
|
|
|
|
expect(256, palette->Count);
|
|
|
|
|
|
|
|
check_halftone_palette(palette);
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
/* test getting/setting pixels */
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff000000, color);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap, 0, 1, 0xffcccccc);
|
|
|
|
todo_wine ok((stat == Ok) ||
|
|
|
|
broken(stat == InvalidParameter) /* pre-win7 */, "stat=%.8x\n", stat);
|
|
|
|
|
|
|
|
if (stat == Ok)
|
|
|
|
{
|
|
|
|
stat = GdipBitmapGetPixel(bitmap, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffcccccc, color);
|
|
|
|
}
|
|
|
|
|
2010-01-03 10:54:40 +00:00
|
|
|
/* test setting/getting a different palette */
|
|
|
|
palette->Entries[1] = 0xffcccccc;
|
|
|
|
|
|
|
|
stat = GdipSetImagePalette((GpImage*)bitmap, palette);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
palette->Entries[1] = 0;
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB)*256, size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(PaletteFlagsHalftone, palette->Flags);
|
|
|
|
expect(256, palette->Count);
|
|
|
|
expect(0xffcccccc, palette->Entries[1]);
|
|
|
|
|
|
|
|
/* test count < 256 */
|
|
|
|
palette->Flags = 12345;
|
|
|
|
palette->Count = 3;
|
|
|
|
|
|
|
|
stat = GdipSetImagePalette((GpImage*)bitmap, palette);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
palette->Entries[1] = 0;
|
|
|
|
palette->Entries[3] = 0xdeadbeef;
|
|
|
|
|
|
|
|
stat = GdipGetImagePaletteSize((GpImage*)bitmap, &size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(sizeof(UINT)*2+sizeof(ARGB)*3, size);
|
|
|
|
|
|
|
|
stat = GdipGetImagePalette((GpImage*)bitmap, palette, size);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(12345, palette->Flags);
|
|
|
|
expect(3, palette->Count);
|
|
|
|
expect(0xffcccccc, palette->Entries[1]);
|
|
|
|
expect(0xdeadbeef, palette->Entries[3]);
|
|
|
|
|
|
|
|
/* test count > 256 */
|
|
|
|
palette->Count = 257;
|
|
|
|
|
|
|
|
stat = GdipSetImagePalette((GpImage*)bitmap, palette);
|
|
|
|
ok(stat == InvalidParameter ||
|
|
|
|
broken(stat == Ok), /* Old gdiplus behavior */
|
|
|
|
"Expected %.8x, got %.8x\n", InvalidParameter, stat);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bitmap);
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
}
|
|
|
|
|
2010-03-04 13:32:28 +00:00
|
|
|
static void test_colormatrix(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
ColorMatrix colormatrix, graymatrix;
|
|
|
|
GpImageAttributes *imageattr;
|
|
|
|
const ColorMatrix identity = {{
|
|
|
|
{1.0,0.0,0.0,0.0,0.0},
|
|
|
|
{0.0,1.0,0.0,0.0,0.0},
|
|
|
|
{0.0,0.0,1.0,0.0,0.0},
|
|
|
|
{0.0,0.0,0.0,1.0,0.0},
|
|
|
|
{0.0,0.0,0.0,0.0,1.0}}};
|
|
|
|
const ColorMatrix double_red = {{
|
|
|
|
{2.0,0.0,0.0,0.0,0.0},
|
|
|
|
{0.0,1.0,0.0,0.0,0.0},
|
|
|
|
{0.0,0.0,1.0,0.0,0.0},
|
|
|
|
{0.0,0.0,0.0,1.0,0.0},
|
|
|
|
{0.0,0.0,0.0,0.0,1.0}}};
|
|
|
|
GpBitmap *bitmap1, *bitmap2;
|
|
|
|
GpGraphics *graphics;
|
|
|
|
ARGB color;
|
|
|
|
|
|
|
|
colormatrix = identity;
|
|
|
|
graymatrix = identity;
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(NULL, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateImageAttributes(&imageattr);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, NULL, NULL, ColorMatrixFlagsDefault);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsSkipGrays);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsAltGray);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsAltGray);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, &graymatrix, 3);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeCount,
|
|
|
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeAny,
|
|
|
|
TRUE, &colormatrix, &graymatrix, ColorMatrixFlagsDefault);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
FALSE, NULL, NULL, ColorMatrixFlagsDefault);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* Drawing a bitmap transforms the colors */
|
|
|
|
colormatrix = double_red;
|
|
|
|
stat = GdipSetImageAttributesColorMatrix(imageattr, ColorAdjustTypeDefault,
|
|
|
|
TRUE, &colormatrix, NULL, ColorMatrixFlagsDefault);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0xff40ffff);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageGraphicsContext((GpImage*)bitmap2, &graphics);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
|
|
|
|
UnitPixel, imageattr, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine expect(0xff80ffff, color);
|
|
|
|
|
|
|
|
GdipDeleteGraphics(graphics);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap1);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap2);
|
|
|
|
GdipDisposeImageAttributes(imageattr);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_gamma(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpImageAttributes *imageattr;
|
|
|
|
GpBitmap *bitmap1, *bitmap2;
|
|
|
|
GpGraphics *graphics;
|
|
|
|
ARGB color;
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(NULL, ColorAdjustTypeDefault, TRUE, 1.0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateImageAttributes(&imageattr);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeDefault, TRUE, 1.0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeAny, TRUE, 1.0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeDefault, TRUE, -1.0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeDefault, TRUE, 0.0);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeDefault, TRUE, 0.5);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeDefault, FALSE, 0.0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* Drawing a bitmap transforms the colors */
|
|
|
|
stat = GdipSetImageAttributesGamma(imageattr, ColorAdjustTypeDefault, TRUE, 3.0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0xff80ffff);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageGraphicsContext((GpImage*)bitmap2, &graphics);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
|
|
|
|
UnitPixel, imageattr, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine ok(color_match(0xff20ffff, color, 1), "Expected ff20ffff, got %.8x\n", color);
|
|
|
|
|
|
|
|
GdipDeleteGraphics(graphics);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap1);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap2);
|
|
|
|
GdipDisposeImageAttributes(imageattr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 1x1 pixel gif, 2 frames; first frame is white, second is black */
|
|
|
|
static const unsigned char gifanimation[72] = {
|
|
|
|
0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00,0xa1,0x00,0x00,0x00,0x00,0x00,
|
|
|
|
0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x21,0xf9,0x04,0x00,0x0a,0x00,0xff,
|
|
|
|
0x00,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x4c,0x01,0x00,
|
|
|
|
0x21,0xf9,0x04,0x01,0x0a,0x00,0x01,0x00,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,
|
|
|
|
0x00,0x00,0x02,0x02,0x44,0x01,0x00,0x3b
|
|
|
|
};
|
|
|
|
|
|
|
|
static void test_multiframegif(void)
|
|
|
|
{
|
|
|
|
LPSTREAM stream;
|
|
|
|
HGLOBAL hglob;
|
|
|
|
LPBYTE data;
|
|
|
|
HRESULT hres;
|
|
|
|
GpStatus stat;
|
|
|
|
GpBitmap *bmp;
|
|
|
|
ARGB color;
|
|
|
|
UINT count;
|
|
|
|
GUID dimension;
|
|
|
|
|
|
|
|
/* Test frame functions with an animated GIF */
|
|
|
|
hglob = GlobalAlloc (0, sizeof(gifanimation));
|
|
|
|
data = GlobalLock (hglob);
|
|
|
|
memcpy(data, gifanimation, sizeof(gifanimation));
|
|
|
|
GlobalUnlock(hglob);
|
|
|
|
|
|
|
|
hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
|
|
|
|
ok(hres == S_OK, "Failed to create a stream\n");
|
|
|
|
if(hres != S_OK) return;
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromStream(stream, &bmp);
|
|
|
|
ok(stat == Ok, "Failed to create a Bitmap\n");
|
|
|
|
if(stat != Ok){
|
|
|
|
IStream_Release(stream);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Bitmap starts at frame 0 */
|
|
|
|
color = 0xdeadbeef;
|
|
|
|
stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffffffff, color);
|
|
|
|
|
|
|
|
/* Check that we get correct metadata */
|
|
|
|
stat = GdipImageGetFrameDimensionsCount((GpImage*)bmp,&count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(1, count);
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsList((GpImage*)bmp, &dimension, 1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect_guid(&FrameDimensionTime, &dimension, __LINE__, FALSE);
|
|
|
|
|
|
|
|
count = 12345;
|
|
|
|
stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
2010-03-04 13:32:28 +00:00
|
|
|
todo_wine expect(2, count);
|
|
|
|
|
|
|
|
/* SelectActiveFrame overwrites our current data */
|
|
|
|
stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
color = 0xdeadbeef;
|
|
|
|
GdipBitmapGetPixel(bmp, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine expect(0xff000000, color);
|
|
|
|
|
|
|
|
stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
color = 0xdeadbeef;
|
|
|
|
GdipBitmapGetPixel(bmp, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffffffff, color);
|
|
|
|
|
|
|
|
/* Write over the image data */
|
|
|
|
stat = GdipBitmapSetPixel(bmp, 0, 0, 0xff000000);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
/* Switching to the same frame does not overwrite our changes */
|
|
|
|
stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff000000, color);
|
|
|
|
|
|
|
|
/* But switching to another frame and back does */
|
|
|
|
stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 0);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
todo_wine expect(0xffffffff, color);
|
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bmp);
|
|
|
|
IStream_Release(stream);
|
|
|
|
|
|
|
|
/* Test with a non-animated gif */
|
|
|
|
hglob = GlobalAlloc (0, sizeof(gifimage));
|
|
|
|
data = GlobalLock (hglob);
|
|
|
|
memcpy(data, gifimage, sizeof(gifimage));
|
|
|
|
GlobalUnlock(hglob);
|
|
|
|
|
|
|
|
hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
|
|
|
|
ok(hres == S_OK, "Failed to create a stream\n");
|
|
|
|
if(hres != S_OK) return;
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromStream(stream, &bmp);
|
|
|
|
ok(stat == Ok, "Failed to create a Bitmap\n");
|
|
|
|
if(stat != Ok){
|
|
|
|
IStream_Release(stream);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check metadata */
|
|
|
|
stat = GdipImageGetFrameDimensionsCount((GpImage*)bmp,&count);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(1, count);
|
|
|
|
|
|
|
|
stat = GdipImageGetFrameDimensionsList((GpImage*)bmp, &dimension, 1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect_guid(&FrameDimensionTime, &dimension, __LINE__, FALSE);
|
|
|
|
|
|
|
|
count = 12345;
|
|
|
|
stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
|
|
|
expect(1, count);
|
2010-03-04 13:32:28 +00:00
|
|
|
|
|
|
|
GdipDisposeImage((GpImage*)bmp);
|
|
|
|
IStream_Release(stream);
|
|
|
|
}
|
|
|
|
|
2010-03-06 16:24:37 +00:00
|
|
|
static void test_rotateflip(void)
|
|
|
|
{
|
|
|
|
GpImage *bitmap;
|
|
|
|
GpStatus stat;
|
|
|
|
BYTE bits[24];
|
|
|
|
static const BYTE orig_bits[24] = {
|
|
|
|
0,0,0xff, 0,0xff,0, 0xff,0,0, 23,23,23,
|
|
|
|
0xff,0xff,0, 0xff,0,0xff, 0,0xff,0xff, 23,23,23};
|
|
|
|
UINT width, height;
|
|
|
|
ARGB color;
|
|
|
|
|
|
|
|
memcpy(bits, orig_bits, sizeof(bits));
|
|
|
|
stat = GdipCreateBitmapFromScan0(3, 2, 12, PixelFormat24bppRGB, bits, (GpBitmap**)&bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipImageRotateFlip(bitmap, Rotate90FlipNone);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipGetImageWidth(bitmap, &width);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetImageHeight(bitmap, &height);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(2, width);
|
|
|
|
expect(3, height);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xff00ffff, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 1, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xffff0000, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 2, &color);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xffffff00, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 1, 2, &color);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
|
|
|
expect(0xff0000ff, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
expect(0, bits[0]);
|
|
|
|
expect(0, bits[1]);
|
|
|
|
expect(0xff, bits[2]);
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap);
|
|
|
|
|
|
|
|
memcpy(bits, orig_bits, sizeof(bits));
|
|
|
|
stat = GdipCreateBitmapFromScan0(3, 2, 12, PixelFormat24bppRGB, bits, (GpBitmap**)&bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipImageRotateFlip(bitmap, RotateNoneFlipX);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipGetImageWidth(bitmap, &width);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetImageHeight(bitmap, &height);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(3, width);
|
|
|
|
expect(2, height);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xff0000ff, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xffff0000, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xffffff00, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 1, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xff00ffff, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
expect(0, bits[0]);
|
|
|
|
expect(0, bits[1]);
|
|
|
|
expect(0xff, bits[2]);
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap);
|
|
|
|
|
|
|
|
memcpy(bits, orig_bits, sizeof(bits));
|
|
|
|
stat = GdipCreateBitmapFromScan0(3, 2, 12, PixelFormat24bppRGB, bits, (GpBitmap**)&bitmap);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipImageRotateFlip(bitmap, RotateNoneFlipY);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(Ok, stat);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipGetImageWidth(bitmap, &width);
|
|
|
|
expect(Ok, stat);
|
|
|
|
stat = GdipGetImageHeight(bitmap, &height);
|
|
|
|
expect(Ok, stat);
|
|
|
|
expect(3, width);
|
|
|
|
expect(2, height);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xff00ffff, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xffffff00, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xffff0000, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 1, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
expect(0xff0000ff, color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
expect(0, bits[0]);
|
|
|
|
expect(0, bits[1]);
|
|
|
|
expect(0xff, bits[2]);
|
|
|
|
|
|
|
|
GdipDisposeImage(bitmap);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_remaptable(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpImageAttributes *imageattr;
|
|
|
|
GpBitmap *bitmap1, *bitmap2;
|
|
|
|
GpGraphics *graphics;
|
|
|
|
ARGB color;
|
|
|
|
ColorMap *map;
|
|
|
|
|
|
|
|
map = GdipAlloc(sizeof(ColorMap));
|
|
|
|
|
|
|
|
map->oldColor.Argb = 0xff00ff00;
|
|
|
|
map->newColor.Argb = 0xffff00ff;
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(NULL, ColorAdjustTypeDefault, TRUE, 1, map);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateImageAttributes(&imageattr);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, NULL);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeCount, TRUE, 1, map);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeAny, TRUE, 1, map);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 0, map);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, FALSE, 0, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesRemapTable(imageattr, ColorAdjustTypeDefault, TRUE, 1, map);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat32bppRGB, NULL, &bitmap2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0xff00ff00);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageGraphicsContext((GpImage*)bitmap2, &graphics);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,1,1, 0,0,1,1,
|
|
|
|
UnitPixel, imageattr, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests.
svn path=/trunk/; revision=46982
2010-04-21 20:35:09 +00:00
|
|
|
ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
2010-03-06 16:24:37 +00:00
|
|
|
|
|
|
|
GdipDeleteGraphics(graphics);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap1);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap2);
|
|
|
|
GdipDisposeImageAttributes(imageattr);
|
|
|
|
GdipFree(map);
|
|
|
|
}
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
static void test_colorkey(void)
|
|
|
|
{
|
|
|
|
GpStatus stat;
|
|
|
|
GpImageAttributes *imageattr;
|
|
|
|
GpBitmap *bitmap1, *bitmap2;
|
|
|
|
GpGraphics *graphics;
|
|
|
|
ARGB color;
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorKeys(NULL, ColorAdjustTypeDefault, TRUE, 0xff405060, 0xff708090);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateImageAttributes(&imageattr);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorKeys(imageattr, ColorAdjustTypeCount, TRUE, 0xff405060, 0xff708090);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorKeys(imageattr, ColorAdjustTypeAny, TRUE, 0xff405060, 0xff708090);
|
|
|
|
expect(InvalidParameter, stat);
|
|
|
|
|
|
|
|
stat = GdipSetImageAttributesColorKeys(imageattr, ColorAdjustTypeDefault, TRUE, 0xff405060, 0xff708090);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 0, PixelFormat32bppARGB, NULL, &bitmap1);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipCreateBitmapFromScan0(2, 2, 0, PixelFormat32bppARGB, NULL, &bitmap2);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 0, 0, 0x20405060);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 0, 1, 0x40506070);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 1, 0, 0x60708090);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapSetPixel(bitmap1, 1, 1, 0xffffffff);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipGetImageGraphicsContext((GpImage*)bitmap2, &graphics);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipDrawImageRectRectI(graphics, (GpImage*)bitmap1, 0,0,2,2, 0,0,2,2,
|
|
|
|
UnitPixel, imageattr, NULL, NULL);
|
|
|
|
expect(Ok, stat);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(color_match(0x00000000, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 0, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(color_match(0x00000000, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 1, 0, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(color_match(0x00000000, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
|
|
|
|
|
|
|
stat = GdipBitmapGetPixel(bitmap2, 1, 1, &color);
|
|
|
|
expect(Ok, stat);
|
|
|
|
ok(color_match(0xffffffff, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
|
|
|
|
|
|
|
GdipDeleteGraphics(graphics);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap1);
|
|
|
|
GdipDisposeImage((GpImage*)bitmap2);
|
|
|
|
GdipDisposeImageAttributes(imageattr);
|
|
|
|
}
|
|
|
|
|
2008-06-08 09:47:47 +00:00
|
|
|
START_TEST(image)
|
|
|
|
{
|
|
|
|
struct GdiplusStartupInput gdiplusStartupInput;
|
|
|
|
ULONG_PTR gdiplusToken;
|
|
|
|
|
|
|
|
gdiplusStartupInput.GdiplusVersion = 1;
|
|
|
|
gdiplusStartupInput.DebugEventCallback = NULL;
|
|
|
|
gdiplusStartupInput.SuppressBackgroundThread = 0;
|
|
|
|
gdiplusStartupInput.SuppressExternalCodecs = 0;
|
|
|
|
|
|
|
|
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
|
|
|
|
|
|
|
|
test_Scan0();
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
test_FromGdiDib();
|
2008-06-08 09:47:47 +00:00
|
|
|
test_GetImageDimension();
|
2008-07-09 11:34:20 +00:00
|
|
|
test_GdipImageGetFrameDimensionsCount();
|
2008-06-08 09:47:47 +00:00
|
|
|
test_LoadingImages();
|
|
|
|
test_SavingImages();
|
|
|
|
test_encoders();
|
|
|
|
test_LockBits();
|
|
|
|
test_GdipCreateBitmapFromHBITMAP();
|
|
|
|
test_GdipGetImageFlags();
|
2008-07-09 11:34:20 +00:00
|
|
|
test_GdipCloneImage();
|
2008-12-06 09:26:52 +00:00
|
|
|
test_testcontrol();
|
- Sync winetests with Wine head (comcat, crypt32, gdiplus, lz32, mapi32, mlang, msacm32, mshtml, msvcrt, netapi32, riched20, riched32, rsaenh, schannel, setupapi, shdocvw, urlmon, user32, usp10, uxtheme, version, winhttp, wininet, wintrust, ws2_32)
svn path=/trunk/; revision=39773
2009-02-26 13:26:26 +00:00
|
|
|
test_fromhicon();
|
|
|
|
test_getrawformat();
|
2010-03-04 13:32:28 +00:00
|
|
|
test_loadwmf();
|
|
|
|
test_createfromwmf();
|
|
|
|
test_resolution();
|
2010-01-03 10:54:40 +00:00
|
|
|
test_createhbitmap();
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
test_getthumbnail();
|
2010-01-03 10:54:40 +00:00
|
|
|
test_getsetpixel();
|
|
|
|
test_palette();
|
2010-03-04 13:32:28 +00:00
|
|
|
test_colormatrix();
|
|
|
|
test_gamma();
|
|
|
|
test_multiframegif();
|
2010-03-06 16:24:37 +00:00
|
|
|
test_rotateflip();
|
|
|
|
test_remaptable();
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
test_colorkey();
|
2008-06-08 09:47:47 +00:00
|
|
|
|
|
|
|
GdiplusShutdown(gdiplusToken);
|
|
|
|
}
|