comctl32/tests: Don't assert() on test failures.

This commit is contained in:
Nikolay Sivov 2014-02-13 12:31:48 +04:00 committed by Alexandre Julliard
parent 7dc45ea585
commit 91672c8453
9 changed files with 56 additions and 62 deletions

View File

@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <windows.h>
#include <commctrl.h>
@ -505,10 +504,11 @@ static BOOL init(void)
hComboExParentWnd = CreateWindowExA(0, ComboExTestClass, "ComboEx test", WS_OVERLAPPEDWINDOW|WS_VISIBLE,
CW_USEDEFAULT, CW_USEDEFAULT, 680, 260, NULL, NULL, GetModuleHandleA(NULL), 0);
assert(hComboExParentWnd != NULL);
ok(hComboExParentWnd != NULL, "failed to create parent window\n");
hMainHinst = GetModuleHandleA(NULL);
return TRUE;
return hComboExParentWnd != NULL;
}
static void cleanup(void)

View File

@ -21,7 +21,6 @@
#include <windows.h>
#include <commctrl.h>
#include <assert.h>
#include "wine/test.h"
#include "v6util.h"
@ -216,17 +215,21 @@ static const struct message bitmapmarginMessages_seq[] = {
static void expect_notify(INT iCode, BOOL fUnicode, HDITEMA *lpItem)
{
assert(nExpectedNotify < 10);
expectedNotify[nExpectedNotify].iCode = iCode;
expectedNotify[nExpectedNotify].fUnicode = fUnicode;
expectedNotify[nExpectedNotify].hdItem = *lpItem;
nExpectedNotify++;
ok(nExpectedNotify < 10, "notification count %d\n", nExpectedNotify);
if (nExpectedNotify < 10)
{
expectedNotify[nExpectedNotify].iCode = iCode;
expectedNotify[nExpectedNotify].fUnicode = fUnicode;
expectedNotify[nExpectedNotify].hdItem = *lpItem;
nExpectedNotify++;
}
}
static void dont_expect_notify(INT iCode)
{
assert(nUnexpectedNotify < 10);
unexpectedNotify[nUnexpectedNotify++] = iCode;
ok(nExpectedNotify < 10, "notification count %d\n", nExpectedNotify);
if (nExpectedNotify < 10)
unexpectedNotify[nUnexpectedNotify++] = iCode;
}
static BOOL notifies_received(void)
@ -323,7 +326,7 @@ static HWND create_header_control (void)
WS_CHILD|WS_BORDER|WS_VISIBLE|HDS_BUTTONS|HDS_HORZ,
0, 0, 0, 0,
hHeaderParentWnd, NULL, NULL, NULL);
assert(handle);
ok(handle != NULL, "failed to create header window\n");
if (winetest_interactive)
ShowWindow (hHeaderParentWnd, SW_SHOW);
@ -502,7 +505,7 @@ static HWND create_custom_header_control(HWND hParent, BOOL preloadHeaderItems)
WS_CHILD|WS_BORDER|WS_VISIBLE|HDS_BUTTONS|HDS_HORZ,
0, 0, 0, 0,
hParent, NULL, NULL, NULL);
assert(childHandle);
ok(childHandle != NULL, "failed to create child window\n");
if (preloadHeaderItems)
{
for ( loopcnt = 0 ; loopcnt < 2 ; loopcnt++ )
@ -987,7 +990,6 @@ static void test_hdm_filterMessages(HWND hParent)
flush_sequences(sequences, NUM_MSG_SEQUENCES);
hChild = create_custom_header_control(hParent, TRUE);
assert(hChild);
ok_sequence(sequences, PARENT_SEQ_INDEX, add_header_to_parent_seq,
"adder header control to parent", FALSE);
@ -1683,9 +1685,10 @@ static BOOL init(void)
CW_USEDEFAULT, CW_USEDEFAULT, 672+2*GetSystemMetrics(SM_CXSIZEFRAME),
226+GetSystemMetrics(SM_CYCAPTION)+2*GetSystemMetrics(SM_CYSIZEFRAME),
NULL, NULL, GetModuleHandleA(NULL), 0);
assert(hHeaderParentWnd != NULL);
ok(hHeaderParentWnd != NULL, "failed to create parent wnd\n");
ShowWindow(hHeaderParentWnd, SW_SHOW);
return TRUE;
return hHeaderParentWnd != NULL;
}
/* maximum 8 items allowed */

View File

@ -29,7 +29,6 @@
#include "wine/test.h"
#include "v6util.h"
#include <assert.h>
#include <windows.h>
#include "msg.h"
@ -572,8 +571,7 @@ static HWND create_parent_window(void)
hwnd = CreateWindowExA(0, "Month-Cal test parent class", "Month-Cal test parent window",
WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_VISIBLE,
0, 0, 500, 500, GetDesktopWindow(), NULL, GetModuleHandleA(NULL), NULL);
assert(hwnd);
ok(hwnd != NULL, "failed to create parent wnd\n");
/* check for message sequences */
ok_sequence(sequences, PARENT_SEQ_INDEX, create_parent_window_seq, "create parent window", FALSE);
@ -618,7 +616,7 @@ static HWND create_monthcal_control(DWORD style)
hwnd = CreateWindowExA(0, MONTHCAL_CLASSA, "", WS_CHILD | WS_BORDER | WS_VISIBLE | style,
0, 0, 300, 400, parent_wnd, NULL, GetModuleHandleA(NULL), NULL);
ok(hwnd != NULL, "failed to create monthcal wnd\n");
if (!hwnd) return NULL;
oldproc = (WNDPROC)SetWindowLongPtrA(hwnd, GWLP_WNDPROC,
@ -1981,7 +1979,6 @@ static void test_sel_notify(void)
{
hwnd = create_monthcal_control(styles[i].val);
SetWindowLongPtrA(hwnd, GWLP_ID, SEL_NOTIFY_TEST_ID);
assert(hwnd);
SendMessageA(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&rc);
MoveWindow(hwnd, 0, 0, rc.right, rc.bottom, FALSE);
/* Simulate mouse click on some unselected day to generate

View File

@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
@ -99,7 +98,8 @@ static void init(void)
BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*);
WNDCLASSA wc;
RECT rect;
BOOL ret;
hComctl32 = GetModuleHandleA("comctl32.dll");
pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx");
if (pInitCommonControlsEx)
@ -128,16 +128,17 @@ static void init(void)
rect.top = 0;
rect.right = 400;
rect.bottom = 20;
assert(AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE));
ret = AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW, FALSE);
ok(ret, "got %d\n", ret);
hProgressParentWnd = CreateWindowExA(0, progressTestClass, "Progress Bar Test", WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, GetModuleHandleA(NULL), 0);
assert(hProgressParentWnd != NULL);
ok(hProgressParentWnd != NULL, "failed to create parent wnd\n");
GetClientRect(hProgressParentWnd, &rect);
hProgressWnd = CreateWindowExA(0, PROGRESS_CLASSA, "", WS_CHILD | WS_VISIBLE,
0, 0, rect.right, rect.bottom, hProgressParentWnd, NULL, GetModuleHandleA(NULL), 0);
assert(hProgressWnd != NULL);
ok(hProgressWnd != NULL, "failed to create parent wnd\n");
progress_wndproc = (WNDPROC)SetWindowLongPtrA(hProgressWnd, GWLP_WNDPROC, (LPARAM)progress_subclass_proc);
ShowWindow(hProgressParentWnd, SW_SHOWNORMAL);
@ -146,7 +147,6 @@ static void init(void)
update_window(hProgressParentWnd);
}
static void cleanup(void)
{
MSG msg;

View File

@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <windows.h>
#include <commctrl.h>
@ -55,7 +54,7 @@ static HWND create_status_control(DWORD style, DWORD exstyle)
0, 0, 300, 20,
/* parent, etc */
NULL, NULL, hinst, NULL);
assert (hWndStatus);
ok(hWndStatus != NULL, "failed to create status wnd\n");
return hWndStatus;
}

View File

@ -219,7 +219,7 @@ static void test_subclass(void)
{
HWND hwnd = CreateWindowExA(0, "TestSubclass", "Test subclass", WS_OVERLAPPEDWINDOW,
100, 100, 200, 200, 0, 0, 0, NULL);
assert(hwnd);
ok(hwnd != NULL, "failed to create test subclass wnd\n");
pSetWindowSubclass(hwnd, wnd_proc_sub, 2, 0);
SendMessageA(hwnd, WM_USER, 1, 0);
@ -263,6 +263,7 @@ static void test_subclass(void)
static BOOL register_window_classes(void)
{
WNDCLASSA cls;
ATOM atom;
cls.style = 0;
cls.lpfnWndProc = wnd_proc_1;
@ -274,9 +275,10 @@ static BOOL register_window_classes(void)
cls.hbrBackground = NULL;
cls.lpszMenuName = NULL;
cls.lpszClassName = "TestSubclass";
if(!RegisterClassA(&cls)) return FALSE;
return TRUE;
atom = RegisterClassA(&cls);
ok(atom, "failed to register test class\n");
return atom != 0;
}
static BOOL init_function_pointers(void)
@ -285,7 +287,7 @@ static BOOL init_function_pointers(void)
void *ptr;
hmod = GetModuleHandleA("comctl32.dll");
assert(hmod);
ok(hmod != NULL, "got %p\n", hmod);
/* Functions have to be loaded by ordinal. Only XP and W2K3 export
* them by name.
@ -323,7 +325,7 @@ START_TEST(subclass)
{
if(!init_function_pointers()) return;
if(!register_window_classes()) assert(0);
if(!register_window_classes()) return;
test_subclass();
}

View File

@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <windows.h>
#include <commctrl.h>
#include <stdio.h>
@ -300,8 +299,7 @@ create_tabcontrol (DWORD style, DWORD mask)
handle = CreateWindowA(WC_TABCONTROLA, "TestTab",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style, 10, 10, 300, 100, NULL,
NULL, NULL, 0);
assert (handle);
ok(handle != NULL, "failed to create tab wnd\n");
SetWindowLongA(handle, GWL_STYLE, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style);
SendMessageA(handle, WM_SETFONT, 0, (LPARAM)hFont);
@ -438,8 +436,7 @@ static HWND createFilledTabControl(HWND parent_wnd, DWORD style, DWORD mask, INT
tabHandle = CreateWindowA(WC_TABCONTROLA, "TestTab",
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | TCS_FOCUSNEVER | style, 0, 0, rect.right,
rect.bottom, parent_wnd, NULL, NULL, 0);
assert(tabHandle);
ok(tabHandle != NULL, "failed to create tab wnd\n");
oldproc = (WNDPROC)SetWindowLongPtrA(tabHandle, GWLP_WNDPROC, (LONG_PTR)tabSubclassProcess);
SetWindowLongPtrA(tabHandle, GWLP_USERDATA, (LONG_PTR)oldproc);

View File

@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <windows.h>
#include <commctrl.h>
@ -33,12 +32,12 @@ static void test_create_tooltip(void)
parent = CreateWindowExA(0, "static", NULL, WS_POPUP,
0, 0, 0, 0,
NULL, NULL, NULL, 0);
assert(parent);
ok(parent != NULL, "failed to create parent wnd\n");
hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0x7fffffff | WS_POPUP,
10, 10, 300, 100,
parent, NULL, NULL, 0);
assert(hwnd);
ok(hwnd != NULL, "failed to create tooltip wnd\n");
style = GetWindowLongA(hwnd, GWL_STYLE);
trace("style = %08x\n", style);
@ -52,7 +51,7 @@ static void test_create_tooltip(void)
hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
10, 10, 300, 100,
parent, NULL, NULL, 0);
assert(hwnd);
ok(hwnd != NULL, "failed to create tooltip wnd\n");
style = GetWindowLongA(hwnd, GWL_STYLE);
trace("style = %08x\n", style);
@ -302,7 +301,7 @@ static void test_gettext(void)
hwnd = CreateWindowExA(0, TOOLTIPS_CLASSA, NULL, 0,
10, 10, 300, 100,
NULL, NULL, NULL, 0);
assert(hwnd);
ok(hwnd != NULL, "failed to create tooltip wnd\n");
/* use sizeof(TTTOOLINFOA) instead of TTTOOLINFOA_V1_SIZE so that adding it fails on Win9x */
/* otherwise it crashes on the NULL lpszText */
@ -408,8 +407,7 @@ static void test_gettext(void)
win_skip("CreateWindowExW is not implemented\n");
return;
}
assert(hwnd);
ok(hwnd != NULL, "failed to create tooltip wnd\n");
toolinfoW.cbSize = sizeof(TTTOOLINFOW);
toolinfoW.hwnd = NULL;

View File

@ -18,7 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
@ -352,9 +351,9 @@ static void test_fillroot(void)
Clear();
AddItem('A');
assert(hRoot);
ok(hRoot != NULL, "failed to set root\n");
AddItem('B');
assert(hChild);
ok(hChild != NULL, "failed to set child\n");
AddItem('.');
ok_sequence(sequences, TREEVIEW_SEQ_INDEX, FillRootSeq, "FillRoot", FALSE);
ok(!strcmp(sequence, "AB."), "Item creation\n");
@ -390,7 +389,7 @@ static void test_callback(void)
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = LPSTR_TEXTCALLBACKA;
hRoot = TreeView_InsertItemA(hTree, &ins);
assert(hRoot);
ok(hRoot != NULL, "failed to set root\n");
tvi.hItem = hRoot;
tvi.mask = TVIF_TEXT;
@ -406,7 +405,7 @@ static void test_callback(void)
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = test_string;
hItem1 = TreeView_InsertItemA(hTree, &ins);
assert(hItem1);
ok(hItem1 != NULL, "failed to set Item1\n");
tvi.hItem = hItem1;
ret = TreeView_GetItemA(hTree, &tvi);
@ -426,7 +425,7 @@ static void test_callback(void)
U(ins).item.pszText = NULL;
hItem2 = TreeView_InsertItemA(hTree, &ins);
assert(hItem2);
ok(hItem2 != NULL, "failed to set Item2\n");
tvi.hItem = hItem2;
memset(buf, 0, sizeof(buf));
ret = TreeView_GetItemA(hTree, &tvi);
@ -588,7 +587,7 @@ static void test_getitemtext(void)
U(ins).item.pszText = NULL;
U(ins).item.cchTextMax = 0;
hChild = TreeView_InsertItemA(hTree, &ins);
assert(hChild);
ok(hChild != NULL, "failed to set hChild\n");
/* retrieve it with TVIF_TEXT mask */
tvi.hItem = hChild;
@ -628,12 +627,12 @@ static void test_focus(void)
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = child1;
hChild1 = TreeView_InsertItemA(hTree, &ins);
assert(hChild1);
ok(hChild1 != NULL, "failed to set hChild1\n");
ins.hInsertAfter = hChild1;
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = child2;
hChild2 = TreeView_InsertItemA(hTree, &ins);
assert(hChild2);
ok(hChild2 != NULL, "failed to set hChild2\n");
ShowWindow(hMainWnd,SW_SHOW);
SendMessageA(hTree, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hChild);
@ -1196,7 +1195,7 @@ static void test_expandinvisible(void)
U(ins).item.mask = TVIF_TEXT;
U(ins).item.pszText = nodeText[0];
node[0] = TreeView_InsertItemA(hTree, &ins);
assert(node[0]);
ok(node[0] != NULL, "failed to set node[0]\n");
ins.hInsertAfter = TVI_LAST;
U(ins).item.mask = TVIF_TEXT;
@ -1204,20 +1203,19 @@ static void test_expandinvisible(void)
U(ins).item.pszText = nodeText[1];
node[1] = TreeView_InsertItemA(hTree, &ins);
assert(node[1]);
ok(node[1] != NULL, "failed to set node[1]\n");
U(ins).item.pszText = nodeText[4];
node[4] = TreeView_InsertItemA(hTree, &ins);
assert(node[4]);
ok(node[4] != NULL, "failed to set node[4]\n");
ins.hParent = node[1];
U(ins).item.pszText = nodeText[2];
node[2] = TreeView_InsertItemA(hTree, &ins);
assert(node[2]);
ok(node[2] != NULL, "failed to set node[2]\n");
U(ins).item.pszText = nodeText[3];
node[3] = TreeView_InsertItemA(hTree, &ins);
assert(node[3]);
ok(node[3] != NULL, "failed to set node[3]\n");
*(HTREEITEM *)&dummyRect = node[1];
nodeVisible = SendMessageA(hTree, TVM_GETITEMRECT, FALSE, (LPARAM)&dummyRect);