Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
0f7b48b8
Commit
0f7b48b8
authored
Apr 21, 2002
by
Mike McCormack
Committed by
Alexandre Julliard
Apr 21, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a simple test set for window classes.
parent
e80b028d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
0 deletions
+195
-0
Makefile.in
dlls/user/Makefile.in
+1
-0
.cvsignore
dlls/user/tests/.cvsignore
+1
-0
class.c
dlls/user/tests/class.c
+192
-0
user32_test.spec
dlls/user/tests/user32_test.spec
+1
-0
No files found.
dlls/user/Makefile.in
View file @
0f7b48b8
...
...
@@ -59,6 +59,7 @@ EXTRASUBDIRS = \
tests
CTESTS
=
\
tests/class.c
\
tests/sysparams.c
@MAKE_DLL_RULES@
...
...
dlls/user/tests/.cvsignore
View file @
0f7b48b8
class.ok
sysparams.ok
testlist.c
user32_test.spec.c
dlls/user/tests/class.c
0 → 100644
View file @
0f7b48b8
/* 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 <assert.h>
#include <stdlib.h>
#include <stdio.h>
#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
<
NUMCLASSWORDS
;
i
++
)
{
SetLastError
(
0
);
ok
(
!
GetClassLongW
(
hTestWnd
,
i
*
sizeof
(
DWORD
)),
"GetClassLongW initial value nonzero!"
);
ok
(
!
GetLastError
(),
"GetClassLongW failed!"
);
}
#if 0
/*
* GetClassLongW(hTestWnd, NUMCLASSWORDS*sizeof(DWORD))
* does not fail on Win 98, though MSDN says it should
*/
SetLastError(0);
GetClassLongW(hTestWnd, NUMCLASSWORDS*sizeof(DWORD));
ok(GetLastError(),
"GetClassLongW() with invalid offset did not fail");
#endif
/* set values of valid class words */
for
(
i
=
0
;
i
<
NUMCLASSWORDS
;
i
++
)
{
SetLastError
(
0
);
ok
(
!
SetClassLongW
(
hTestWnd
,
i
*
sizeof
(
DWORD
),
i
+
1
),
"GetClassLongW(%d) initial value nonzero!"
);
ok
(
!
GetLastError
(),
"SetClassLongW(%d) failed!"
);
}
/* test values of valid classwords that we set */
for
(
i
=
0
;
i
<
NUMCLASSWORDS
;
i
++
)
{
SetLastError
(
0
);
ok
(
(
i
+
1
)
==
GetClassLongW
(
hTestWnd
,
i
*
sizeof
(
DWORD
)),
"GetClassLongW value doesn't match what was set!"
);
ok
(
!
GetLastError
(),
"GetClassLongW failed!"
);
}
/* check GetClassName */
i
=
GetClassNameW
(
hTestWnd
,
str
,
sizeof
str
);
ok
(
i
==
lstrlenW
(
className
),
"GetClassName returned incorrect length"
);
ok
(
!
lstrcmpW
(
className
,
str
),
"GetClassName returned incorrect name for this window's class"
);
/* check GetClassInfo with our hInstance */
if
(
GetClassInfoW
(
hInstance
,
str
,
&
wc
))
{
ok
(
wc
.
cbClsExtra
==
cls
.
cbClsExtra
,
"cbClsExtra did not match"
);
ok
(
wc
.
cbWndExtra
==
cls
.
cbWndExtra
,
"cbWndExtra did not match"
);
ok
(
wc
.
hbrBackground
==
cls
.
hbrBackground
,
"hbrBackground did not match"
);
ok
(
wc
.
hCursor
==
cls
.
hCursor
,
"hCursor did not match"
);
ok
(
wc
.
hInstance
==
cls
.
hInstance
,
"hInstance did not match"
);
}
else
ok
(
FALSE
,
"GetClassInfo (hinstance) failed!"
);
/* check GetClassInfo with zero hInstance */
if
(
global
)
{
if
(
GetClassInfoW
(
0
,
str
,
&
wc
))
{
ok
(
wc
.
cbClsExtra
==
cls
.
cbClsExtra
,
"cbClsExtra did not match %x!=%x"
);
ok
(
wc
.
cbWndExtra
==
cls
.
cbWndExtra
,
"cbWndExtra did not match %x!=%x"
);
ok
(
wc
.
hbrBackground
==
cls
.
hbrBackground
,
"hbrBackground did not match %x!=%x"
);
ok
(
wc
.
hCursor
==
cls
.
hCursor
,
"hCursor did not match %x!=%x"
);
ok
(
!
wc
.
hInstance
,
"hInstance not zero for global class %x"
);
}
else
ok
(
FALSE
,
"GetClassInfo (0) failed for global class!"
);
}
else
{
ok
(
!
GetClassInfoW
(
0
,
str
,
&
wc
),
"GetClassInfo (0) succeeded for local class!"
);
}
ok
(
!
UnregisterClassW
(
className
,
hInstance
),
"Unregister class succeeded with window existing"
);
ok
(
DestroyWindow
(
hTestWnd
),
"DestroyWindow() failed!"
);
ok
(
UnregisterClassW
(
className
,
hInstance
),
"UnregisterClass() failed"
);
return
TRUE
;
}
START_TEST
(
class
)
{
HANDLE
hInstance
=
GetModuleHandleA
(
NULL
);
ClassTest
(
hInstance
,
FALSE
);
ClassTest
(
hInstance
,
TRUE
);
}
dlls/user/tests/user32_test.spec
View file @
0f7b48b8
...
...
@@ -3,6 +3,7 @@ type win32
mode cuiexe
import user32.dll
import gdi32.dll
import advapi32.dll
import kernel32.dll
import ntdll.dll
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment