[ros-diffs] [cwittich] 45957: [GDIPLUS_WINETEST] sync gdiplus_winetest to wine 1.1.40

cwittich at svn.reactos.org cwittich at svn.reactos.org
Sat Mar 6 17:24:37 CET 2010


Author: cwittich
Date: Sat Mar  6 17:24:37 2010
New Revision: 45957

URL: http://svn.reactos.org/svn/reactos?rev=45957&view=rev
Log:
[GDIPLUS_WINETEST]
sync gdiplus_winetest to wine 1.1.40

Modified:
    trunk/rostests/winetests/gdiplus/graphics.c
    trunk/rostests/winetests/gdiplus/image.c

Modified: trunk/rostests/winetests/gdiplus/graphics.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphics.c?rev=45957&r1=45956&r2=45957&view=diff
==============================================================================
--- trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] Sat Mar  6 17:24:37 2010
@@ -2270,6 +2270,158 @@
     ReleaseDC(0, hdc);
 }
 
+static void test_GdipGetNearestColor(void)
+{
+    GpStatus status;
+    GpGraphics *graphics;
+    GpBitmap *bitmap;
+    ARGB color = 0xdeadbeef;
+    HDC hdc = GetDC(0);
+
+    /* create a graphics object */
+    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 = GdipGetNearestColor(graphics, NULL);
+    expect(InvalidParameter, status);
+
+    status = GdipGetNearestColor(NULL, &color);
+    expect(InvalidParameter, status);
+    GdipDeleteGraphics(graphics);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat1bppIndexed, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    ok(broken(status == OutOfMemory) /* winver < Win7 */ || status == Ok, "status=%u\n", status);
+    if (status == Ok)
+    {
+        status = GdipGetNearestColor(graphics, &color);
+        expect(Ok, status);
+        expect(0xdeadbeef, color);
+        GdipDeleteGraphics(graphics);
+    }
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat4bppIndexed, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    ok(broken(status == OutOfMemory) /* winver < Win7 */ || status == Ok, "status=%u\n", status);
+    if (status == Ok)
+    {
+        status = GdipGetNearestColor(graphics, &color);
+        expect(Ok, status);
+        expect(0xdeadbeef, color);
+        GdipDeleteGraphics(graphics);
+    }
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat8bppIndexed, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    ok(broken(status == OutOfMemory) /* winver < Win7 */ || status == Ok, "status=%u\n", status);
+    if (status == Ok)
+    {
+        status = GdipGetNearestColor(graphics, &color);
+        expect(Ok, status);
+        expect(0xdeadbeef, color);
+        GdipDeleteGraphics(graphics);
+    }
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppGrayScale, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    todo_wine expect(OutOfMemory, status);
+    if (status == Ok)
+        GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat24bppRGB, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    expect(0xdeadbeef, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat32bppRGB, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    expect(0xdeadbeef, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat32bppARGB, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    expect(0xdeadbeef, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat48bppRGB, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    expect(0xdeadbeef, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppARGB, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    expect(0xdeadbeef, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppPARGB, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    expect(0xdeadbeef, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppRGB565, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    todo_wine expect(0xffa8bce8, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppRGB555, NULL, &bitmap);
+    expect(Ok, status);
+    status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+    expect(Ok, status);
+    status = GdipGetNearestColor(graphics, &color);
+    expect(Ok, status);
+    todo_wine expect(0xffa8b8e8, color);
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap);
+
+    ReleaseDC(0, hdc);
+}
+
 START_TEST(graphics)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -2296,6 +2448,7 @@
     test_GdipDrawLineI();
     test_GdipDrawLinesI();
     test_GdipDrawString();
+    test_GdipGetNearestColor();
     test_GdipGetVisibleClipBounds();
     test_GdipIsVisiblePoint();
     test_GdipIsVisibleRect();

Modified: trunk/rostests/winetests/gdiplus/image.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/image.c?rev=45957&r1=45956&r2=45957&view=diff
==============================================================================
--- trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] Sat Mar  6 17:24:37 2010
@@ -1625,6 +1625,191 @@
     IStream_Release(stream);
 }
 
+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);
+    todo_wine 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);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 0, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xff00ffff, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 1, 0, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xffff0000, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 2, &color);
+    todo_wine expect(Ok, stat);
+    todo_wine expect(0xffffff00, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 1, 2, &color);
+    todo_wine expect(Ok, stat);
+    todo_wine expect(0xff0000ff, color);
+
+    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);
+    todo_wine expect(Ok, stat);
+
+    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);
+    todo_wine expect(0xff0000ff, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 0, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xffff0000, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 1, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xffffff00, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 1, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xff00ffff, color);
+
+    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);
+    todo_wine expect(Ok, stat);
+
+    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);
+    todo_wine expect(0xff00ffff, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 0, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xffffff00, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 0, 1, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xffff0000, color);
+
+    stat = GdipBitmapGetPixel((GpBitmap*)bitmap, 2, 1, &color);
+    expect(Ok, stat);
+    todo_wine expect(0xff0000ff, color);
+
+    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);
+    todo_wine ok(color_match(0xffff00ff, color, 1), "Expected ffff00ff, got %.8x\n", color);
+
+    GdipDeleteGraphics(graphics);
+    GdipDisposeImage((GpImage*)bitmap1);
+    GdipDisposeImage((GpImage*)bitmap2);
+    GdipDisposeImageAttributes(imageattr);
+    GdipFree(map);
+}
+
 START_TEST(image)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -1659,6 +1844,8 @@
     test_colormatrix();
     test_gamma();
     test_multiframegif();
+    test_rotateflip();
+    test_remaptable();
 
     GdiplusShutdown(gdiplusToken);
 }




More information about the Ros-diffs mailing list