* Sync with Wine 1.7.27.
CORE-8540
svn path=/trunk/; revision=64341
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'};
static const WCHAR MSSansSerif[] = {'M','S',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
-static const WCHAR MicrosoftSansSerif[] = {'M','i','c','r','o','s','o','f','t',' ','S','a','n','s',' ','S','e','r','i','f','\0'};
static const WCHAR TimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n','\0'};
-static const WCHAR CourierNew[] = {'C','o','u','r','i','e','r',' ','N','e','w','\0'};
static const WCHAR Tahoma[] = {'T','a','h','o','m','a',0};
-static const WCHAR LiberationSerif[] = {'L','i','b','e','r','a','t','i','o','n',' ','S','e','r','i','f',0};
static void set_rect_empty(RectF *rc)
{
lf.lfWeight = 0;
lf.lfCharSet = 0;
lstrcpyA(lf.lfFaceName, "ThisFontShouldNotExist");
+ font = NULL;
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
"expected NotTrueTypeFont, got %d\n", status);
+ /* FIXME: remove when wine is fixed */
+ if (font) GdipDeleteFont(font);
/* empty FaceName */
lf.lfFaceName[0] = 0;
+ font = NULL;
status = GdipCreateFontFromLogfontA(hdc, &lf, &font);
todo_wine
ok(status == NotTrueTypeFont || broken(status == FileNotFound), /* before XP */
"expected NotTrueTypeFont, got %d\n", status);
+ /* FIXME: remove when wine is fixed */
+ if (font) GdipDeleteFont(font);
GdipDeleteGraphics(graphics);
DeleteDC(hdc);
return pixels_to_units(pixels, to, dpi);
}
-static GpGraphics *create_graphics(REAL res_x, REAL res_y, GpUnit unit, REAL scale)
+static GpGraphics *create_graphics(REAL res_x, REAL res_y, GpUnit unit, REAL scale, GpImage **image)
{
GpStatus status;
union
status = GdipGetImageGraphicsContext(u.image, &graphics);
expect(Ok, status);
- /* image is intentionally leaked to make sure that there is no
- side effects after its destruction.
- status = GdipDisposeImage(u.image);
- expect(Ok, status);
- */
+
+ *image = u.image;
status = GdipGetDpiX(graphics, &res);
expect(Ok, status);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
- graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale);
+ GpImage *image;
+
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale, &image);
lf.lfHeight = 0xdeadbeef;
status = GdipGetLogFontW(font, graphics, &lf);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
+
+ status = GdipDisposeImage(image);
+ expect(Ok, status);
}
GdipDeleteFont(font);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
REAL unit_scale;
+ GpImage *image;
- graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale);
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].page_scale, &image);
lf.lfHeight = 0xdeadbeef;
status = GdipGetLogFontW(font, graphics, &lf);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
+
+ status = GdipDisposeImage(image);
+ expect(Ok, status);
}
GdipDeleteFont(font);
};
GpStatus status;
GpGraphics *graphics;
+ GpImage *image;
GpPointF ptf[2];
UINT i;
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
{
- graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale);
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit, td[i].scale, &image);
ptf[0].X = td[i].in[0].X;
ptf[0].Y = td[i].in[0].Y;
ptf[1].X = td[i].in[1].X;
expectf(td[i].in[1].Y, ptf[1].Y);
status = GdipDeleteGraphics(graphics);
expect(Ok, status);
+ status = GdipDisposeImage(image);
+ expect(Ok, status);
}
}
static void test_LoadingImages(void)
{
GpStatus stat;
+ GpBitmap *bm;
+ GpImage *img;
+ static const WCHAR nonexistentW[] = {'n','o','n','e','x','i','s','t','e','n','t',0};
stat = GdipCreateBitmapFromFile(0, 0);
expect(InvalidParameter, stat);
- stat = GdipCreateBitmapFromFile(0, (GpBitmap**)0xdeadbeef);
+ bm = (GpBitmap *)0xdeadbeef;
+ stat = GdipCreateBitmapFromFile(0, &bm);
expect(InvalidParameter, stat);
+ ok(bm == (GpBitmap *)0xdeadbeef, "returned %p\n", bm);
+
+ bm = (GpBitmap *)0xdeadbeef;
+ stat = GdipCreateBitmapFromFile(nonexistentW, &bm);
+ todo_wine expect(InvalidParameter, stat);
+ ok(!bm, "returned %p\n", bm);
stat = GdipLoadImageFromFile(0, 0);
expect(InvalidParameter, stat);
- stat = GdipLoadImageFromFile(0, (GpImage**)0xdeadbeef);
+ img = (GpImage *)0xdeadbeef;
+ stat = GdipLoadImageFromFile(0, &img);
expect(InvalidParameter, stat);
+ ok(img == (GpImage *)0xdeadbeef, "returned %p\n", img);
+
+ img = (GpImage *)0xdeadbeef;
+ stat = GdipLoadImageFromFile(nonexistentW, &img);
+ todo_wine expect(OutOfMemory, stat);
+ ok(!img, "returned %p\n", img);
stat = GdipLoadImageFromFileICM(0, 0);
expect(InvalidParameter, stat);
- stat = GdipLoadImageFromFileICM(0, (GpImage**)0xdeadbeef);
+ img = (GpImage *)0xdeadbeef;
+ stat = GdipLoadImageFromFileICM(0, &img);
expect(InvalidParameter, stat);
+ ok(img == (GpImage *)0xdeadbeef, "returned %p\n", img);
+
+ img = (GpImage *)0xdeadbeef;
+ stat = GdipLoadImageFromFileICM(nonexistentW, &img);
+ todo_wine expect(OutOfMemory, stat);
+ ok(!img, "returned %p\n", img);
}
static void test_SavingImages(void)