From 0f7b48b890ee3fc71735307fb7cfd66f01025397 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Sun, 21 Apr 2002 22:05:42 +0000 Subject: [PATCH] Added a simple test set for window classes. --- dlls/user/Makefile.in | 1 + dlls/user/tests/.cvsignore | 1 + dlls/user/tests/class.c | 192 +++++++++++++++++++++++++++++++++++++++ dlls/user/tests/user32_test.spec | 1 + 4 files changed, 195 insertions(+) create mode 100644 dlls/user/tests/class.c diff --git a/dlls/user/Makefile.in b/dlls/user/Makefile.in index f23b445d3a1..f74ea2c472c 100644 --- a/dlls/user/Makefile.in +++ b/dlls/user/Makefile.in @@ -59,6 +59,7 @@ EXTRASUBDIRS = \ tests CTESTS = \ + tests/class.c \ tests/sysparams.c @MAKE_DLL_RULES@ diff --git a/dlls/user/tests/.cvsignore b/dlls/user/tests/.cvsignore index 91a7127a9ec..dab699bf6ca 100644 --- a/dlls/user/tests/.cvsignore +++ b/dlls/user/tests/.cvsignore @@ -1,3 +1,4 @@ +class.ok sysparams.ok testlist.c user32_test.spec.c diff --git a/dlls/user/tests/class.c b/dlls/user/tests/class.c new file mode 100644 index 00000000000..d964750080a --- /dev/null +++ b/dlls/user/tests/class.c @@ -0,0 +1,192 @@ +/* Unit test suite for window classes. + * + * Copyright 2002 Mike McCormack + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include +#include "winbase.h" +#include "winreg.h" +#include "wingdi.h" +#include "winuser.h" +#include "wine/test.h" + +#define NUMCLASSWORDS 4 + +LRESULT WINAPI ClassTest_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + return DefWindowProcW (hWnd, msg, wParam, lParam); +} + +/*********************************************************************** + * + * WinMain + */ +BOOL ClassTest(HINSTANCE hInstance, BOOL global) +{ + WNDCLASSW cls, wc; + WCHAR className[] = {'T','e','s','t','C','l','a','s','s',0}; + WCHAR winName[] = {'W','i','n','C','l','a','s','s','T','e','s','t',0}; + HWND hTestWnd; + DWORD i; + WCHAR str[20]; + + cls.style = CS_HREDRAW | CS_VREDRAW | (global?CS_GLOBALCLASS:0); + cls.lpfnWndProc = ClassTest_WndProc; + cls.cbClsExtra = NUMCLASSWORDS*sizeof(DWORD); + cls.cbWndExtra = 12; + cls.hInstance = hInstance; + cls.hIcon = LoadIconW (0, IDI_APPLICATIONW); + cls.hCursor = LoadCursorW (0, IDC_ARROWW); + cls.hbrBackground = GetStockObject (WHITE_BRUSH); + cls.lpszMenuName = 0; + cls.lpszClassName = className; + + ok(RegisterClassW (&cls) , + "failed to register class"); + + ok(!RegisterClassW (&cls), + "RegisterClass of the same class should fail for the second time"); + +#if 0 + /* these succeeds on Wine, but shouldn't cause any trouble ... */ + ok(!GlobalFindAtomW(className), + "Found class as global atom"); + + ok(!FindAtomW(className), + "Found class as global atom"); +#endif + + /* Setup windows */ + hTestWnd = CreateWindowW (className, winName, + WS_OVERLAPPEDWINDOW + WS_HSCROLL + WS_VSCROLL, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, + 0, hInstance, 0); + + ok(hTestWnd, + "Failed to create window"); + + /* test initial values of valid classwords */ + for(i=0; i