Commit 111acb15 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/tests: Remove excessive error handling logic.

parent fa4820c2
...@@ -1517,26 +1517,22 @@ static void test_ImageList_DrawIndirect(void) ...@@ -1517,26 +1517,22 @@ static void test_ImageList_DrawIndirect(void)
hbmMask = CreateBitmap(2, 1, 1, 1, &maskBits); hbmMask = CreateBitmap(2, 1, 1, 1, &maskBits);
ok(hbmMask != 0, "CreateBitmap failed\n"); ok(hbmMask != 0, "CreateBitmap failed\n");
if(!hbmMask) goto cleanup;
hbmInverseMask = CreateBitmap(2, 1, 1, 1, &inverseMaskBits); hbmInverseMask = CreateBitmap(2, 1, 1, 1, &inverseMaskBits);
ok(hbmInverseMask != 0, "CreateBitmap failed\n"); ok(hbmInverseMask != 0, "CreateBitmap failed\n");
if(!hbmInverseMask) goto cleanup;
himl = pImageList_Create(2, 1, ILC_COLOR32, 0, 1); himl = pImageList_Create(2, 1, ILC_COLOR32, 0, 1);
ok(himl != 0, "ImageList_Create failed\n"); ok(himl != 0, "ImageList_Create failed\n");
if(!himl) goto cleanup;
hr = pHIMAGELIST_QueryInterface(himl, &IID_IImageList, (void **) &imgl); hr = pHIMAGELIST_QueryInterface(himl, &IID_IImageList, (void **) &imgl);
ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get interface, hr %#x.\n", hr);
/* Add a no-alpha image */ /* Add a no-alpha image */
hbmImage = create_test_bitmap(hdcDst, 2, 1, 32, bits_image); hbmImage = create_test_bitmap(hdcDst, 2, 1, 32, bits_image);
if(!hbmImage) goto cleanup; ok(hbmImage != NULL, "Failed to create test bitmap.\n");
iImage = pImageList_Add(himl, hbmImage, hbmMask); iImage = pImageList_Add(himl, hbmImage, hbmMask);
ok(iImage != -1, "ImageList_Add failed\n"); ok(iImage != -1, "ImageList_Add failed\n");
if(iImage == -1) goto cleanup;
hr = IImageList_GetItemFlags(imgl, 1000, &flags); hr = IImageList_GetItemFlags(imgl, 1000, &flags);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr); ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
...@@ -1550,11 +1546,10 @@ static void test_ImageList_DrawIndirect(void) ...@@ -1550,11 +1546,10 @@ static void test_ImageList_DrawIndirect(void)
/* Add an alpha image */ /* Add an alpha image */
hbmAlphaImage = create_test_bitmap(hdcDst, 2, 1, 32, bits_alpha); hbmAlphaImage = create_test_bitmap(hdcDst, 2, 1, 32, bits_alpha);
if(!hbmAlphaImage) goto cleanup; ok(hbmAlphaImage != NULL, "Failed to create test bitmap.\n");
iAlphaImage = pImageList_Add(himl, hbmAlphaImage, hbmMask); iAlphaImage = pImageList_Add(himl, hbmAlphaImage, hbmMask);
ok(iAlphaImage != -1, "ImageList_Add failed\n"); ok(iAlphaImage != -1, "ImageList_Add failed\n");
if(iAlphaImage == -1) goto cleanup;
hr = IImageList_GetItemFlags(imgl, iAlphaImage, &flags); hr = IImageList_GetItemFlags(imgl, iAlphaImage, &flags);
ok(hr == S_OK, "Failed to get item flags, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get item flags, hr %#x.\n", hr);
...@@ -1562,11 +1557,10 @@ static void test_ImageList_DrawIndirect(void) ...@@ -1562,11 +1557,10 @@ static void test_ImageList_DrawIndirect(void)
/* Add a transparent alpha image */ /* Add a transparent alpha image */
hbmTransparentImage = create_test_bitmap(hdcDst, 2, 1, 32, bits_transparent); hbmTransparentImage = create_test_bitmap(hdcDst, 2, 1, 32, bits_transparent);
if(!hbmTransparentImage) goto cleanup; ok(hbmTransparentImage != NULL, "Failed to create test bitmap.\n");
iTransparentImage = pImageList_Add(himl, hbmTransparentImage, hbmMask); iTransparentImage = pImageList_Add(himl, hbmTransparentImage, hbmMask);
ok(iTransparentImage != -1, "ImageList_Add failed\n"); ok(iTransparentImage != -1, "ImageList_Add failed\n");
if(iTransparentImage == -1) goto cleanup;
hr = IImageList_GetItemFlags(imgl, iTransparentImage, &flags); hr = IImageList_GetItemFlags(imgl, iTransparentImage, &flags);
ok(hr == S_OK, "Failed to get item flags, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get item flags, hr %#x.\n", hr);
...@@ -1576,8 +1570,6 @@ static void test_ImageList_DrawIndirect(void) ...@@ -1576,8 +1570,6 @@ static void test_ImageList_DrawIndirect(void)
bitmapInfo.bmiHeader.biBitCount = 32; bitmapInfo.bmiHeader.biBitCount = 32;
hbmDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0); hbmDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
ok (hbmDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n"); ok (hbmDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
if (!hbmDst || !bits)
goto cleanup;
hbmOld = SelectObject(hdcDst, hbmDst); hbmOld = SelectObject(hdcDst, hbmDst);
check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_NORMAL, 0x00ABCDEF, __LINE__); check_ImageList_DrawIndirect_fStyle(hdcDst, himl, bits, iImage, ILD_NORMAL, 0x00ABCDEF, __LINE__);
...@@ -1630,24 +1622,19 @@ static void test_ImageList_DrawIndirect(void) ...@@ -1630,24 +1622,19 @@ static void test_ImageList_DrawIndirect(void)
bitmapInfo.bmiHeader.biHeight = -4; bitmapInfo.bmiHeader.biHeight = -4;
hbmDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0); hbmDst = CreateDIBSection(hdcDst, &bitmapInfo, DIB_RGB_COLORS, (void**)&bits, NULL, 0);
ok (hbmDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n"); ok (hbmDst && bits, "CreateDIBSection failed to return a valid bitmap and buffer\n");
if (!hbmDst || !bits) goto cleanup;
SelectObject(hdcDst, hbmDst); SelectObject(hdcDst, hbmDst);
hbm4x4 = create_test_bitmap(hdcDst, 4, 4, 32, bits_4x4); hbm4x4 = create_test_bitmap(hdcDst, 4, 4, 32, bits_4x4);
if (!hbm4x4) goto cleanup; ok(hbm4x4 != NULL, "Failed to create a test bitmap.\n");
ret = pImageList_SetIconSize(himl, 4, 4); ret = pImageList_SetIconSize(himl, 4, 4);
ok(ret, "ImageList_SetIconSize failed\n"); ok(ret, "ImageList_SetIconSize failed\n");
if (!ret) goto cleanup;
ret = pImageList_Add(himl, hbm4x4, NULL); ret = pImageList_Add(himl, hbm4x4, NULL);
ok(ret != -1, "ImageList_Add failed\n"); ok(ret != -1, "ImageList_Add failed\n");
if(ret == -1) goto cleanup;
check_ImageList_DrawIndirect_grayscale(hdcDst, himl, bits, bits_4x4, 0, 4, 4, __LINE__); check_ImageList_DrawIndirect_grayscale(hdcDst, himl, bits, bits_4x4, 0, 4, 4, __LINE__);
cleanup:
if(hbmOld) if(hbmOld)
SelectObject(hdcDst, hbmOld); SelectObject(hdcDst, hbmOld);
if(hbmDst) if(hbmDst)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment