Fixed tests and not intialized values.
authorArmin Novak <armin.novak@thincast.com>
Wed, 17 Aug 2016 07:01:27 +0000 (09:01 +0200)
committerArmin Novak <armin.novak@thincast.com>
Thu, 6 Oct 2016 11:43:11 +0000 (13:43 +0200)
libfreerdp/gdi/bitmap.c
libfreerdp/gdi/test/TestGdiBitBlt.c
libfreerdp/gdi/test/TestGdiEllipse.c

index 2ea0a74..db284e2 100644 (file)
@@ -342,7 +342,7 @@ static BOOL BitBlt_process(HGDI_DC hdcDest, UINT32 nXDest, UINT32 nYDest,
                            UINT32 nXSrc, UINT32 nYSrc, const char* rop, const gdiPalette* palette)
 {
        INT64 x, y;
-       UINT32 style;
+       UINT32 style = 0;
        BOOL useSrc = FALSE;
        BOOL usePat = FALSE;
        const char* iter = rop;
index f3d5334..e8ed0b1 100644 (file)
@@ -494,6 +494,7 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat)
        HGDI_BITMAP hBmpSrc;
        HGDI_BITMAP hBmpDst;
        HGDI_BITMAP hBmpDstOriginal;
+       HGDI_BRUSH brush;
        gdiPalette g;
        gdiPalette* hPalette = &g;
        g.format = DstFormat;
@@ -543,6 +544,9 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat)
                        goto fail;
        }
 
+       brush = gdi_CreateSolidBrush(0x123456);
+       gdi_SelectObject(hdcDst, (HGDIOBJECT)brush);
+
        for (x = 0; x < number_tests; x++)
        {
                if (!test_rop(hdcDst, hdcSrc, hBmpSrc, hBmpDst, hBmpDstOriginal, tests[x].rop,
@@ -550,6 +554,8 @@ static BOOL test_gdi_BitBlt(UINT32 SrcFormat, UINT32 DstFormat)
                        failed = TRUE;
        }
 
+       gdi_SelectObject(hdcDst, NULL);
+       gdi_DeleteObject((HGDIOBJECT)brush);
        rc = !failed;
 fail:
 
@@ -567,6 +573,7 @@ fail:
 
 int TestGdiBitBlt(int argc, char* argv[])
 {
+       int rc = 0;
        UINT32 x, y;
        const UINT32 formatList[] =
        {
@@ -600,10 +607,10 @@ int TestGdiBitBlt(int argc, char* argv[])
                                fprintf(stderr, "test_gdi_BitBlt(SrcFormat=%s, DstFormat=%s) failed!\n",
                                        GetColorFormatName(formatList[x]),
                                        GetColorFormatName(formatList[y]));
-                               return -1;
+                               rc = -y;
                        }
                }
        }
 
-       return 0;
+       return rc;
 }
index eaad347..39baf51 100644 (file)
@@ -161,7 +161,7 @@ int TestGdiEllipse(int argc, char* argv[])
                if (!gdi_BitBlt(hdc, 0, 0, 16, 16, hdc, 0, 0, GDI_WHITENESS, hPalette))
                {
                        printf("gdi_BitBlt failed (line #%u)\n", __LINE__);
-                       return -1;
+                       goto fail;
                }
 
                if (!gdi_Ellipse(hdc, 0, 0, 16, 16))