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
34015b93
Commit
34015b93
authored
May 15, 2007
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
May 15, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add a test for the menu resource loader, make it pass under Wine.
parent
7f189ecc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
2 deletions
+86
-2
menu.c
dlls/user32/menu.c
+2
-0
menu.c
dlls/user32/tests/menu.c
+84
-2
No files found.
dlls/user32/menu.c
View file @
34015b93
...
...
@@ -2032,6 +2032,8 @@ static BOOL MENU_SetItemData( MENUITEM *item, UINT flags, UINT_PTR id,
item
->
text
=
NULL
;
}
if
(
flags
&
MF_SEPARATOR
)
flags
|=
MF_GRAYED
|
MF_DISABLED
;
if
(
flags
&
MF_OWNERDRAW
)
item
->
dwItemData
=
(
DWORD_PTR
)
str
;
else
...
...
dlls/user32/tests/menu.c
View file @
34015b93
...
...
@@ -1914,9 +1914,7 @@ static void check_menu_items(HMENU hmenu, UINT checked_cmd, UINT checked_type,
if
(
mii
.
fType
==
MFT_SEPARATOR
)
{
todo_wine
{
ok
(
mii
.
fState
==
MFS_GRAYED
,
"id %u: expected fState MFS_GRAYED, got %04x
\n
"
,
checked_cmd
,
mii
.
fState
);
}
ok
(
mii
.
wID
==
0
,
"id %u: expected wID 0, got %u
\n
"
,
checked_cmd
,
mii
.
wID
);
}
else
...
...
@@ -1988,6 +1986,89 @@ static void test_CheckMenuRadioItem(void)
check_menu_items
(
hmenu
,
-
1
,
0
,
0
);
}
static
void
test_menu_resource_layout
(
void
)
{
static
const
struct
{
MENUITEMTEMPLATEHEADER
mith
;
WORD
data
[];
}
menu_template
=
{
{
0
,
0
},
/* versionNumber, offset */
{
/* mtOption, mtID, mtString[] '\0' terminated */
MF_STRING
,
1
,
'F'
,
0
,
MF_STRING
,
2
,
0
,
MF_SEPARATOR
,
3
,
0
,
/* MF_SEPARATOR, 4, 'S', 0, FIXME: Wine ignores 'S' */
MF_STRING
|
MF_GRAYED
|
MF_END
,
5
,
'E'
,
0
}
};
static
const
struct
{
UINT
type
,
state
,
id
;
const
char
*
str
;
}
menu_data
[]
=
{
{
MF_STRING
,
MF_ENABLED
,
1
,
"F"
},
{
MF_SEPARATOR
,
MF_GRAYED
|
MF_DISABLED
,
2
,
""
},
{
MF_SEPARATOR
,
MF_GRAYED
|
MF_DISABLED
,
3
,
""
},
/*{ MF_SEPARATOR, MF_GRAYED|MF_DISABLED, 4, "S" }, FIXME: Wine ignores 'S'*/
{
MF_STRING
,
MF_GRAYED
,
5
,
"E"
},
{
MF_SEPARATOR
,
MF_GRAYED
|
MF_DISABLED
,
6
,
""
},
{
MF_STRING
,
MF_ENABLED
,
7
,
""
},
{
MF_SEPARATOR
,
MF_GRAYED
|
MF_DISABLED
,
8
,
""
}
};
HMENU
hmenu
;
UINT
count
,
i
;
BOOL
ret
;
hmenu
=
LoadMenuIndirect
(
&
menu_template
);
ok
(
hmenu
!=
0
,
"LoadMenuIndirect error %u
\n
"
,
GetLastError
());
ret
=
AppendMenu
(
hmenu
,
MF_STRING
,
6
,
NULL
);
ok
(
ret
,
"AppendMenu failed
\n
"
);
ret
=
AppendMenu
(
hmenu
,
MF_STRING
,
7
,
"
\0
"
);
ok
(
ret
,
"AppendMenu failed
\n
"
);
ret
=
AppendMenu
(
hmenu
,
MF_SEPARATOR
,
8
,
"separator"
);
ok
(
ret
,
"AppendMenu failed
\n
"
);
count
=
GetMenuItemCount
(
hmenu
);
ok
(
count
==
sizeof
(
menu_data
)
/
sizeof
(
menu_data
[
0
]),
"expected %u menu items, got %u
\n
"
,
(
UINT
)
sizeof
(
menu_data
)
/
sizeof
(
menu_data
[
0
]),
count
);
for
(
i
=
0
;
i
<
count
;
i
++
)
{
char
buf
[
20
];
MENUITEMINFO
mii
;
memset
(
&
mii
,
0
,
sizeof
(
mii
));
mii
.
cbSize
=
sizeof
(
mii
);
mii
.
dwTypeData
=
buf
;
mii
.
cch
=
sizeof
(
buf
);
mii
.
fMask
=
MIIM_FTYPE
|
MIIM_STATE
|
MIIM_ID
|
MIIM_STRING
;
ret
=
GetMenuItemInfo
(
hmenu
,
i
,
TRUE
,
&
mii
);
ok
(
ret
,
"GetMenuItemInfo(%u) failed
\n
"
,
i
);
#if 0
trace("item #%u: fType %04x, fState %04x, wID %u, dwTypeData %s\n",
i, mii.fType, mii.fState, mii.wID, (LPCSTR)mii.dwTypeData);
#endif
ok
(
mii
.
fType
==
menu_data
[
i
].
type
,
"%u: expected fType %04x, got %04x
\n
"
,
i
,
menu_data
[
i
].
type
,
mii
.
fType
);
ok
(
mii
.
fState
==
menu_data
[
i
].
state
,
"%u: expected fState %04x, got %04x
\n
"
,
i
,
menu_data
[
i
].
state
,
mii
.
fState
);
ok
(
mii
.
wID
==
menu_data
[
i
].
id
,
"%u: expected wID %04x, got %04x
\n
"
,
i
,
menu_data
[
i
].
id
,
mii
.
wID
);
ok
(
mii
.
cch
==
strlen
(
menu_data
[
i
].
str
),
"%u: expected cch %u, got %u
\n
"
,
i
,
(
UINT
)
strlen
(
menu_data
[
i
].
str
),
mii
.
cch
);
ok
(
!
strcmp
((
LPCSTR
)
mii
.
dwTypeData
,
menu_data
[
i
].
str
),
"%u: expected dwTypeData %s, got %s
\n
"
,
i
,
menu_data
[
i
].
str
,
(
LPCSTR
)
mii
.
dwTypeData
);
}
DestroyMenu
(
hmenu
);
}
START_TEST
(
menu
)
{
pSetMenuInfo
=
...
...
@@ -2007,4 +2088,5 @@ START_TEST(menu)
test_menu_flags
();
test_menu_hilitemenuitem
();
test_CheckMenuRadioItem
();
test_menu_resource_layout
();
}
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