Author: tkreuzer
Date: Mon Apr 23 10:42:22 2012
New Revision: 56393

URL: http://svn.reactos.org/svn/reactos?rev=56393&view=rev
Log:
[GDI32_APITEST]
Add tests for CreateBitmap, CreateIconIndirect, GetRandomRgn and PatBlt

Added:
    trunk/rostests/apitests/gdi32/CreateBitmap.c   (with props)
    trunk/rostests/apitests/gdi32/CreateIconIndirect.c   (with props)
    trunk/rostests/apitests/gdi32/GetRandomRgn.c   (with props)
    trunk/rostests/apitests/gdi32/PatBlt.c   (with props)
Modified:
    trunk/rostests/apitests/gdi32/CMakeLists.txt
    trunk/rostests/apitests/gdi32/testlist.c

Modified: trunk/rostests/apitests/gdi32/CMakeLists.txt
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CMakeLists.txt?rev=56393&r1=56392&r2=56393&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/CMakeLists.txt [iso-8859-1] Mon Apr 23 
10:42:22 2012
@@ -7,11 +7,13 @@
     AddFontResourceEx.c
     BeginPath.c
     CombineTransform.c
+    CreateBitmap.c
     CreateBitmapIndirect.c
     CreateCompatibleDC.c
     CreateDIBitmap.c
     CreateFont.c
     CreateFontIndirect.c
+    CreateIconIndirect.c
     CreatePen.c
     CreateRectRgn.c
     DPtoLP.c
@@ -36,11 +38,13 @@
     GetCurrentObject.c
     GetDIBits.c
     GetObject.c
+    GetRandomRgn.c
     GetPixel.c
     GetStockObject.c
     GetTextExtentExPoint.c
     GetTextFace.c
     MaskBlt.c
+    PatBlt.c
     Rectangle.c
     SelectObject.c
     SetDCPenColor.c

Added: trunk/rostests/apitests/gdi32/CreateBitmap.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CreateBitmap.c?rev=56393&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/CreateBitmap.c (added)
+++ trunk/rostests/apitests/gdi32/CreateBitmap.c [iso-8859-1] Mon Apr 23 
10:42:22 2012
@@ -1,0 +1,49 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for CreateBitmap
+ * PROGRAMMERS:     Timo Kreuzer
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+#define DEFAULT_BITMAP 21
+
+void Test_CreateBitmap()
+{
+    HBITMAP hbmp;
+    BITMAP bitmap;
+    int result;
+
+    hbmp = CreateBitmap(0, 0, 0, 0, NULL);
+    ok(hbmp != 0, "should get a 1x1 bitmap\n");
+    ok(hbmp == GetStockObject(DEFAULT_BITMAP), "\n");
+
+    result = GetObject(hbmp, sizeof(bitmap), &bitmap);
+    ok(result > 0, "result = %d\n", result);
+
+    ok(bitmap.bmType == 0, "bmType = %ld\n", bitmap.bmType);
+    ok(bitmap.bmWidth == 1, "bmWidth = %ld\n", bitmap.bmWidth);
+    ok(bitmap.bmHeight == 1, "bmHeight = %ld\n", bitmap.bmHeight);
+    ok(bitmap.bmWidthBytes == 2, "bmWidthBytes = %ld\n", bitmap.bmWidthBytes);
+    ok(bitmap.bmPlanes == 1, "bmPlanes = %d\n", bitmap.bmPlanes);
+    ok(bitmap.bmBitsPixel == 1, "bmBitsPixel = %d\n", bitmap.bmBitsPixel);
+    ok(bitmap.bmBits == 0, "bmBits = %p\n", bitmap.bmBits);
+
+    DeleteObject(hbmp);
+
+    hbmp = CreateBitmap(1, -1, 1, 0, NULL);
+    ok(hbmp == 0, "\n");
+
+    hbmp = CreateBitmap(-1, 1, 1, 0, NULL);
+    ok(hbmp == 0, "\n");
+
+}
+
+START_TEST(CreateBitmap)
+{
+    Test_CreateBitmap();
+}
+

Propchange: trunk/rostests/apitests/gdi32/CreateBitmap.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/rostests/apitests/gdi32/CreateIconIndirect.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/CreateIconIndirect.c?rev=56393&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/CreateIconIndirect.c (added)
+++ trunk/rostests/apitests/gdi32/CreateIconIndirect.c [iso-8859-1] Mon Apr 23 
10:42:22 2012
@@ -1,0 +1,207 @@
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+
+// FIXME user32
+
+void
+Test_GetIconInfo(BOOL fIcon)
+{
+    HICON hicon;
+    ICONINFO iconinfo, iconinfo2;
+    BITMAP bitmap;
+
+    iconinfo.fIcon = fIcon;
+    iconinfo.xHotspot = 0;
+    iconinfo.yHotspot = 0;
+    iconinfo.hbmMask = NULL;
+    iconinfo.hbmColor = NULL;
+
+    hicon = CreateIconIndirect(&iconinfo);
+    ok(hicon == 0, "should fail\n");
+
+    iconinfo.hbmMask = CreateBitmap(8, 16, 1, 1, NULL);
+    hicon = CreateIconIndirect(&iconinfo);
+    ok(hicon != 0, "should not fail\n");
+
+    ok(GetIconInfo(hicon, &iconinfo2), "\n");
+    ok(iconinfo2.fIcon == iconinfo.fIcon, "\n");
+    if (fIcon)
+    {
+        ok(iconinfo2.xHotspot == 4, "%ld\n", iconinfo2.xHotspot);
+        ok(iconinfo2.yHotspot == 4, "%ld\n", iconinfo2.yHotspot);
+    }
+    else
+    {
+        ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
+        ok(iconinfo2.yHotspot == 0, "%ld\n", iconinfo2.yHotspot);
+    }
+    ok(iconinfo2.hbmMask != NULL, "\n");
+    ok(iconinfo2.hbmMask != iconinfo.hbmMask, "\n");
+    ok(iconinfo2.hbmColor == NULL, "\n");
+
+    ok(GetIconInfo(hicon, &iconinfo2), "\n");
+    ok(iconinfo2.fIcon == iconinfo.fIcon, "\n");
+    if (fIcon)
+    {
+        ok(iconinfo2.xHotspot == 4, "%ld\n", iconinfo2.xHotspot);
+        ok(iconinfo2.yHotspot == 4, "%ld\n", iconinfo2.yHotspot);
+    }
+    else
+    {
+        ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
+        ok(iconinfo2.yHotspot == 0, "%ld\n", iconinfo2.yHotspot);
+    }
+    ok(iconinfo2.hbmMask != NULL, "\n");
+    ok(iconinfo2.hbmMask != iconinfo.hbmMask, "\n");
+    ok(iconinfo2.hbmColor == NULL, "\n");
+
+    iconinfo.hbmColor = CreateBitmap(2, 2, 1, 1, NULL);
+    hicon = CreateIconIndirect(&iconinfo);
+    ok(hicon != 0, "should not fail\n");
+
+    ok(GetIconInfo(hicon, &iconinfo2), "\n");
+    ok(iconinfo2.fIcon == iconinfo.fIcon, "\n");
+    if (fIcon)
+    {
+        ok(iconinfo2.xHotspot == 4, "%ld\n", iconinfo2.xHotspot);
+        ok(iconinfo2.yHotspot == 8, "%ld\n", iconinfo2.yHotspot);
+    }
+    else
+    {
+        ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
+        ok(iconinfo2.yHotspot == 0, "%ld\n", iconinfo2.yHotspot);
+    }
+    ok(iconinfo2.hbmMask != NULL, "\n");
+    ok(iconinfo2.hbmMask != iconinfo.hbmMask, "\n");
+    ok(iconinfo2.hbmColor != NULL, "\n");
+    ok(iconinfo2.hbmMask != iconinfo.hbmColor, "\n");
+
+    ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 8, "\n");
+    ok(bitmap.bmHeight == 16, "\n");
+    ok(bitmap.bmWidthBytes == 2, "\n");
+    ok(bitmap.bmPlanes == 1, "\n");
+    ok(bitmap.bmBitsPixel == 1, "\n");
+    ok(bitmap.bmBits == NULL, "\n");
+
+    ok(GetObject(iconinfo2.hbmColor, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 8, "\n");
+    ok(bitmap.bmHeight == 16, "\n");
+    ok(bitmap.bmWidthBytes == 8 * bitmap.bmBitsPixel / 8, "\n");
+    ok(bitmap.bmPlanes == 1, "\n");
+    ok(bitmap.bmBitsPixel == 32, "\n");
+    ok(bitmap.bmBits == NULL, "\n");
+
+    DeleteObject(iconinfo.hbmMask);
+    iconinfo.hbmMask = NULL;
+    hicon = CreateIconIndirect(&iconinfo);
+    ok(hicon == 0, "should fail\n");
+
+    DeleteObject(iconinfo.hbmColor);
+    iconinfo.hbmColor = CreateCompatibleBitmap(GetDC(0), 16, 16);
+    hicon = CreateIconIndirect(&iconinfo);
+    ok(hicon == 0, "should fail\n");
+
+    iconinfo.hbmMask = CreateCompatibleBitmap(GetDC(0), 8, 16);
+    hicon = CreateIconIndirect(&iconinfo);
+    ok(hicon != 0, "should not fail\n");
+
+    ok(GetIconInfo(hicon, &iconinfo2), "\n");
+
+    ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 8, "%ld\n", bitmap.bmWidth);
+    ok(bitmap.bmHeight == 16, "%ld\n", bitmap.bmHeight);
+    ok(bitmap.bmWidthBytes == 2, "%ld\n", bitmap.bmWidthBytes);
+    ok(bitmap.bmPlanes == 1, "%d\n", bitmap.bmPlanes);
+    ok(bitmap.bmBitsPixel == 1, "%d\n", bitmap.bmBitsPixel);
+    ok(bitmap.bmBits == NULL, "\n");
+
+    ok(GetObject(iconinfo2.hbmColor, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 8, "%ld\n", bitmap.bmWidth);
+    ok(bitmap.bmHeight == 16, "%ld\n", bitmap.bmHeight);
+    ok(bitmap.bmWidthBytes == 32, "%ld\n", bitmap.bmWidthBytes);
+    ok(bitmap.bmPlanes == 1, "%d\n", bitmap.bmPlanes);
+    ok(bitmap.bmBitsPixel == 32, "%d\n", bitmap.bmBitsPixel);
+    ok(bitmap.bmBits == NULL, "\n");
+
+
+}
+
+
+START_TEST(GetIconInfo)
+{
+    HCURSOR hcursor;
+    HICON hicon;
+    ICONINFO iconinfo2;
+    BITMAP bitmap;
+    DWORD data[] = {0, 0, 0, 0, 0, 0};
+
+    Test_GetIconInfo(0);
+    Test_GetIconInfo(1);
+
+    hcursor = LoadCursor(NULL, IDC_APPSTARTING);
+    ok(hcursor != 0, "should not fail\n");
+    ok(GetIconInfo(hcursor, &iconinfo2), "\n");
+    ok(iconinfo2.fIcon == 0, "\n");
+    ok(iconinfo2.xHotspot == 0, "%ld\n", iconinfo2.xHotspot);
+    ok(iconinfo2.yHotspot == 8, "%ld\n", iconinfo2.yHotspot);
+    ok(iconinfo2.hbmMask != NULL, "\n");
+    ok(iconinfo2.hbmColor != NULL, "\n");
+
+    ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 32, "%ld\n", bitmap.bmWidth);
+    ok(bitmap.bmHeight == 32, "\n");
+    ok(bitmap.bmWidthBytes == 4, "\n");
+    ok(bitmap.bmPlanes == 1, "\n");
+    ok(bitmap.bmBitsPixel == 1, "\n");
+    ok(bitmap.bmBits == NULL, "\n");
+
+    ok(GetObject(iconinfo2.hbmColor, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 32, "\n");
+    ok(bitmap.bmHeight == 32, "\n");
+    ok(bitmap.bmWidthBytes == 32 * bitmap.bmBitsPixel / 8, "\n");
+    ok(bitmap.bmPlanes == 1, "\n");
+    ok(bitmap.bmBitsPixel == 32, "\n");
+    ok(bitmap.bmBits == NULL, "\n");
+
+    hcursor = CreateCursor(NULL, 1, 2, 4, 4, data, data);
+    ok(hcursor != 0, "should not fail\n");
+    ok(GetIconInfo(hcursor, &iconinfo2), "\n");
+    ok(iconinfo2.fIcon == 0, "\n");
+    ok(iconinfo2.xHotspot == 1, "%ld\n", iconinfo2.xHotspot);
+    ok(iconinfo2.yHotspot == 2, "%ld\n", iconinfo2.yHotspot);
+    ok(iconinfo2.hbmMask != NULL, "\n");
+    ok(iconinfo2.hbmColor == NULL, "\n");
+
+    ok(GetObject(iconinfo2.hbmMask, sizeof(bitmap), &bitmap), "GetObject 
failed\n");
+    ok(bitmap.bmType == 0, "\n");
+    ok(bitmap.bmWidth == 4, "%ld\n", bitmap.bmWidth);
+    ok(bitmap.bmHeight == 8, "%ld\n", bitmap.bmHeight);
+    ok(bitmap.bmWidthBytes == 2, "%ld\n", bitmap.bmWidthBytes);
+    ok(bitmap.bmPlanes == 1, "\n");
+    ok(bitmap.bmBitsPixel == 1, "\n");
+    ok(bitmap.bmBits == NULL, "\n");
+
+
+    hicon = CreateIcon(0, 4, 4, 1, 1, (PBYTE)data, (PBYTE)data);
+    ok(hicon != 0, "should not fail\n");
+
+    ok(GetIconInfo(hicon, &iconinfo2), "\n");
+    ok(iconinfo2.fIcon == 0, "\n");
+    ok(iconinfo2.xHotspot == 2, "%ld\n", iconinfo2.xHotspot);
+    ok(iconinfo2.yHotspot == 2, "%ld\n", iconinfo2.yHotspot);
+    ok(iconinfo2.hbmMask != NULL, "\n");
+    ok(iconinfo2.hbmColor == NULL, "\n");
+
+}
+
+

Propchange: trunk/rostests/apitests/gdi32/CreateIconIndirect.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/rostests/apitests/gdi32/GetRandomRgn.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetRandomRgn.c?rev=56393&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/GetRandomRgn.c (added)
+++ trunk/rostests/apitests/gdi32/GetRandomRgn.c [iso-8859-1] Mon Apr 23 
10:42:22 2012
@@ -1,0 +1,370 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for ...
+ * PROGRAMMERS:     Timo Kreuzer
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+#define CLIPRGN 1
+#define METARGN 2
+#define APIRGN  3
+#define SYSRGN  4
+#define RGN5    5
+
+#define ok_int(x, exp) \
+    ok((x) == (exp), "Failed test in line %d: value %s expected 0x%x, got 
0x%x\n", \
+       __LINE__, #x, exp, x)
+
+#define ok_long(x, exp) \
+    ok((x) == (exp), "Failed test in line %d: value %s expected 0x%lx, got 
0x%lx\n", \
+       __LINE__, #x, exp, x)
+
+HWND ghwnd;
+HDC ghdcWindow;
+
+void Test_GetRandomRgn_Params()
+{
+    HDC hdc;
+    HRGN hrgn;
+    INT ret;
+
+    hdc = CreateCompatibleDC(0);
+    if (!hdc)
+    {
+        printf("Coun't create a dc\n");
+        return;
+    }
+
+    hrgn = CreateRectRgn(11, 17, 23, 42);
+    if (!hrgn)
+    {
+        printf("Coun't create a region\n");
+        return;
+    }
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(NULL, NULL, 0);
+    ok_int(ret, -1);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(NULL, NULL, CLIPRGN);
+    ok_int(ret, -1);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(NULL, hrgn, 0);
+    ok_int(ret, -1);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(NULL, hrgn, CLIPRGN);
+    ok_int(ret, -1);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, NULL, 0);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, NULL, CLIPRGN);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, hrgn, 0);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, hrgn, 5);
+    ok_int(ret, 1);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, hrgn, 6);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, hrgn, 27);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, hrgn, -1);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn(hdc, hrgn, CLIPRGN);
+    ok_int(ret, 0);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    SetLastError(0xbadbad00);
+    ret = GetRandomRgn((HDC)0x123, hrgn, CLIPRGN);
+    ok_int(ret, -1);
+    ok_long(GetLastError(), 0xbadbad00);
+
+    DeleteObject(hrgn);
+    DeleteDC(hdc);
+}
+
+void Test_GetRandomRgn_CLIPRGN()
+{
+    HDC hdc;
+    HRGN hrgn1, hrgn2;
+    INT ret;
+    RECT rect;
+
+    hrgn1 = CreateRectRgn(11, 17, 23, 42);
+    if (!hrgn1)
+    {
+        printf("Coun't create a region\n");
+        return;
+    }
+
+    hdc = CreateCompatibleDC(0);
+    if (!hdc)
+    {
+        printf("Coun't create a dc\n");
+        return;
+    }
+
+    ret = GetRandomRgn(hdc, hrgn1, CLIPRGN);
+    ok_int(ret, 0);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 11);
+    ok_long(rect.top, 17);
+    ok_long(rect.right, 23);
+    ok_long(rect.bottom, 42);
+
+    hrgn2 = CreateRectRgn(1, 2, 3, 4);
+    SelectClipRgn(hdc, hrgn2);
+    DeleteObject(hrgn2);
+    ret = GetRandomRgn(hdc, hrgn1, CLIPRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 1);
+    ok_long(rect.top, 2);
+    ok_long(rect.right, 3);
+    ok_long(rect.bottom, 4);
+
+    hrgn2 = CreateRectRgn(2, 3, 4, 5);
+    SelectClipRgn(ghdcWindow, hrgn2);
+    DeleteObject(hrgn2);
+    ret = GetRandomRgn(ghdcWindow, hrgn1, CLIPRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 2);
+    ok_long(rect.top, 3);
+    ok_long(rect.right, 4);
+    ok_long(rect.bottom, 5);
+
+    MoveWindow(ghwnd, 200, 400, 100, 100, 0);
+
+    ret = GetRandomRgn(ghdcWindow, hrgn1, CLIPRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 2);
+    ok_long(rect.top, 3);
+    ok_long(rect.right, 4);
+    ok_long(rect.bottom, 5);
+
+
+    DeleteObject(hrgn1);
+    DeleteDC(hdc);
+}
+
+void Test_GetRandomRgn_METARGN()
+{
+}
+
+void Test_GetRandomRgn_APIRGN()
+{
+}
+
+void Test_GetRandomRgn_SYSRGN()
+{
+    HDC hdc;
+    HRGN hrgn1, hrgn2;
+    INT ret;
+    RECT rect, rect2;
+    HBITMAP hbmp;
+
+    hrgn1 = CreateRectRgn(11, 17, 23, 42);
+    if (!hrgn1)
+    {
+        printf("Coun't create a region\n");
+        return;
+    }
+
+    hdc = CreateCompatibleDC(0);
+    if (!hdc)
+    {
+        printf("Coun't create a dc\n");
+        return;
+    }
+
+    ret = GetRandomRgn(hdc, hrgn1, SYSRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 0);
+    ok_long(rect.top, 0);
+    ok_long(rect.right, 1);
+    ok_long(rect.bottom, 1);
+
+    hrgn2 = CreateRectRgn(1, 2, 3, 4);
+    SelectClipRgn(hdc, hrgn2);
+    DeleteObject(hrgn2);
+    ret = GetRandomRgn(hdc, hrgn1, SYSRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 0);
+    ok_long(rect.top, 0);
+    ok_long(rect.right, 1);
+    ok_long(rect.bottom, 1);
+
+    hbmp = CreateCompatibleBitmap(hdc, 4, 7);
+    SelectObject(hdc, hbmp);
+    ret = GetRandomRgn(hdc, hrgn1, SYSRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 0);
+    ok_long(rect.top, 0);
+    ok_long(rect.right, 4);
+    ok_long(rect.bottom, 7);
+    DeleteObject(hbmp);
+
+    MoveWindow(ghwnd, 100, 100, 100, 100, 0);
+    ret = GetRandomRgn(ghdcWindow, hrgn1, SYSRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    DPtoLP(ghdcWindow, (LPPOINT)&rect, 2);
+    ok_long(rect.left, 104);
+    ok_long(rect.top, 124);
+    ok_long(rect.right, 209);
+    ok_long(rect.bottom, 196);
+
+    MoveWindow(ghwnd, 200, 400, 200, 200, 0);
+
+    ret = GetRandomRgn(ghdcWindow, hrgn1, SYSRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect2);
+    DPtoLP(ghdcWindow, (LPPOINT)&rect2, 2);
+    ok_long(rect2.left, rect.left + 100);
+    ok_long(rect2.top, rect.top + 300);
+    ok_long(rect2.right, rect.right + 200 - 13);
+    ok_long(rect2.bottom, rect.bottom + 400);
+
+
+    DeleteObject(hrgn1);
+    DeleteDC(hdc);
+
+}
+
+void Test_GetRandomRgn_RGN5()
+{
+    HDC hdc;
+    HRGN hrgn1, hrgn2;
+    INT ret;
+    RECT rect, rect2;
+    HBITMAP hbmp;
+
+    hrgn1 = CreateRectRgn(11, 17, 23, 42);
+    if (!hrgn1)
+    {
+        printf("Coun't create a region\n");
+        return;
+    }
+
+    hdc = CreateCompatibleDC(0);
+    if (!hdc)
+    {
+        printf("Coun't create a dc\n");
+        return;
+    }
+
+    ret = GetRandomRgn(hdc, hrgn1, RGN5);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 0);
+    ok_long(rect.top, 0);
+    ok_long(rect.right, 1);
+    ok_long(rect.bottom, 1);
+
+    hrgn2 = CreateRectRgn(1, 2, 3, 4);
+    SelectClipRgn(hdc, hrgn2);
+    DeleteObject(hrgn2);
+    ret = GetRandomRgn(hdc, hrgn1, RGN5);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 0);
+    ok_long(rect.top, 0);
+    ok_long(rect.right, 1);
+    ok_long(rect.bottom, 1);
+
+    hbmp = CreateCompatibleBitmap(hdc, 4, 7);
+    SelectObject(hdc, hbmp);
+    ret = GetRandomRgn(hdc, hrgn1, SYSRGN);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    ok_long(rect.left, 0);
+    ok_long(rect.top, 0);
+    ok_long(rect.right, 4);
+    ok_long(rect.bottom, 7);
+    DeleteObject(hbmp);
+
+    MoveWindow(ghwnd, 100, 100, 100, 100, 0);
+    ret = GetRandomRgn(ghdcWindow, hrgn1, RGN5);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect);
+    DPtoLP(ghdcWindow, (LPPOINT)&rect, 2);
+    ok_long(rect.left, 104);
+    ok_long(rect.top, 124);
+    ok_long(rect.right, 209);
+    ok_long(rect.bottom, 196);
+
+    MoveWindow(ghwnd, 200, 400, 200, 200, 0);
+
+    ret = GetRandomRgn(ghdcWindow, hrgn1, RGN5);
+    ok_int(ret, 1);
+    GetRgnBox(hrgn1, &rect2);
+    DPtoLP(ghdcWindow, (LPPOINT)&rect2, 2);
+    ok_long(rect2.left, rect.left + 100);
+    ok_long(rect2.top, rect.top + 300);
+    ok_long(rect2.right, rect.right + 200 - 13);
+    ok_long(rect2.bottom, rect.bottom + 400);
+
+
+    DeleteObject(hrgn1);
+    DeleteDC(hdc);
+}
+
+START_TEST(GetRandomRgn)
+{
+
+       /* Create a window */
+       ghwnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | 
WS_VISIBLE,
+                             100, 100, 100, 100, NULL, NULL, 0, 0);
+       ghdcWindow = GetDC(ghwnd);
+    if (!ghdcWindow)
+    {
+        printf("No window dc\n");
+        return;
+    }
+
+    Test_GetRandomRgn_Params();
+    Test_GetRandomRgn_CLIPRGN();
+    Test_GetRandomRgn_METARGN();
+    Test_GetRandomRgn_APIRGN();
+    Test_GetRandomRgn_SYSRGN();
+    Test_GetRandomRgn_RGN5();
+
+}
+

Propchange: trunk/rostests/apitests/gdi32/GetRandomRgn.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/rostests/apitests/gdi32/PatBlt.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/PatBlt.c?rev=56393&view=auto
==============================================================================
--- trunk/rostests/apitests/gdi32/PatBlt.c (added)
+++ trunk/rostests/apitests/gdi32/PatBlt.c [iso-8859-1] Mon Apr 23 10:42:22 2012
@@ -1,0 +1,109 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for ...
+ * PROGRAMMERS:     Timo Kreuzer
+ */
+
+#include <stdio.h>
+#include <wine/test.h>
+#include <windows.h>
+
+HBITMAP ghbmpTarget;
+PULONG gpulTargetBits;
+HDC hdcTarget;
+
+#define ok_long(x, exp) \
+    ok((x) == (exp), "Failed test in line %d: value %s expected 0x%lx, got 
0x%lx\n", \
+       __LINE__, #x, exp, x)
+
+void Test_BrushOrigin()
+{
+    ULONG aulBits[2] = {0x5555AAAA, 0};
+    HBITMAP hbmp;
+    HBRUSH hbr;
+    BOOL ret;
+
+    hbmp = CreateBitmap(2, 2, 1, 1, aulBits);
+    if (!hbmp)
+    {
+        printf("Couln not create a bitmap\n");
+        return;
+    }
+
+    hbr = CreatePatternBrush(hbmp);
+    if (!hbr)
+    {
+        printf("Couln not create a bitmap\n");
+        return;
+    }
+
+    if (!SelectObject(hdcTarget, hbr))
+    {
+        printf("failed to select pattern brush\n");
+        return;
+    }
+
+    ret = PatBlt(hdcTarget, 0, 0, 2, 2, PATCOPY);
+    ok_long(ret, 1);
+    ok_long(gpulTargetBits[0], 0xffffff);
+    ok_long(gpulTargetBits[1], 0);
+    ok_long(gpulTargetBits[16], 0);
+    ok_long(gpulTargetBits[17], 0xffffff);
+    //printf("0x%lx, 0x%lx\n", gpulTargetBits[0], gpulTargetBits[1]);
+
+    ret = PatBlt(hdcTarget, 1, 0, 2, 2, PATCOPY);
+    ok_long(ret, 1);
+    ok_long(gpulTargetBits[0], 0xffffff);
+    ok_long(gpulTargetBits[1], 0);
+    ok_long(gpulTargetBits[2], 0xffffff);
+    ok_long(gpulTargetBits[16], 0);
+    ok_long(gpulTargetBits[17], 0xffffff);
+    ok_long(gpulTargetBits[18], 0);
+
+}
+
+START_TEST(PatBlt)
+{
+    BITMAPINFO bmi;
+
+    bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    bmi.bmiHeader.biWidth = 16;
+    bmi.bmiHeader.biHeight = -16;
+    bmi.bmiHeader.biPlanes = 1;
+    bmi.bmiHeader.biBitCount = 32;
+    bmi.bmiHeader.biCompression = BI_RGB;
+    bmi.bmiHeader.biSizeImage = 0;
+    bmi.bmiHeader.biXPelsPerMeter = 1;
+    bmi.bmiHeader.biYPelsPerMeter = 1;
+    bmi.bmiHeader.biClrUsed = 0;
+    bmi.bmiHeader.biClrImportant = 0;
+    ghbmpTarget = CreateDIBSection(NULL,
+                                   &bmi,
+                                   DIB_RGB_COLORS,
+                                   (PVOID*)&gpulTargetBits,
+                                   NULL,
+                                   0);
+    if (!ghbmpTarget)
+    {
+        printf("Couln not create target bitmap\n");
+        return;
+    }
+
+    hdcTarget = CreateCompatibleDC(0);
+    if (!hdcTarget)
+    {
+        printf("Couln not create target dc\n");
+        return;
+    }
+
+
+    if (!SelectObject(hdcTarget, ghbmpTarget))
+    {
+        printf("Failed to select bitmap\n");
+        return;
+    }
+
+    Test_BrushOrigin();
+}
+

Propchange: trunk/rostests/apitests/gdi32/PatBlt.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/rostests/apitests/gdi32/testlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/testlist.c?rev=56393&r1=56392&r2=56393&view=diff
==============================================================================
--- trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/testlist.c [iso-8859-1] Mon Apr 23 10:42:22 
2012
@@ -9,11 +9,13 @@
 extern void func_AddFontResourceEx(void);
 extern void func_BeginPath(void);
 extern void func_CombineTransform(void);
+extern void func_CreateBitmap(void);
 extern void func_CreateBitmapIndirect(void);
 extern void func_CreateCompatibleDC(void);
 extern void func_CreateDIBitmap(void);
 extern void func_CreateFont(void);
 extern void func_CreateFontIndirect(void);
+extern void func_CreateIconIndirect(void);
 extern void func_CreatePen(void);
 extern void func_CreateRectRgn(void);
 extern void func_DPtoLP(void);
@@ -39,10 +41,12 @@
 extern void func_GetDIBits(void);
 extern void func_GetPixel(void);
 extern void func_GetObject(void);
+extern void func_GetRandomRgn(void);
 extern void func_GetStockObject(void);
 extern void func_GetTextExtentExPoint(void);
 extern void func_GetTextFace(void);
 extern void func_MaskBlt(void);
+extern void func_PatBlt(void);
 extern void func_Rectangle(void);
 extern void func_SelectObject(void);
 extern void func_SetDCPenColor(void);
@@ -58,11 +62,13 @@
     { "AddFontResourceEx", func_AddFontResourceEx },
     { "BeginPath", func_BeginPath },
     { "CombineTransform", func_CombineTransform },
+    { "CreateBitmap", func_CreateBitmap },
     { "CreateBitmapIndirect", func_CreateBitmapIndirect },
     { "CreateCompatibleDC", func_CreateCompatibleDC },
     { "CreateDIBitmap", func_CreateDIBitmap },
     { "CreateFont", func_CreateFont },
     { "CreateFontIndirect", func_CreateFontIndirect },
+    { "CreateIconIndirect", func_CreateFontIndirect },
     { "CreatePen", func_CreatePen },
     { "CreateRectRgn", func_CreateRectRgn },
     { "DPtoLP", func_DPtoLP },
@@ -88,10 +94,12 @@
     { "GetDIBits", func_GetDIBits },
     { "GetPixel", func_GetPixel },
     { "GetObject", func_GetObject },
+    { "GetRandomRgn", func_GetRandomRgn },
     { "GetStockObject", func_GetStockObject },
     { "GetTextExtentExPoint", func_GetTextExtentExPoint },
     { "GetTextFace", func_GetTextFace },
     { "MaskBlt", func_MaskBlt },
+    { "PatBlt", func_PatBlt },
     { "Rectangle", func_Rectangle },
     { "SelectObject", func_SelectObject },
     { "SetDCPenColor", func_SetDCPenColor },


Reply via email to