mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 12:23:30 +00:00
[WINESYNC]
- Sync comdlg32, crypt32, gdiplus, inetcomm, jscript, msctf, mshtml, msxml3, rsaenh, schannel, shlwapi, urlmon, usp10, wininet winetests. svn path=/trunk/; revision=46982
This commit is contained in:
@@ -646,6 +646,61 @@ static void test_linelinearblend(void)
|
||||
expect(Ok, status);
|
||||
}
|
||||
|
||||
static void test_gradientsurroundcolorcount(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpPathGradient *grad;
|
||||
ARGB *color;
|
||||
INT count = 3;
|
||||
|
||||
status = GdipCreatePathGradient(blendcount_ptf, 2, WrapModeClamp, &grad);
|
||||
expect(Ok, status);
|
||||
|
||||
color = GdipAlloc(sizeof(ARGB[3]));
|
||||
|
||||
status = GdipSetPathGradientSurroundColorsWithCount(grad, color, &count);
|
||||
expect(InvalidParameter, status);
|
||||
GdipFree(color);
|
||||
|
||||
count = 2;
|
||||
|
||||
color = GdipAlloc(sizeof(ARGB[2]));
|
||||
|
||||
color[0] = 0x00ff0000;
|
||||
color[1] = 0x0000ff00;
|
||||
|
||||
status = GdipSetPathGradientSurroundColorsWithCount(NULL, color, &count);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipSetPathGradientSurroundColorsWithCount(grad, NULL, &count);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
/* WinXP crashes on this test */
|
||||
if(0)
|
||||
{
|
||||
status = GdipSetPathGradientSurroundColorsWithCount(grad, color, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
}
|
||||
|
||||
status = GdipSetPathGradientSurroundColorsWithCount(grad, color, &count);
|
||||
todo_wine expect(Ok, status);
|
||||
expect(2, count);
|
||||
|
||||
status = GdipGetPathGradientSurroundColorCount(NULL, &count);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipGetPathGradientSurroundColorCount(grad, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
count = 0;
|
||||
status = GdipGetPathGradientSurroundColorCount(grad, &count);
|
||||
todo_wine expect(Ok, status);
|
||||
todo_wine expect(2, count);
|
||||
|
||||
GdipFree(color);
|
||||
GdipDeleteBrush((GpBrush*)grad);
|
||||
}
|
||||
|
||||
START_TEST(brush)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
@@ -669,6 +724,7 @@ START_TEST(brush)
|
||||
test_gradientgetrect();
|
||||
test_lineblend();
|
||||
test_linelinearblend();
|
||||
test_gradientsurroundcolorcount();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
||||
@@ -18,11 +18,14 @@
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "windows.h"
|
||||
#include "gdiplus.h"
|
||||
#include "wine/test.h"
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
||||
|
||||
static const WCHAR arial[] = {'A','r','i','a','l','\0'};
|
||||
static const WCHAR nonexistent[] = {'T','h','i','s','F','o','n','t','s','h','o','u','l','d','N','o','t','E','x','i','s','t','\0'};
|
||||
@@ -189,12 +192,9 @@ static void test_fontfamily (void)
|
||||
expect (FontFamilyNotFound, stat);
|
||||
|
||||
/* Bitmap fonts are not found */
|
||||
todo_wine
|
||||
{
|
||||
stat = GdipCreateFontFamilyFromName (MSSansSerif, NULL, &family);
|
||||
expect (FontFamilyNotFound, stat);
|
||||
if(stat == Ok) GdipDeleteFontFamily(family);
|
||||
}
|
||||
|
||||
stat = GdipCreateFontFamilyFromName (arial, NULL, &family);
|
||||
if(stat == FontFamilyNotFound)
|
||||
@@ -345,6 +345,78 @@ static void test_installedfonts (void)
|
||||
ok (collection != NULL, "got NULL font collection\n");
|
||||
}
|
||||
|
||||
static void test_heightgivendpi(void)
|
||||
{
|
||||
GpStatus stat;
|
||||
GpFont* font = NULL;
|
||||
GpFontFamily* fontfamily = NULL;
|
||||
REAL height;
|
||||
|
||||
stat = GdipCreateFontFamilyFromName(arial, NULL, &fontfamily);
|
||||
if(stat == FontFamilyNotFound)
|
||||
{
|
||||
skip("Arial not installed\n");
|
||||
return;
|
||||
}
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPixel, &font);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetFontHeightGivenDPI(NULL, 96, &height);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, &height);
|
||||
expect(Ok, stat);
|
||||
expectf((REAL)34.497070, height);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
height = 12345;
|
||||
stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitWorld, &font);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, &height);
|
||||
expect(Ok, stat);
|
||||
expectf((REAL)34.497070, height);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
height = 12345;
|
||||
stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitPoint, &font);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, &height);
|
||||
expect(Ok, stat);
|
||||
expectf((REAL)45.996094, height);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
height = 12345;
|
||||
stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitInch, &font);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, &height);
|
||||
expect(Ok, stat);
|
||||
expectf((REAL)3311.718750, height);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
height = 12345;
|
||||
stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitDocument, &font);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, &height);
|
||||
expect(Ok, stat);
|
||||
expectf((REAL)11.039062, height);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
height = 12345;
|
||||
stat = GdipCreateFont(fontfamily, 30, FontStyleRegular, UnitMillimeter, &font);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetFontHeightGivenDPI(font, 96, &height);
|
||||
expect(Ok, stat);
|
||||
expectf((REAL)130.382614, height);
|
||||
GdipDeleteFont(font);
|
||||
|
||||
GdipDeleteFontFamily(fontfamily);
|
||||
}
|
||||
|
||||
START_TEST(font)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
@@ -363,6 +435,7 @@ START_TEST(font)
|
||||
test_fontfamily_properties();
|
||||
test_getgenerics();
|
||||
test_installedfonts();
|
||||
test_heightgivendpi();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
||||
@@ -25,14 +25,17 @@
|
||||
#include <math.h>
|
||||
|
||||
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
|
||||
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)
|
||||
#define expectf_(expected, got, precision) ok(fabs(expected - got) < precision, "Expected %.2f, got %.2f\n", expected, got)
|
||||
#define expectf(expected, got) expectf_(expected, got, 0.0001)
|
||||
#define TABLE_LEN (23)
|
||||
|
||||
static HWND hwnd;
|
||||
|
||||
static void test_constructor_destructor(void)
|
||||
{
|
||||
GpStatus stat;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
stat = GdipCreateFromHDC(NULL, &graphics);
|
||||
expect(OutOfMemory, stat);
|
||||
@@ -56,7 +59,7 @@ static void test_constructor_destructor(void)
|
||||
|
||||
stat = GdipDeleteGraphics(NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
typedef struct node{
|
||||
@@ -115,7 +118,7 @@ static void test_save_restore(void)
|
||||
InterpolationMode mode;
|
||||
GpGraphics *graphics1, *graphics2;
|
||||
node * state_log = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
state_a = state_b = state_c = 0xdeadbeef;
|
||||
|
||||
/* Invalid saving. */
|
||||
@@ -224,7 +227,7 @@ static void test_save_restore(void)
|
||||
todo_wine
|
||||
check_no_duplicates(state_log);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawArc(void)
|
||||
@@ -232,7 +235,7 @@ static void test_GdipDrawArc(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
/* make a graphics object and pen object */
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
@@ -268,7 +271,7 @@ static void test_GdipDrawArc(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawArcI(void)
|
||||
@@ -276,7 +279,7 @@ static void test_GdipDrawArcI(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
/* make a graphics object and pen object */
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
@@ -312,7 +315,7 @@ static void test_GdipDrawArcI(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_BeginContainer2(void)
|
||||
@@ -334,7 +337,7 @@ static void test_BeginContainer2(void)
|
||||
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
|
||||
@@ -497,7 +500,7 @@ static void test_BeginContainer2(void)
|
||||
expect(Ok, status);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawBezierI(void)
|
||||
@@ -505,7 +508,7 @@ static void test_GdipDrawBezierI(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
/* make a graphics object and pen object */
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
@@ -535,7 +538,7 @@ static void test_GdipDrawBezierI(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawCurve3(void)
|
||||
@@ -543,7 +546,7 @@ static void test_GdipDrawCurve3(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPointF points[3];
|
||||
|
||||
points[0].X = 0;
|
||||
@@ -615,7 +618,7 @@ static void test_GdipDrawCurve3(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawCurve3I(void)
|
||||
@@ -623,7 +626,7 @@ static void test_GdipDrawCurve3I(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPoint points[3];
|
||||
|
||||
points[0].X = 0;
|
||||
@@ -695,7 +698,7 @@ static void test_GdipDrawCurve3I(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawCurve2(void)
|
||||
@@ -703,7 +706,7 @@ static void test_GdipDrawCurve2(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPointF points[3];
|
||||
|
||||
points[0].X = 0;
|
||||
@@ -762,7 +765,7 @@ static void test_GdipDrawCurve2(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawCurve2I(void)
|
||||
@@ -770,7 +773,7 @@ static void test_GdipDrawCurve2I(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPoint points[3];
|
||||
|
||||
points[0].X = 0;
|
||||
@@ -829,7 +832,7 @@ static void test_GdipDrawCurve2I(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawCurve(void)
|
||||
@@ -837,7 +840,7 @@ static void test_GdipDrawCurve(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPointF points[3];
|
||||
|
||||
points[0].X = 0;
|
||||
@@ -890,7 +893,7 @@ static void test_GdipDrawCurve(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawCurveI(void)
|
||||
@@ -898,7 +901,7 @@ static void test_GdipDrawCurveI(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPoint points[3];
|
||||
|
||||
points[0].X = 0;
|
||||
@@ -951,7 +954,7 @@ static void test_GdipDrawCurveI(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawLineI(void)
|
||||
@@ -959,7 +962,7 @@ static void test_GdipDrawLineI(void)
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
/* make a graphics object and pen object */
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
@@ -989,7 +992,7 @@ static void test_GdipDrawLineI(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawLinesI(void)
|
||||
@@ -998,7 +1001,7 @@ static void test_GdipDrawLinesI(void)
|
||||
GpGraphics *graphics = NULL;
|
||||
GpPen *pen = NULL;
|
||||
GpPoint *ptf = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
/* make a graphics object and pen object */
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
@@ -1041,7 +1044,7 @@ static void test_GdipDrawLinesI(void)
|
||||
GdipDeletePen(pen);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_Get_Release_DC(void)
|
||||
@@ -1051,7 +1054,7 @@ static void test_Get_Release_DC(void)
|
||||
GpPen *pen;
|
||||
GpSolidFill *brush;
|
||||
GpPath *path;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
HDC retdc;
|
||||
REAL r;
|
||||
CompositingQuality quality;
|
||||
@@ -1345,14 +1348,14 @@ static void test_Get_Release_DC(void)
|
||||
GdipDeleteMatrix(m);
|
||||
DeleteObject(hrgn);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_transformpoints(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpPointF ptf[2];
|
||||
GpPoint pt[2];
|
||||
|
||||
@@ -1465,14 +1468,14 @@ static void test_transformpoints(void)
|
||||
expect(18, pt[1].Y);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_get_set_clip(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpRegion *clip;
|
||||
GpRectF rect;
|
||||
BOOL res;
|
||||
@@ -1544,14 +1547,14 @@ static void test_get_set_clip(void)
|
||||
GdipDeleteRegion(clip);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_isempty(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpRegion *clip;
|
||||
BOOL res;
|
||||
|
||||
@@ -1578,7 +1581,7 @@ static void test_isempty(void)
|
||||
GdipDeleteRegion(clip);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_clear(void)
|
||||
@@ -1592,7 +1595,7 @@ static void test_clear(void)
|
||||
static void test_textcontrast(void)
|
||||
{
|
||||
GpStatus status;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpGraphics *graphics;
|
||||
UINT contrast;
|
||||
|
||||
@@ -1608,7 +1611,7 @@ static void test_textcontrast(void)
|
||||
expect(4, contrast);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipDrawString(void)
|
||||
@@ -1620,7 +1623,7 @@ static void test_GdipDrawString(void)
|
||||
GpStringFormat *format;
|
||||
GpBrush *brush;
|
||||
LOGFONTA logfont;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
static const WCHAR string[] = {'T','e','s','t',0};
|
||||
|
||||
memset(&logfont,0,sizeof(logfont));
|
||||
@@ -1658,7 +1661,7 @@ static void test_GdipDrawString(void)
|
||||
GdipDeleteFont(fnt);
|
||||
GdipDeleteStringFormat(format);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipGetVisibleClipBounds_screen(void)
|
||||
@@ -1758,36 +1761,10 @@ static void test_GdipGetVisibleClipBounds_window(void)
|
||||
GpGraphics *graphics = NULL;
|
||||
GpRectF rectf, window, exp, clipr;
|
||||
GpRect recti;
|
||||
HWND hwnd;
|
||||
WNDCLASSA class;
|
||||
HDC hdc;
|
||||
PAINTSTRUCT ps;
|
||||
HINSTANCE hInstance = GetModuleHandle(NULL);
|
||||
RECT wnd_rect;
|
||||
|
||||
window.X = 0;
|
||||
window.Y = 0;
|
||||
window.Width = 200;
|
||||
window.Height = 300;
|
||||
|
||||
class.lpszClassName = "ClipBoundsTestClass";
|
||||
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
class.lpfnWndProc = DefWindowProcA;
|
||||
class.hInstance = hInstance;
|
||||
class.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
class.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
class.lpszMenuName = 0;
|
||||
class.cbClsExtra = 0;
|
||||
class.cbWndExtra = 0;
|
||||
RegisterClass(&class);
|
||||
|
||||
hwnd = CreateWindow(class.lpszClassName, "ClipboundsTest",
|
||||
WS_OVERLAPPEDWINDOW, window.X, window.Y, window.Width, window.Height,
|
||||
NULL, NULL, hInstance, NULL);
|
||||
|
||||
ok(hwnd != NULL, "Expected window to be created\n");
|
||||
|
||||
/* get client area size */
|
||||
ok(GetClientRect(hwnd, &wnd_rect), "GetClientRect should have succeeded\n");
|
||||
window.X = wnd_rect.left;
|
||||
@@ -1870,7 +1847,6 @@ static void test_GdipGetVisibleClipBounds_window(void)
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
EndPaint(hwnd, &ps);
|
||||
DestroyWindow(hwnd);
|
||||
}
|
||||
|
||||
static void test_GdipGetVisibleClipBounds(void)
|
||||
@@ -1878,7 +1854,7 @@ static void test_GdipGetVisibleClipBounds(void)
|
||||
GpGraphics* graphics = NULL;
|
||||
GpRectF rectf;
|
||||
GpRect rect;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
GpStatus status;
|
||||
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
@@ -1899,7 +1875,7 @@ static void test_GdipGetVisibleClipBounds(void)
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
|
||||
test_GdipGetVisibleClipBounds_screen();
|
||||
test_GdipGetVisibleClipBounds_window();
|
||||
@@ -1933,7 +1909,7 @@ static void test_GdipIsVisiblePoint(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
REAL x, y;
|
||||
BOOL val;
|
||||
|
||||
@@ -2105,14 +2081,14 @@ static void test_GdipIsVisiblePoint(void)
|
||||
ok(val == FALSE, "After clipping, expected (%.2f, %.2f) not to be visible\n", x, y);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipIsVisibleRect(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics = NULL;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
REAL x, y, width, height;
|
||||
BOOL val;
|
||||
|
||||
@@ -2267,7 +2243,7 @@ static void test_GdipIsVisibleRect(void)
|
||||
ok(val == TRUE, "Expected (%.2f, %.2f, %.2f, %.2f) to be visible\n", x, y, width, height);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_GdipGetNearestColor(void)
|
||||
@@ -2276,7 +2252,7 @@ static void test_GdipGetNearestColor(void)
|
||||
GpGraphics *graphics;
|
||||
GpBitmap *bitmap;
|
||||
ARGB color = 0xdeadbeef;
|
||||
HDC hdc = GetDC(0);
|
||||
HDC hdc = GetDC( hwnd );
|
||||
|
||||
/* create a graphics object */
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
@@ -2415,17 +2391,269 @@ static void test_GdipGetNearestColor(void)
|
||||
expect(Ok, status);
|
||||
status = GdipGetNearestColor(graphics, &color);
|
||||
expect(Ok, status);
|
||||
todo_wine expect(0xffa8b8e8, color);
|
||||
todo_wine
|
||||
ok(color == 0xffa8b8e8 ||
|
||||
broken(color == 0xffa0b8e0), /* Win98/WinMe */
|
||||
"Expected ffa8b8e8, got %.8x\n", color);
|
||||
GdipDeleteGraphics(graphics);
|
||||
GdipDisposeImage((GpImage*)bitmap);
|
||||
|
||||
ReleaseDC(0, hdc);
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
static void test_string_functions(void)
|
||||
{
|
||||
GpStatus status;
|
||||
GpGraphics *graphics;
|
||||
GpFontFamily *family;
|
||||
GpFont *font;
|
||||
RectF rc, char_bounds, bounds;
|
||||
GpBrush *brush;
|
||||
ARGB color = 0xff000000;
|
||||
HDC hdc = GetDC( hwnd );
|
||||
const WCHAR fontname[] = {'C','o','u','r','i','e','r',' ','N','e','w',0};
|
||||
const WCHAR fontname2[] = {'C','o','u','r','i','e','r',0};
|
||||
const WCHAR teststring[] = {'o','o',' ','o','\n','o',0};
|
||||
REAL char_width, char_height;
|
||||
INT codepointsfitted, linesfilled;
|
||||
GpStringFormat *format;
|
||||
CharacterRange ranges[3] = {{0, 1}, {1, 3}, {5, 1}};
|
||||
GpRegion *regions[4] = {0};
|
||||
BOOL region_isempty[4];
|
||||
int i;
|
||||
|
||||
ok(hdc != NULL, "Expected HDC to be initialized\n");
|
||||
status = GdipCreateFromHDC(hdc, &graphics);
|
||||
expect(Ok, status);
|
||||
ok(graphics != NULL, "Expected graphics to be initialized\n");
|
||||
|
||||
status = GdipCreateFontFamilyFromName(fontname, NULL, &family);
|
||||
|
||||
if (status != Ok)
|
||||
{
|
||||
/* Wine doesn't have Courier New? */
|
||||
todo_wine expect(Ok, status);
|
||||
status = GdipCreateFontFamilyFromName(fontname2, NULL, &family);
|
||||
}
|
||||
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCreateFont(family, 10.0, FontStyleRegular, UnitPixel, &font);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCreateSolidFill(color, (GpSolidFill**)&brush);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipCreateStringFormat(0, LANG_NEUTRAL, &format);
|
||||
expect(Ok, status);
|
||||
|
||||
rc.X = 0;
|
||||
rc.Y = 0;
|
||||
rc.Width = 100.0;
|
||||
rc.Height = 100.0;
|
||||
|
||||
status = GdipDrawString(NULL, teststring, 6, font, &rc, NULL, brush);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipDrawString(graphics, NULL, 6, font, &rc, NULL, brush);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipDrawString(graphics, teststring, 6, NULL, &rc, NULL, brush);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipDrawString(graphics, teststring, 6, font, NULL, NULL, brush);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipDrawString(graphics, teststring, 6, font, &rc, NULL, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipDrawString(graphics, teststring, 6, font, &rc, NULL, brush);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipMeasureString(NULL, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureString(graphics, NULL, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, NULL, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, NULL, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, NULL, &codepointsfitted, &linesfilled);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, NULL, &linesfilled);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, NULL);
|
||||
expect(Ok, status);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 1, font, &rc, NULL, &char_bounds, &codepointsfitted, &linesfilled);
|
||||
expect(Ok, status);
|
||||
expectf(0.0, char_bounds.X);
|
||||
expectf(0.0, char_bounds.Y);
|
||||
ok(char_bounds.Width > 0, "got %0.2f\n", bounds.Width);
|
||||
ok(char_bounds.Height > 0, "got %0.2f\n", bounds.Height);
|
||||
expect(1, codepointsfitted);
|
||||
expect(1, linesfilled);
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 2, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(Ok, status);
|
||||
expectf(0.0, bounds.X);
|
||||
expectf(0.0, bounds.Y);
|
||||
ok(bounds.Width > char_bounds.Width, "got %0.2f, expected at least %0.2f\n", bounds.Width, char_bounds.Width);
|
||||
expectf(char_bounds.Height, bounds.Height);
|
||||
expect(2, codepointsfitted);
|
||||
expect(1, linesfilled);
|
||||
char_width = bounds.Width - char_bounds.Width;
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(Ok, status);
|
||||
expectf(0.0, bounds.X);
|
||||
expectf(0.0, bounds.Y);
|
||||
expectf_(char_bounds.Width + char_width * 3, bounds.Width, 0.01);
|
||||
ok(bounds.Height > char_bounds.Height, "got %0.2f, expected at least %0.2f\n", bounds.Height, char_bounds.Height);
|
||||
expect(6, codepointsfitted);
|
||||
expect(2, linesfilled);
|
||||
char_height = bounds.Height - char_bounds.Height;
|
||||
|
||||
/* Cut off everything after the first space. */
|
||||
rc.Width = char_bounds.Width + char_width * 2.5;
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(Ok, status);
|
||||
expectf(0.0, bounds.X);
|
||||
expectf(0.0, bounds.Y);
|
||||
expectf_(char_bounds.Width + char_width, bounds.Width, 0.01);
|
||||
expectf_(char_bounds.Height + char_height * 2, bounds.Height, 0.01);
|
||||
expect(6, codepointsfitted);
|
||||
expect(3, linesfilled);
|
||||
|
||||
/* Cut off everything including the first space. */
|
||||
rc.Width = char_bounds.Width + char_width * 1.5;
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(Ok, status);
|
||||
expectf(0.0, bounds.X);
|
||||
expectf(0.0, bounds.Y);
|
||||
expectf_(char_bounds.Width + char_width, bounds.Width, 0.01);
|
||||
expectf_(char_bounds.Height + char_height * 2, bounds.Height, 0.01);
|
||||
expect(6, codepointsfitted);
|
||||
expect(3, linesfilled);
|
||||
|
||||
/* Cut off everything after the first character. */
|
||||
rc.Width = char_bounds.Width + char_width * 0.5;
|
||||
|
||||
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
|
||||
expect(Ok, status);
|
||||
expectf(0.0, bounds.X);
|
||||
expectf(0.0, bounds.Y);
|
||||
expectf_(char_bounds.Width, bounds.Width, 0.01);
|
||||
todo_wine expectf_(char_bounds.Height + char_height * 3, bounds.Height, 0.05);
|
||||
expect(6, codepointsfitted);
|
||||
todo_wine expect(4, linesfilled);
|
||||
|
||||
status = GdipSetStringFormatMeasurableCharacterRanges(format, 3, ranges);
|
||||
expect(Ok, status);
|
||||
|
||||
rc.Width = 100.0;
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
status = GdipCreateRegion(®ions[i]);
|
||||
expect(Ok, status);
|
||||
}
|
||||
|
||||
status = GdipMeasureCharacterRanges(NULL, teststring, 6, font, &rc, format, 3, regions);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, NULL, 6, font, &rc, format, 3, regions);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, NULL, &rc, format, 3, regions);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, font, NULL, format, 3, regions);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
if (0)
|
||||
{
|
||||
/* Crashes on Windows XP */
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, font, &rc, NULL, 3, regions);
|
||||
expect(InvalidParameter, status);
|
||||
}
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, font, &rc, format, 3, NULL);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, font, &rc, format, 2, regions);
|
||||
expect(InvalidParameter, status);
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, font, &rc, format, 4, regions);
|
||||
expect(Ok, status);
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
status = GdipIsEmptyRegion(regions[i], graphics, ®ion_isempty[i]);
|
||||
expect(Ok, status);
|
||||
}
|
||||
|
||||
ok(!region_isempty[0], "region shouldn't be empty\n");
|
||||
ok(!region_isempty[1], "region shouldn't be empty\n");
|
||||
ok(!region_isempty[2], "region shouldn't be empty\n");
|
||||
ok(!region_isempty[3], "region shouldn't be empty\n");
|
||||
|
||||
/* Cut off everything after the first space, and the second line. */
|
||||
rc.Width = char_bounds.Width + char_width * 2.5;
|
||||
rc.Height = char_bounds.Height + char_height * 0.5;
|
||||
|
||||
status = GdipMeasureCharacterRanges(graphics, teststring, 6, font, &rc, format, 3, regions);
|
||||
expect(Ok, status);
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
{
|
||||
status = GdipIsEmptyRegion(regions[i], graphics, ®ion_isempty[i]);
|
||||
expect(Ok, status);
|
||||
}
|
||||
|
||||
ok(!region_isempty[0], "region shouldn't be empty\n");
|
||||
ok(!region_isempty[1], "region shouldn't be empty\n");
|
||||
ok(region_isempty[2], "region should be empty\n");
|
||||
ok(!region_isempty[3], "region shouldn't be empty\n");
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
GdipDeleteRegion(regions[i]);
|
||||
|
||||
GdipDeleteStringFormat(format);
|
||||
GdipDeleteBrush(brush);
|
||||
GdipDeleteFont(font);
|
||||
GdipDeleteFontFamily(family);
|
||||
GdipDeleteGraphics(graphics);
|
||||
|
||||
ReleaseDC(hwnd, hdc);
|
||||
}
|
||||
|
||||
START_TEST(graphics)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
ULONG_PTR gdiplusToken;
|
||||
WNDCLASSA class;
|
||||
|
||||
memset( &class, 0, sizeof(class) );
|
||||
class.lpszClassName = "gdiplus_test";
|
||||
class.style = CS_HREDRAW | CS_VREDRAW;
|
||||
class.lpfnWndProc = DefWindowProcA;
|
||||
class.hInstance = GetModuleHandleA(0);
|
||||
class.hIcon = LoadIcon(0, IDI_APPLICATION);
|
||||
class.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
class.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
RegisterClassA( &class );
|
||||
hwnd = CreateWindowA( "gdiplus_test", "graphics test", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 200, 200, 0, 0, GetModuleHandleA(0), 0 );
|
||||
ok(hwnd != NULL, "Expected window to be created\n");
|
||||
|
||||
gdiplusStartupInput.GdiplusVersion = 1;
|
||||
gdiplusStartupInput.DebugEventCallback = NULL;
|
||||
@@ -2460,6 +2688,8 @@ START_TEST(graphics)
|
||||
test_clear();
|
||||
test_textcontrast();
|
||||
test_fromMemoryBitmap();
|
||||
test_string_functions();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
DestroyWindow( hwnd );
|
||||
}
|
||||
|
||||
@@ -226,10 +226,23 @@ static void test_GdipImageGetFrameDimensionsCount(void)
|
||||
stat = GdipImageGetFrameDimensionsList((GpImage*)bm, &dimension, 0);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
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);
|
||||
|
||||
count = 12345;
|
||||
stat = GdipImageGetFrameCount((GpImage*)bm, &dimension, &count);
|
||||
todo_wine expect(Ok, stat);
|
||||
todo_wine expect(1, count);
|
||||
expect(Ok, stat);
|
||||
expect(1, count);
|
||||
|
||||
GdipBitmapSetPixel(bm, 0, 0, 0xffffffff);
|
||||
|
||||
@@ -793,6 +806,26 @@ static const unsigned char jpgimage[285] = {
|
||||
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
|
||||
};
|
||||
/* 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
|
||||
};
|
||||
/* 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,
|
||||
@@ -814,6 +847,7 @@ static void test_getrawformat(void)
|
||||
test_bufferrawformat((void*)gifimage, sizeof(gifimage), &ImageFormatGIF, __LINE__, FALSE);
|
||||
test_bufferrawformat((void*)bmpimage, sizeof(bmpimage), &ImageFormatBMP, __LINE__, FALSE);
|
||||
test_bufferrawformat((void*)jpgimage, sizeof(jpgimage), &ImageFormatJPEG, __LINE__, FALSE);
|
||||
test_bufferrawformat((void*)tiffimage, sizeof(tiffimage), &ImageFormatTIFF, __LINE__, FALSE);
|
||||
test_bufferrawformat((void*)wmfimage, sizeof(wmfimage), &ImageFormatWMF, __LINE__, FALSE);
|
||||
}
|
||||
|
||||
@@ -828,6 +862,7 @@ static void test_loadwmf(void)
|
||||
GpRectF bounds;
|
||||
GpUnit unit;
|
||||
REAL res = 12345.0;
|
||||
MetafileHeader header;
|
||||
|
||||
hglob = GlobalAlloc (0, sizeof(wmfimage));
|
||||
data = GlobalLock (hglob);
|
||||
@@ -863,6 +898,27 @@ static void test_loadwmf(void)
|
||||
expect(Ok, stat);
|
||||
todo_wine expectf(1440.0, res);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
GdipDisposeImage(img);
|
||||
}
|
||||
|
||||
@@ -874,6 +930,7 @@ static void test_createfromwmf(void)
|
||||
GpRectF bounds;
|
||||
GpUnit unit;
|
||||
REAL res = 12345.0;
|
||||
MetafileHeader header;
|
||||
|
||||
hwmf = SetMetaFileBitsEx(sizeof(wmfimage)-sizeof(WmfPlaceableFileHeader),
|
||||
wmfimage+sizeof(WmfPlaceableFileHeader));
|
||||
@@ -885,11 +942,11 @@ static void test_createfromwmf(void)
|
||||
|
||||
stat = GdipGetImageBounds(img, &bounds, &unit);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(UnitPixel, unit);
|
||||
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);
|
||||
expectf(320.0, bounds.Width);
|
||||
expectf(320.0, bounds.Height);
|
||||
|
||||
stat = GdipGetImageHorizontalResolution(img, &res);
|
||||
expect(Ok, stat);
|
||||
@@ -899,6 +956,27 @@ static void test_createfromwmf(void)
|
||||
expect(Ok, stat);
|
||||
expectf(1440.0, res);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
GdipDisposeImage(img);
|
||||
}
|
||||
|
||||
@@ -1544,7 +1622,7 @@ static void test_multiframegif(void)
|
||||
|
||||
count = 12345;
|
||||
stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
|
||||
todo_wine expect(Ok, stat);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(2, count);
|
||||
|
||||
/* SelectActiveFrame overwrites our current data */
|
||||
@@ -1618,8 +1696,8 @@ static void test_multiframegif(void)
|
||||
|
||||
count = 12345;
|
||||
stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
|
||||
todo_wine expect(Ok, stat);
|
||||
todo_wine expect(1, count);
|
||||
expect(Ok, stat);
|
||||
expect(1, count);
|
||||
|
||||
GdipDisposeImage((GpImage*)bmp);
|
||||
IStream_Release(stream);
|
||||
@@ -1641,30 +1719,30 @@ static void test_rotateflip(void)
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipImageRotateFlip(bitmap, Rotate90FlipNone);
|
||||
todo_wine expect(Ok, stat);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetImageWidth(bitmap, &width);
|
||||
expect(Ok, stat);
|
||||
stat = GdipGetImageHeight(bitmap, &height);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(2, width);
|
||||
todo_wine expect(3, height);
|
||||
expect(2, width);
|
||||
expect(3, height);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xff00ffff, color);
|
||||
expect(0xff00ffff, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 1, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xffff0000, color);
|
||||
expect(0xffff0000, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 2, &color);
|
||||
todo_wine expect(Ok, stat);
|
||||
todo_wine expect(0xffffff00, color);
|
||||
expect(Ok, stat);
|
||||
expect(0xffffff00, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 1, 2, &color);
|
||||
todo_wine expect(Ok, stat);
|
||||
todo_wine expect(0xff0000ff, color);
|
||||
expect(Ok, stat);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
expect(0, bits[0]);
|
||||
expect(0, bits[1]);
|
||||
@@ -1677,7 +1755,7 @@ static void test_rotateflip(void)
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipImageRotateFlip(bitmap, RotateNoneFlipX);
|
||||
todo_wine expect(Ok, stat);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetImageWidth(bitmap, &width);
|
||||
expect(Ok, stat);
|
||||
@@ -1688,19 +1766,19 @@ static void test_rotateflip(void)
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xff0000ff, color);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xffff0000, color);
|
||||
expect(0xffff0000, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 1, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xffffff00, color);
|
||||
expect(0xffffff00, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 1, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xff00ffff, color);
|
||||
expect(0xff00ffff, color);
|
||||
|
||||
expect(0, bits[0]);
|
||||
expect(0, bits[1]);
|
||||
@@ -1713,7 +1791,7 @@ static void test_rotateflip(void)
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipImageRotateFlip(bitmap, RotateNoneFlipY);
|
||||
todo_wine expect(Ok, stat);
|
||||
expect(Ok, stat);
|
||||
|
||||
stat = GdipGetImageWidth(bitmap, &width);
|
||||
expect(Ok, stat);
|
||||
@@ -1724,19 +1802,19 @@ static void test_rotateflip(void)
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xff00ffff, color);
|
||||
expect(0xff00ffff, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xffffff00, color);
|
||||
expect(0xffffff00, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 1, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xffff0000, color);
|
||||
expect(0xffff0000, color);
|
||||
|
||||
stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 1, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine expect(0xff0000ff, color);
|
||||
expect(0xff0000ff, color);
|
||||
|
||||
expect(0, bits[0]);
|
||||
expect(0, bits[1]);
|
||||
@@ -1801,7 +1879,7 @@ static void test_remaptable(void)
|
||||
|
||||
stat = GdipBitmapGetPixel(bitmap2, 0, 0, &color);
|
||||
expect(Ok, stat);
|
||||
todo_wine ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
||||
ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
|
||||
|
||||
GdipDeleteGraphics(graphics);
|
||||
GdipDisposeImage((GpImage*)bitmap1);
|
||||
|
||||
Reference in New Issue
Block a user