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
95ebdc63
Commit
95ebdc63
authored
Apr 14, 2005
by
Robert Shearman
Committed by
Alexandre Julliard
Apr 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for a menu problem I found.
parent
cec9e23c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
111 additions
and
0 deletions
+111
-0
.cvsignore
dlls/user/tests/.cvsignore
+1
-0
Makefile.in
dlls/user/tests/Makefile.in
+1
-0
menu.c
dlls/user/tests/menu.c
+109
-0
No files found.
dlls/user/tests/.cvsignore
View file @
95ebdc63
...
...
@@ -8,6 +8,7 @@ edit.ok
generated.ok
input.ok
listbox.ok
menu.ok
msg.ok
resource.ok
resource.res
...
...
dlls/user/tests/Makefile.in
View file @
95ebdc63
...
...
@@ -15,6 +15,7 @@ CTESTS = \
generated.c
\
input.c
\
listbox.c
\
menu.c
\
msg.c
\
resource.c
\
sysparams.c
\
...
...
dlls/user/tests/menu.c
0 → 100644
View file @
95ebdc63
/*
* Unit tests for menus
*
* Copyright 2005 Robert Shearman
*
* 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
*/
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
#include <stdlib.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/test.h"
static
ATOM
atomMenuCheckClass
;
static
LRESULT
WINAPI
menu_check_wnd_proc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wparam
,
LPARAM
lparam
)
{
switch
(
msg
)
{
case
WM_ENTERMENULOOP
:
/* mark window as having entered menu loop */
SetWindowLongPtr
(
hwnd
,
GWLP_USERDATA
,
TRUE
);
/* exit menu modal loop */
return
SendMessage
(
hwnd
,
WM_CANCELMODE
,
0
,
0
);
}
return
DefWindowProc
(
hwnd
,
msg
,
wparam
,
lparam
);
}
static
void
register_menu_check_class
(
void
)
{
WNDCLASS
wc
=
{
0
,
menu_check_wnd_proc
,
0
,
0
,
GetModuleHandle
(
NULL
),
NULL
,
LoadCursor
(
NULL
,
IDC_ARROW
),
(
HBRUSH
)(
COLOR_BTNFACE
+
1
),
NULL
,
TEXT
(
"WineMenuCheck"
),
};
atomMenuCheckClass
=
RegisterClass
(
&
wc
);
}
/* demonstrates that windows lock the menu object so that it is still valid
* even after a client calls DestroyMenu on it */
static
void
test_menu_locked_by_window
()
{
BOOL
ret
;
HMENU
hmenu
;
HWND
hwnd
=
CreateWindowEx
(
0
,
MAKEINTATOM
(
atomMenuCheckClass
),
NULL
,
WS_VISIBLE
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
CW_USEDEFAULT
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hwnd
!=
NULL
,
"CreateWindowEx failed with error %ld
\n
"
,
GetLastError
());
hmenu
=
CreateMenu
();
ok
(
hmenu
!=
NULL
,
"CreateMenu failed with error %ld
\n
"
,
GetLastError
());
ret
=
InsertMenu
(
hmenu
,
0
,
MF_STRING
,
0
,
TEXT
(
"&Test"
));
ok
(
ret
,
"InsertMenu failed with error %ld
\n
"
,
GetLastError
());
ret
=
SetMenu
(
hwnd
,
hmenu
);
ok
(
ret
,
"SetMenu failed with error %ld
\n
"
,
GetLastError
());
ret
=
DestroyMenu
(
hmenu
);
ok
(
ret
,
"DestroyMenu failed with error %ld
\n
"
,
GetLastError
());
ret
=
DrawMenuBar
(
hwnd
);
todo_wine
{
ok
(
ret
,
"DrawMenuBar failed with error %ld
\n
"
,
GetLastError
());
}
ret
=
IsMenu
(
GetMenu
(
hwnd
));
ok
(
!
ret
,
"Menu handle should have been destroyed
\n
"
);
SendMessage
(
hwnd
,
WM_SYSCOMMAND
,
SC_KEYMENU
,
0
);
/* did we process the WM_INITMENU message? */
ret
=
GetWindowLongPtr
(
hwnd
,
GWLP_USERDATA
);
todo_wine
{
ok
(
ret
,
"WM_INITMENU should have been sent
\n
"
);
}
DestroyWindow
(
hwnd
);
}
START_TEST
(
menu
)
{
register_menu_check_class
();
test_menu_locked_by_window
();
}
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