[PATCH] comctl32/tests: Enable visual tests in interactive mode, fix build failure
Nikolay Sivov
nsivov at codeweavers.com
Sun Nov 15 06:54:01 CST 2015
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/comctl32/tests/imagelist.c | 55 ++++++++++++++++++-----------------------
1 file changed, 24 insertions(+), 31 deletions(-)
diff --git a/dlls/comctl32/tests/imagelist.c b/dlls/comctl32/tests/imagelist.c
index 7e8108a..9941667 100644
--- a/dlls/comctl32/tests/imagelist.c
+++ b/dlls/comctl32/tests/imagelist.c
@@ -40,16 +40,6 @@
#include "wine/test.h"
#include "v6util.h"
-#undef VISIBLE
-
-#ifdef VISIBLE
-#define WAIT Sleep (1000)
-#define REDRAW(hwnd) RedrawWindow (hwnd, NULL, 0, RDW_UPDATENOW)
-#else
-#define WAIT
-#define REDRAW(hwnd)
-#endif
-
#define IMAGELIST_MAGIC (('L' << 8) | 'I')
#include "pshpack2.h"
@@ -79,6 +69,16 @@ static HRESULT (WINAPI *pHIMAGELIST_QueryInterface)(HIMAGELIST,REFIID,void **);
static HINSTANCE hinst;
+/* only used in interactive mode */
+static void force_redraw(HWND hwnd)
+{
+ if (!winetest_interactive)
+ return;
+
+ RedrawWindow(hwnd, NULL, 0, RDW_UPDATENOW);
+ Sleep(1000);
+}
+
/* These macros build cursor/bitmap data in 4x4 pixel blocks */
#define B(x,y) ((x?0xf0:0)|(y?0xf:0))
#define ROW1(a,b,c,d,e,f,g,h) B(a,b),B(c,d),B(e,f),B(g,h)
@@ -161,11 +161,11 @@ static HWND create_a_window(void)
CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0,
0, hinst, 0);
-#ifdef VISIBLE
- ShowWindow (hWnd, SW_SHOW);
-#endif
- REDRAW(hWnd);
- WAIT;
+ if (winetest_interactive)
+ {
+ ShowWindow (hWnd, SW_SHOW);
+ force_redraw (hWnd);
+ }
return hWnd;
}
@@ -173,16 +173,15 @@ static HWND create_a_window(void)
static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size,
LPCSTR loc, BOOL clear)
{
- HDC hdc = NULL;
-#ifdef VISIBLE
- if (!himl) return NULL;
+ HDC hdc;
+
+ if (!winetest_interactive || !himl) return NULL;
- SetWindowText(hwnd, loc);
+ SetWindowTextA(hwnd, loc);
hdc = GetDC(hwnd);
ImageList_Draw(himl, idx, hdc, 0, 0, ILD_TRANSPARENT);
- REDRAW(hwnd);
- WAIT;
+ force_redraw(hwnd);
if (clear)
{
@@ -190,12 +189,11 @@ static HDC show_image(HWND hwnd, HIMAGELIST himl, int idx, int size,
ReleaseDC(hwnd, hdc);
hdc = NULL;
}
-#endif /* VISIBLE */
+
return hdc;
}
/* Useful for checking differences */
-#if 0
static void dump_bits(const BYTE *p, const BYTE *q, int size)
{
int i, j;
@@ -216,18 +214,16 @@ static void dump_bits(const BYTE *p, const BYTE *q, int size)
}
printf("\n");
}
-#endif
static void check_bits(HWND hwnd, HIMAGELIST himl, int idx, int size,
const BYTE *checkbits, LPCSTR loc)
{
-#ifdef VISIBLE
BYTE bits[100*100/8];
COLORREF c;
HDC hdc;
int x, y, i = -1;
- if (!himl) return;
+ if (!winetest_interactive || !himl) return;
memset(bits, 0, sizeof(bits));
hdc = show_image(hwnd, himl, idx, size, loc, FALSE);
@@ -250,7 +246,6 @@ static void check_bits(HWND hwnd, HIMAGELIST himl, int idx, int size,
"%s: bits different\n", loc);
if (memcmp(bits, checkbits, (size * size)/8))
dump_bits(bits, checkbits, size);
-#endif /* VISIBLE */
}
static void test_begindrag(void)
@@ -503,8 +498,7 @@ static void test_DrawIndirect(void)
ok(!pImageList_DrawIndirect(&imldp),"bad himl succeeded!\n");
imldp.himl = himl;
- REDRAW(hwndfortest);
- WAIT;
+ force_redraw(hwndfortest);
imldp.fStyle = SRCCOPY;
imldp.rgbBk = CLR_DEFAULT;
@@ -1821,8 +1815,7 @@ if (0)
imldp.hdcDst = hdc;
imldp.himl = himl;
- REDRAW(hwndfortest);
- WAIT;
+ force_redraw(hwndfortest);
imldp.fStyle = SRCCOPY;
imldp.rgbBk = CLR_DEFAULT;
--
2.6.2
More information about the wine-patches
mailing list