[GDIPLUS_WINETEST]

* Sync with Wine 1.5.26.

svn path=/trunk/; revision=59074
This commit is contained in:
Amine Khaldi 2013-05-23 17:23:10 +00:00
parent f1d5f64d5f
commit 5ad38a47d0
13 changed files with 562 additions and 51 deletions

View file

@ -18,9 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#include <math.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)

View file

@ -18,9 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)

View file

@ -21,9 +21,16 @@
#include <math.h>
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <winnls.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %d, got %d\n", expected, got)
#define expect_(expected, got, precision) ok(abs((expected) - (got)) <= (precision), "Expected %d, got %d\n", (expected), (got))

View file

@ -22,10 +22,15 @@
#include <math.h>
#include <assert.h>
#include "windows.h"
#include "gdiplus.h"
#include "wingdi.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (INT)(expected), (INT)(got))
#define expectf_(expected, got, precision) ok(fabs((expected) - (got)) <= (precision), "Expected %f, got %f\n", (expected), (got))
@ -3056,7 +3061,7 @@ static void test_string_functions(void)
expect(3, linesfilled);
/* Cut off everything including the first space. */
rc.Width = char_bounds.Width + char_width * 1.5;
rc.Width = char_bounds.Width + char_width * 1.7;
status = GdipMeasureString(graphics, teststring, 6, font, &rc, NULL, &bounds, &codepointsfitted, &linesfilled);
expect(Ok, status);
@ -3068,14 +3073,14 @@ static void test_string_functions(void)
expect(3, linesfilled);
/* Cut off everything after the first character. */
rc.Width = char_bounds.Width + char_width * 0.5;
rc.Width = char_bounds.Width + char_width * 0.8;
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);
expectf_(char_bounds.Height + char_height * 3, bounds.Height, 0.05);
expect(6, codepointsfitted);
todo_wine expect(4, linesfilled);
@ -3911,16 +3916,23 @@ static void test_measure_string(void)
static const WCHAR string[] = { 'A','0','1',0 };
HDC hdc;
GpStringFormat *format;
CharacterRange range;
GpRegion *region;
GpGraphics *graphics;
GpFontFamily *family;
GpFont *font;
GpStatus status;
RectF bounds, rect;
REAL width, height, width_1, width_2;
REAL margin_x, margin_y, width_rgn, height_rgn;
int lines, glyphs;
status = GdipCreateStringFormat(StringFormatFlagsNoWrap, LANG_NEUTRAL, &format);
expect(Ok, status);
expect(Ok, status);
status = GdipCreateRegion(&region);
expect(Ok, status);
status = GdipCreateFontFamilyFromName(tahomaW, NULL, &family);
expect(Ok, status);
@ -3931,12 +3943,17 @@ static void test_measure_string(void)
status = GdipCreateFont(family, 20, FontStyleRegular, UnitPixel, &font);
expect(Ok, status);
margin_x = 20.0 / 6.0;
margin_y = 20.0 / 8.0;
set_rect_empty(&rect);
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
width = bounds.Width;
height = bounds.Height;
@ -3947,16 +3964,139 @@ static void test_measure_string(void)
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf(width, bounds.Width);
todo_wine
expectf(height / 2.0, bounds.Height);
range.First = 0;
range.Length = lstrlenW(string);
status = GdipSetStringFormatMeasurableCharacterRanges(format, 1, &range);
expect(Ok, status);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 32000.0;
rect.Height = 32000.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf_(5.0 + margin_x, bounds.X, 1.0);
expectf(5.0, bounds.Y);
expectf_(width - margin_x*2.0, bounds.Width, 1.0);
todo_wine
expectf_(height - margin_y, bounds.Height, 1.0);
width_rgn = bounds.Width;
height_rgn = bounds.Height;
range.First = 0;
range.Length = 1;
status = GdipSetStringFormatMeasurableCharacterRanges(format, 1, &range);
expect(Ok, status);
set_rect_empty(&rect);
rect.Width = 32000.0;
rect.Height = 32000.0;
status = GdipMeasureCharacterRanges(graphics, string, 1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf_(margin_x, bounds.X, 1.0);
expectf(0.0, bounds.Y);
ok(bounds.Width < width_rgn / 2.0, "width of 1 glyph is wrong\n");
expectf(height_rgn, bounds.Height);
width_1 = bounds.Width;
range.First = 0;
range.Length = lstrlenW(string);
status = GdipSetStringFormatMeasurableCharacterRanges(format, 1, &range);
expect(Ok, status);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 0.0;
rect.Height = 0.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf(0.0, bounds.Width);
expectf(0.0, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width_rgn / 2.0;
rect.Height = 32000.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf_(5.0 + margin_x, bounds.X, 1.0);
expectf(5.0, bounds.Y);
expectf_(width_1, bounds.Width, 1.0);
todo_wine
expectf_(height - margin_y, bounds.Height, 1.0);
status = GdipSetStringFormatFlags(format, StringFormatFlagsNoWrap | StringFormatFlagsNoClip);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 0.0;
rect.Height = 0.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf_(5.0 + margin_x, bounds.X, 1.0);
expectf(5.0, bounds.Y);
expectf(width_rgn, bounds.Width);
expectf(height_rgn, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width_rgn / 2.0;
rect.Height = 32000.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf_(5.0 + margin_x, bounds.X, 1.0);
expectf(5.0, bounds.Y);
expectf_(width_1, bounds.Width, 1.0);
expectf(height_rgn, bounds.Height);
set_rect_empty(&rect);
rect.Height = height / 2.0;
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf_(width, bounds.Width, 0.01);
todo_wine
expectf(height, bounds.Height);
set_rect_empty(&rect);
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, 1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(1, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
ok(bounds.Width < width / 2.0, "width of 1 glyph is wrong\n");
expectf(height, bounds.Height);
width_1 = bounds.Width;
@ -3967,6 +4107,8 @@ todo_wine
expect(Ok, status);
expect(2, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
ok(bounds.Width < width, "width of 2 glyphs is wrong\n");
ok(bounds.Width > width_1, "width of 2 glyphs is wrong\n");
expectf(height, bounds.Height);
@ -3979,6 +4121,8 @@ todo_wine
expect(Ok, status);
expect(1, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf_(width_1, bounds.Width, 0.01);
expectf(height, bounds.Height);
@ -3990,6 +4134,8 @@ todo_wine
expect(Ok, status);
expect(2, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf_(width_2, bounds.Width, 0.01);
expectf(height, bounds.Height);
@ -4001,9 +4147,180 @@ todo_wine
expect(Ok, status);
expect(1, glyphs);
expect(1, lines);
expectf(0.0, bounds.X);
expectf(0.0, bounds.Y);
expectf_(width_1, bounds.Width, 0.01);
expectf(height, bounds.Height);
/* Default (Near) alignment */
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width * 2.0;
rect.Height = height * 2.0;
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
expectf(5.0, bounds.X);
expectf(5.0, bounds.Y);
expectf_(width, bounds.Width, 0.01);
expectf(height, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 32000.0;
rect.Height = 32000.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
expectf_(5.0 + margin_x, bounds.X, 1.0);
expectf(5.0, bounds.Y);
expectf_(width - margin_x*2.0, bounds.Width, 1.0);
todo_wine
expectf_(height - margin_y, bounds.Height, 1.0);
width_rgn = bounds.Width;
height_rgn = bounds.Height;
/* Center alignment */
GdipSetStringFormatAlign(format, StringAlignmentCenter);
GdipSetStringFormatLineAlign(format, StringAlignmentCenter);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width * 2.0;
rect.Height = height * 2.0;
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
todo_wine
expectf_(5.0 + width/2.0, bounds.X, 0.01);
todo_wine
expectf(5.0 + height/2.0, bounds.Y);
expectf_(width, bounds.Width, 0.01);
expectf(height, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 0.0;
rect.Height = 0.0;
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
todo_wine
expectf_(5.0 - width/2.0, bounds.X, 0.01);
todo_wine
expectf(5.0 - height/2.0, bounds.Y);
expectf_(width, bounds.Width, 0.01);
expectf(height, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width_rgn * 2.0;
rect.Height = height_rgn * 2.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
todo_wine
expectf_(5.0 + width_rgn/2.0, bounds.X, 1.0);
todo_wine
expectf_(5.0 + height_rgn/2.0, bounds.Y, 1.0);
expectf_(width_rgn, bounds.Width, 1.0);
expectf_(height_rgn, bounds.Height, 1.0);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 0.0;
rect.Height = 0.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
todo_wine
expectf_(5.0 - width_rgn/2.0, bounds.X, 1.0);
todo_wine
expectf_(5.0 - height_rgn/2.0, bounds.Y, 1.0);
expectf_(width_rgn, bounds.Width, 1.0);
expectf_(height_rgn, bounds.Height, 1.0);
/* Far alignment */
GdipSetStringFormatAlign(format, StringAlignmentFar);
GdipSetStringFormatLineAlign(format, StringAlignmentFar);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width * 2.0;
rect.Height = height * 2.0;
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
todo_wine
expectf_(5.0 + width, bounds.X, 0.01);
todo_wine
expectf(5.0 + height, bounds.Y);
expectf_(width, bounds.Width, 0.01);
expectf(height, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 0.0;
rect.Height = 0.0;
set_rect_empty(&bounds);
status = GdipMeasureString(graphics, string, -1, font, &rect, format, &bounds, &glyphs, &lines);
expect(Ok, status);
expect(3, glyphs);
expect(1, lines);
todo_wine
expectf_(5.0 - width, bounds.X, 0.01);
todo_wine
expectf(5.0 - height, bounds.Y);
expectf_(width, bounds.Width, 0.01);
expectf(height, bounds.Height);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = width_rgn * 2.0;
rect.Height = height_rgn * 2.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
todo_wine
expectf_(5.0 + width_rgn, bounds.X, 2.0);
todo_wine
expectf_(5.0 + height_rgn, bounds.Y, 1.0);
expectf_(width_rgn, bounds.Width, 1.0);
expectf_(height_rgn, bounds.Height, 1.0);
rect.X = 5.0;
rect.Y = 5.0;
rect.Width = 0.0;
rect.Height = 0.0;
status = GdipMeasureCharacterRanges(graphics, string, -1, font, &rect, format, 1, &region);
expect(Ok, status);
set_rect_empty(&bounds);
status = GdipGetRegionBounds(region, graphics, &bounds);
expect(Ok, status);
todo_wine
expectf_(5.0 - width_rgn, bounds.X, 2.0);
todo_wine
expectf_(5.0 - height_rgn, bounds.Y, 1.0);
expectf_(width_rgn, bounds.Width, 1.0);
expectf_(height_rgn, bounds.Height, 1.0);
status = GdipDeleteFont(font);
expect(Ok, status);
@ -4012,6 +4329,7 @@ todo_wine
DeleteDC(hdc);
GdipDeleteFontFamily(family);
GdipDeleteRegion(region);
GdipDeleteStringFormat(format);
}
@ -4142,6 +4460,58 @@ static void test_alpha_hdc(void)
DeleteDC(hdc);
}
static void test_bitmapfromgraphics(void)
{
GpStatus stat;
GpGraphics *graphics = NULL;
HDC hdc = GetDC( hwnd );
GpBitmap *bitmap = NULL;
PixelFormat format;
REAL imageres, graphicsres;
UINT width, height;
stat = GdipCreateFromHDC(hdc, &graphics);
expect(Ok, stat);
stat = GdipCreateBitmapFromGraphics(12, 13, NULL, &bitmap);
expect(InvalidParameter, stat);
stat = GdipCreateBitmapFromGraphics(12, 13, graphics, NULL);
expect(InvalidParameter, stat);
stat = GdipCreateBitmapFromGraphics(12, 13, graphics, &bitmap);
expect(Ok, stat);
stat = GdipGetImagePixelFormat((GpImage*)bitmap, &format);
expect(Ok, stat);
expect(PixelFormat32bppPARGB, format);
stat = GdipGetDpiX(graphics, &graphicsres);
expect(Ok, stat);
stat = GdipGetImageHorizontalResolution((GpImage*)bitmap, &imageres);
expect(Ok, stat);
expectf(graphicsres, imageres);
stat = GdipGetDpiY(graphics, &graphicsres);
expect(Ok, stat);
stat = GdipGetImageVerticalResolution((GpImage*)bitmap, &imageres);
expect(Ok, stat);
expectf(graphicsres, imageres);
stat = GdipGetImageWidth((GpImage*)bitmap, &width);
expect(Ok, stat);
expect(12, width);
stat = GdipGetImageHeight((GpImage*)bitmap, &height);
expect(Ok, stat);
expect(13, height);
GdipDeleteGraphics(graphics);
GdipDisposeImage((GpImage*)bitmap);
}
START_TEST(graphics)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -4211,6 +4581,7 @@ START_TEST(graphics)
test_get_set_textrenderinghint();
test_getdc_scaled();
test_alpha_hdc();
test_bitmapfromgraphics();
GdiplusShutdown(gdiplusToken);
DestroyWindow( hwnd );

View file

@ -18,9 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#include <math.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)

View file

@ -25,10 +25,17 @@
#include <assert.h>
#include <stdio.h>
#include "initguid.h"
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#include <initguid.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <winnls.h>
#include <ole2.h>
#include <gdiplus.h>
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got))
#define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))
@ -3106,8 +3113,11 @@ static void test_tiff_properties(void)
PropertyItem *prop_item;
image = load_image((const BYTE *)&TIFF_data, sizeof(TIFF_data));
ok(image != 0, "Failed to load TIFF image data\n");
if (!image) return;
if (!image)
{
win_skip("Failed to load TIFF image data. Might not be supported. Skipping.\n");
return;
}
status = GdipImageGetFrameDimensionsCount(image, &dim_count);
expect(Ok, status);
@ -3361,8 +3371,11 @@ static void test_tiff_palette(void)
/* 1bpp TIFF without palette */
image = load_image((const BYTE *)&TIFF_data, sizeof(TIFF_data));
ok(image != 0, "Failed to load TIFF image data\n");
if (!image) return;
if (!image)
{
win_skip("Failed to load TIFF image data. Might not be supported. Skipping.\n");
return;
}
status = GdipGetImagePixelFormat(image, &format);
expect(Ok, status);
@ -4108,6 +4121,76 @@ static void test_gif_properties(void)
GdipDisposeImage(image);
}
static void test_ARGB_conversion(void)
{
BYTE argb[8] = { 0x11,0x22,0x33,0x80, 0xff,0xff,0xff,0 };
BYTE pargb[8] = { 0x09,0x11,0x1a,0x80, 0,0,0,0 };
BYTE rgb32_xp[8] = { 0x11,0x22,0x33,0xff, 0xff,0xff,0xff,0xff };
BYTE rgb24[6] = { 0x11,0x22,0x33, 0xff,0xff,0xff };
BYTE *bits;
GpBitmap *bitmap;
BitmapData data;
GpStatus status;
int match;
status = GdipCreateBitmapFromScan0(2, 1, 8, PixelFormat32bppARGB, argb, &bitmap);
expect(Ok, status);
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat32bppPARGB, &data);
expect(Ok, status);
ok(data.Width == 2, "expected 2, got %d\n", data.Width);
ok(data.Height == 1, "expected 1, got %d\n", data.Height);
ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
ok(data.PixelFormat == PixelFormat32bppPARGB, "expected PixelFormat32bppPARGB, got %d\n", data.PixelFormat);
match = !memcmp(data.Scan0, pargb, sizeof(pargb));
ok(match, "bits don't match\n");
if (!match)
{
bits = data.Scan0;
trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat32bppPARGB,
bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
}
status = GdipBitmapUnlockBits(bitmap, &data);
expect(Ok, status);
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat32bppRGB, &data);
expect(Ok, status);
ok(data.Width == 2, "expected 2, got %d\n", data.Width);
ok(data.Height == 1, "expected 1, got %d\n", data.Height);
ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
ok(data.PixelFormat == PixelFormat32bppRGB, "expected PixelFormat32bppRGB, got %d\n", data.PixelFormat);
match = !memcmp(data.Scan0, argb, sizeof(argb)) ||
!memcmp(data.Scan0, rgb32_xp, sizeof(rgb32_xp));
ok(match, "bits don't match\n");
if (!match)
{
bits = data.Scan0;
trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat32bppRGB,
bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
}
status = GdipBitmapUnlockBits(bitmap, &data);
expect(Ok, status);
status = GdipBitmapLockBits(bitmap, NULL, ImageLockModeRead, PixelFormat24bppRGB, &data);
expect(Ok, status);
ok(data.Width == 2, "expected 2, got %d\n", data.Width);
ok(data.Height == 1, "expected 1, got %d\n", data.Height);
ok(data.Stride == 8, "expected 8, got %d\n", data.Stride);
ok(data.PixelFormat == PixelFormat24bppRGB, "expected PixelFormat24bppRGB, got %d\n", data.PixelFormat);
match = !memcmp(data.Scan0, rgb24, sizeof(rgb24));
ok(match, "bits don't match\n");
if (!match)
{
bits = data.Scan0;
trace("format %#x, bits %02x,%02x,%02x,%02x %02x,%02x,%02x,%02x\n", PixelFormat24bppRGB,
bits[0], bits[1], bits[2], bits[3], bits[4], bits[5], bits[6], bits[7]);
}
status = GdipBitmapUnlockBits(bitmap, &data);
expect(Ok, status);
GdipDisposeImage((GpImage *)bitmap);
}
START_TEST(image)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -4120,6 +4203,7 @@ START_TEST(image)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_ARGB_conversion();
test_DrawImage_scale();
test_image_format();
test_DrawImage();

View file

@ -20,10 +20,16 @@
#include <math.h>
#include "windows.h"
#include <stdio.h>
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#include <wine/test.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(fabs(expected - got) < 0.0001, "Expected %.2f, got %.2f\n", expected, got)

View file

@ -18,10 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include <stdio.h>
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)

View file

@ -18,9 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)

View file

@ -20,9 +20,15 @@
#include <math.h>
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(fabs(got - expected) < 0.1, "Expected %.2f, got %.2f\n", expected, got)

View file

@ -18,10 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include "gdiplus.h"
#include "wingdi.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#include <math.h>
#define RGNDATA_RECT 0x10000000

View file

@ -18,9 +18,15 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windows.h"
#include "gdiplus.h"
#include "wine/test.h"
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
//#include "windows.h"
#include <wine/test.h>
#include <wingdi.h>
#include <objbase.h>
#include <gdiplus.h>
#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
#define expectf(expected, got) ok(got == expected, "Expected %.2f, got %.2f\n", expected, got)

View file

@ -1,8 +1,5 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define STANDALONE
#include "wine/test.h"