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
e7cc2f76
Commit
e7cc2f76
authored
Apr 28, 2011
by
André Hentschel
Committed by
Alexandre Julliard
Apr 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shell32: Add some selection tests.
parent
e556b45f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
0 deletions
+93
-0
brsfolder.c
dlls/shell32/tests/brsfolder.c
+93
-0
No files found.
dlls/shell32/tests/brsfolder.c
View file @
e7cc2f76
...
...
@@ -2,6 +2,7 @@
* Unit test of the SHBrowseForFolder function.
*
* Copyright 2009-2010 Michael Mc Donnell
* Copyright 2011 André Hentschel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -27,6 +28,7 @@
#define TIMER_WAIT_MS 50
/* Should be long enough for slow systems */
static
const
char
new_folder_name
[]
=
"foo"
;
static
LPITEMIDLIST
selected_folder_pidl
;
/*
* Returns the number of folders in a folder.
...
...
@@ -247,7 +249,98 @@ static void test_click_make_new_folder_button(void)
CoUninitialize
();
}
/*
* Callback used by test_selection.
*/
static
int
CALLBACK
selection_callback
(
HWND
hwnd
,
UINT
uMsg
,
LPARAM
lParam
,
LPARAM
lpData
)
{
DWORD
ret
;
switch
(
uMsg
)
{
case
BFFM_INITIALIZED
:
/* test with zero values */
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONA
,
0
,
0
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONW
,
0
,
0
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONA
,
1
,
0
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
if
(
0
)
{
/* Crashes on NT4 */
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONW
,
1
,
0
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
}
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONA
,
0
,
(
LPARAM
)
selected_folder_pidl
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONW
,
0
,
(
LPARAM
)
selected_folder_pidl
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONA
,
1
,
(
LPARAM
)
selected_folder_pidl
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONW
,
1
,
(
LPARAM
)
selected_folder_pidl
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONA
,
1
,
(
LPARAM
)
new_folder_name
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
ret
=
SendMessage
(
hwnd
,
BFFM_SETSELECTIONW
,
1
,
(
LPARAM
)
new_folder_name
);
ok
(
!
ret
,
"SendMessage returned: %u
\n
"
,
ret
);
SendMessage
(
hwnd
,
WM_COMMAND
,
IDOK
,
0
);
return
TRUE
;
default:
return
FALSE
;
}
}
static
void
test_selection
(
void
)
{
HRESULT
resCoInit
;
BROWSEINFO
bi
;
LPITEMIDLIST
pidl
=
NULL
;
IShellFolder
*
desktop_object
;
WCHAR
selected_folderW
[
MAX_PATH
];
const
CHAR
title
[]
=
"test_selection"
;
resCoInit
=
CoInitialize
(
NULL
);
if
(
!
(
resCoInit
==
S_OK
||
resCoInit
==
S_FALSE
))
{
skip
(
"COM could not be initialized %u
\n
"
,
GetLastError
());
return
;
}
if
(
!
GetCurrentDirectoryW
(
MAX_PATH
,
selected_folderW
))
{
skip
(
"GetCurrentDirectoryW failed %u
\n
"
,
GetLastError
());
}
/* Initialize browse info struct for SHBrowseForFolder */
bi
.
hwndOwner
=
NULL
;
bi
.
pszDisplayName
=
NULL
;
bi
.
lpszTitle
=
(
LPTSTR
)
title
;
bi
.
ulFlags
=
BIF_NEWDIALOGSTYLE
;
bi
.
lpfn
=
selection_callback
;
SHGetDesktopFolder
(
&
desktop_object
);
desktop_object
->
lpVtbl
->
ParseDisplayName
(
desktop_object
,
NULL
,
NULL
,
selected_folderW
,
0UL
,
&
selected_folder_pidl
,
0UL
);
bi
.
pidlRoot
=
selected_folder_pidl
;
pidl
=
SHBrowseForFolder
(
&
bi
);
if
(
pidl
)
CoTaskMemFree
(
pidl
);
CoUninitialize
();
}
START_TEST
(
brsfolder
)
{
test_click_make_new_folder_button
();
test_selection
();
}
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