Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
2cab7ff2
Commit
2cab7ff2
authored
Mar 17, 2008
by
Reece Dunn
Committed by
Alexandre Julliard
Mar 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Improve the HiliteMenuItem tests so they reflect actual behaviour on Windows.
parent
d5de9977
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
9 deletions
+94
-9
menu.c
dlls/user32/tests/menu.c
+94
-9
No files found.
dlls/user32/tests/menu.c
View file @
2cab7ff2
...
...
@@ -1864,6 +1864,23 @@ static void test_menu_flags( void )
static
void
test_menu_hilitemenuitem
(
void
)
{
HMENU
hMenu
,
hPopupMenu
;
WNDCLASSA
wclass
;
HWND
hWnd
;
wclass
.
lpszClassName
=
"HiliteMenuTestClass"
;
wclass
.
style
=
CS_HREDRAW
|
CS_VREDRAW
;
wclass
.
lpfnWndProc
=
WndProc
;
wclass
.
hInstance
=
GetModuleHandleA
(
NULL
);
wclass
.
hIcon
=
LoadIconA
(
0
,
(
LPSTR
)
IDI_APPLICATION
);
wclass
.
hCursor
=
LoadCursorA
(
NULL
,
(
LPSTR
)
IDC_ARROW
);
wclass
.
hbrBackground
=
(
HBRUSH
)(
COLOR_WINDOW
+
1
);
wclass
.
lpszMenuName
=
0
;
wclass
.
cbClsExtra
=
0
;
wclass
.
cbWndExtra
=
0
;
assert
(
RegisterClassA
(
&
wclass
));
assert
(
hWnd
=
CreateWindowA
(
wclass
.
lpszClassName
,
"HiliteMenuTest"
,
WS_OVERLAPPEDWINDOW
,
CW_USEDEFAULT
,
0
,
400
,
200
,
NULL
,
NULL
,
wclass
.
hInstance
,
NULL
)
);
hMenu
=
CreateMenu
();
hPopupMenu
=
CreatePopupMenu
();
...
...
@@ -1874,40 +1891,108 @@ static void test_menu_hilitemenuitem( void )
AppendMenu
(
hPopupMenu
,
MF_STRING
,
102
,
"Item 2"
);
AppendMenu
(
hPopupMenu
,
MF_STRING
,
103
,
"Item 3"
);
SetMenu
(
hWnd
,
hMenu
);
/* test invalid arguments */
ok
(
!
(
GetMenuState
(
hPopupMenu
,
1
,
MF_BYPOSITION
)
&
MF_HILITE
),
"HiliteMenuItem: Item 2 is hilited
\n
"
);
SetLastError
(
0xdeadbeef
);
ok
(
!
HiliteMenuItem
(
NULL
,
hPopupMenu
,
1
,
MF_HILITE
),
"HiliteMenuItem: call should have failed.
\n
"
);
todo_wine
{
ok
(
!
HiliteMenuItem
(
NULL
,
hPopupMenu
,
1
,
MF_HILITE
|
MF_BYPOSITION
),
"HiliteMenuItem: call should have failed.
\n
"
);
ok
(
GetLastError
()
==
ERROR_INVALID_WINDOW_HANDLE
,
"HiliteMenuItem: expected error ERROR_INVALID_WINDOW_HANDLE, got: %d
\n
"
,
GetLastError
());
}
SetLastError
(
0xdeadbeef
);
ok
(
!
HiliteMenuItem
(
hWnd
,
NULL
,
1
,
MF_HILITE
|
MF_BYPOSITION
),
"HiliteMenuItem: call should have failed.
\n
"
);
todo_wine
{
ok
(
GetLastError
()
==
ERROR_INVALID_MENU_HANDLE
,
"HiliteMenuItem: expected error ERROR_INVALID_MENU_HANDLE, got: %d
\n
"
,
GetLastError
());
}
ok
(
!
(
GetMenuState
(
hPopupMenu
,
1
,
MF_BYPOSITION
)
&
MF_HILITE
),
"HiliteMenuItem: Item 2 is hilited
\n
"
);
HiliteMenuItem
(
NULL
,
hPopupMenu
,
0
,
MF_HILITE
);
HiliteMenuItem
(
NULL
,
hPopupMenu
,
1
,
MF_HILITE
);
HiliteMenuItem
(
NULL
,
hPopupMenu
,
2
,
MF_HILITE
);
HiliteMenuItem
(
NULL
,
hPopupMenu
,
1
,
MF_UNHILITE
);
/* either MF_HILITE or MF_UNHILITE *and* MF_BYCOMMAND or MF_BYPOSITION need to be set */
SetLastError
(
0xdeadbeef
);
ok
(
HiliteMenuItem
(
hWnd
,
hPopupMenu
,
1
,
MF_BYPOSITION
),
"HiliteMenuItem: call should have succeeded.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"HiliteMenuItem: expected error 0xdeadbeef, got: %d
\n
"
,
GetLastError
());
ok
(
!
(
GetMenuState
(
hPopupMenu
,
1
,
MF_BYPOSITION
)
&
MF_HILITE
),
"HiliteMenuItem: Item 2 is hilited
\n
"
);
SetLastError
(
0xdeadbeef
);
todo_wine
{
ok
(
GetMenuState
(
hPopupMenu
,
0
,
MF_BYPOSITION
)
&
MF_HILITE
,
"HiliteMenuItem:
Item 1 is not hilited
\n
"
);
ok
(
HiliteMenuItem
(
hWnd
,
hPopupMenu
,
1
,
MF_HILITE
)
,
"HiliteMenuItem:
call should have succeeded.
\n
"
);
}
ok
(
GetLastError
()
==
0xdeadbeef
,
"HiliteMenuItem: expected error 0xdeadbeef, got: %d
\n
"
,
GetLastError
());
ok
(
!
(
GetMenuState
(
hPopupMenu
,
1
,
MF_BYPOSITION
)
&
MF_HILITE
),
"HiliteMenuItem: Item 2 is hilited
\n
"
);
/* hilite a menu item (by position) */
SetLastError
(
0xdeadbeef
);
ok
(
HiliteMenuItem
(
hWnd
,
hPopupMenu
,
1
,
MF_HILITE
|
MF_BYPOSITION
),
"HiliteMenuItem: call should not have failed.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"HiliteMenuItem: expected error 0xdeadbeef, got: %d
\n
"
,
GetLastError
());
todo_wine
{
ok
(
GetMenuState
(
hPopupMenu
,
1
,
MF_BYPOSITION
)
&
MF_HILITE
,
"HiliteMenuItem: Item 2 is not hilited
\n
"
);
}
/* unhilite a menu item (by position) */
SetLastError
(
0xdeadbeef
);
ok
(
HiliteMenuItem
(
hWnd
,
hPopupMenu
,
1
,
MF_UNHILITE
|
MF_BYPOSITION
),
"HiliteMenuItem: call should not have failed.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"HiliteMenuItem: expected error 0xdeadbeef, got: %d
\n
"
,
GetLastError
());
ok
(
!
(
GetMenuState
(
hPopupMenu
,
1
,
MF_BYPOSITION
)
&
MF_HILITE
),
"HiliteMenuItem: Item 2 is hilited
\n
"
);
/* hilite a menu item (by command) */
SetLastError
(
0xdeadbeef
);
ok
(
HiliteMenuItem
(
hWnd
,
hPopupMenu
,
103
,
MF_HILITE
|
MF_BYCOMMAND
),
"HiliteMenuItem: call should not have failed.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"HiliteMenuItem: expected error 0xdeadbeef, got: %d
\n
"
,
GetLastError
());
todo_wine
{
ok
(
GetMenuState
(
hPopupMenu
,
2
,
MF_BYPOSITION
)
&
MF_HILITE
,
"HiliteMenuItem: Item 3 is not hilited
\n
"
);
}
DestroyMenu
(
hMenu
);
/* unhilite a menu item (by command) */
SetLastError
(
0xdeadbeef
);
ok
(
HiliteMenuItem
(
hWnd
,
hPopupMenu
,
103
,
MF_UNHILITE
|
MF_BYCOMMAND
),
"HiliteMenuItem: call should not have failed.
\n
"
);
ok
(
GetLastError
()
==
0xdeadbeef
,
"HiliteMenuItem: expected error 0xdeadbeef, got: %d
\n
"
,
GetLastError
());
ok
(
!
(
GetMenuState
(
hPopupMenu
,
2
,
MF_BYPOSITION
)
&
MF_HILITE
),
"HiliteMenuItem: Item 3 is hilited
\n
"
);
DestroyWindow
(
hWnd
);
}
static
void
check_menu_items
(
HMENU
hmenu
,
UINT
checked_cmd
,
UINT
checked_type
,
...
...
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