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
92032e6e
Commit
92032e6e
authored
Nov 03, 2005
by
Michael Jung
Committed by
Alexandre Julliard
Nov 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some more unit tests for FolderShortcut objects.
parent
6ed28ada
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
8 deletions
+93
-8
shlfolder.c
dlls/shell32/tests/shlfolder.c
+93
-8
No files found.
dlls/shell32/tests/shlfolder.c
View file @
92032e6e
...
...
@@ -805,9 +805,14 @@ static HRESULT WINAPI InitPropertyBag_IPropertyBag_Read(IPropertyBag *iface, LPC
static
const
WCHAR
wszResolveLinkFlags
[]
=
{
'R'
,
'e'
,
's'
,
'o'
,
'l'
,
'v'
,
'e'
,
'L'
,
'i'
,
'n'
,
'k'
,
'F'
,
'l'
,
'a'
,
'g'
,
's'
,
0
};
if
(
!
lstrcmpW
(
pszPropName
,
wszTargetSpecialFolder
)
||
!
lstrcmpW
(
pszPropName
,
wszResolveLinkFlags
))
if
(
!
lstrcmpW
(
pszPropName
,
wszTargetSpecialFolder
))
{
ok
(
V_VT
(
pVar
)
==
VT_I4
,
"Wrong variant type for 'TargetSpecialFolder' property!
\n
"
);
return
E_INVALIDARG
;
}
if
(
!
lstrcmpW
(
pszPropName
,
wszResolveLinkFlags
))
{
ok
(
V_VT
(
pVar
)
==
VT_UI4
,
"Wrong variant type for 'ResolveLinkFlags' property!
\n
"
);
return
E_INVALIDARG
;
}
...
...
@@ -859,14 +864,18 @@ struct IPropertyBag InitPropertyBag = {
void
test_FolderShortcut
(
void
)
{
IPersistPropertyBag
*
pPersistPropertyBag
;
IShellFolder
*
pShellFolder
;
IShellFolder
*
pShellFolder
,
*
pDesktopFolder
;
IPersistFolder3
*
pPersistFolder3
;
HRESULT
hr
;
STRRET
strret
;
WCHAR
wszPath
[
MAX_PATH
],
wszBuffer
[
MAX_PATH
];
WCHAR
wsz
Desktop
Path
[
MAX_PATH
],
wszBuffer
[
MAX_PATH
];
BOOL
result
;
CLSID
clsid
;
LPITEMIDLIST
pidlCurrentFolder
;
LPITEMIDLIST
pidlCurrentFolder
,
pidlWineTestFolder
,
pidlSubFolder
;
WCHAR
wszWineTestFolder
[]
=
{
':'
,
':'
,
'{'
,
'9'
,
'B'
,
'3'
,
'5'
,
'2'
,
'E'
,
'B'
,
'F'
,
'-'
,
'2'
,
'7'
,
'6'
,
'5'
,
'-'
,
'4'
,
'5'
,
'C'
,
'1'
,
'-'
,
'B'
,
'4'
,
'C'
,
'6'
,
'-'
,
'8'
,
'5'
,
'C'
,
'C'
,
'7'
,
'F'
,
'7'
,
'A'
,
'B'
,
'C'
,
'6'
,
'4'
,
'}'
,
0
};
WCHAR
wszSomeSubFolder
[]
=
{
'S'
,
'u'
,
'b'
,
'F'
,
'o'
,
'l'
,
'd'
,
'e'
,
'r'
,
0
};
if
(
!
pSHGetSpecialFolderPathW
||
!
pStrRetToBufW
)
return
;
...
...
@@ -899,12 +908,12 @@ void test_FolderShortcut(void) {
return
;
}
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wszPath
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_
MYDOCUMENTS
) failed! 0x%08lx
\n
"
,
GetLastError
());
result
=
pSHGetSpecialFolderPathW
(
NULL
,
wsz
Desktop
Path
,
CSIDL_DESKTOPDIRECTORY
,
FALSE
);
ok
(
result
,
"SHGetSpecialFolderPathW(CSIDL_
DESKTOPDIRECTORY
) failed! 0x%08lx
\n
"
,
GetLastError
());
if
(
!
result
)
return
;
pStrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
ok
(
!
lstrcmpiW
(
wszPath
,
wszBuffer
),
"FolderShortcut returned incorrect folder!
\n
"
);
ok
(
!
lstrcmpiW
(
wsz
Desktop
Path
,
wszBuffer
),
"FolderShortcut returned incorrect folder!
\n
"
);
hr
=
IShellFolder_QueryInterface
(
pShellFolder
,
&
IID_IPersistFolder3
,
(
LPVOID
*
)
&
pPersistFolder3
);
IShellFolder_Release
(
pShellFolder
);
...
...
@@ -919,6 +928,82 @@ void test_FolderShortcut(void) {
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetCurFolder failed! hr=0x%08lx
\n
"
,
hr
);
ok
(
!
pidlCurrentFolder
,
"IPersistFolder3_GetCurFolder should return a NULL pidl!
\n
"
);
/* For FolderShortcut objects, the Initialize method initialized the folder's position in the
* shell namespace. The target folder, read from the property bag above, remains untouched.
* The following tests show this: The itemidlist for some imaginary shellfolder object
* is created and the FolderShortcut is initialized with it. GetCurFolder now returns this
* itemidlist, but GetDisplayNameOf still returns the path from above.
*/
hr
=
SHGetDesktopFolder
(
&
pDesktopFolder
);
ok
(
SUCCEEDED
(
hr
),
"SHGetDesktopFolder failed! hr = %08lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_ParseDisplayName
(
pDesktopFolder
,
NULL
,
NULL
,
wszWineTestFolder
,
NULL
,
&
pidlWineTestFolder
,
NULL
);
IShellFolder_Release
(
pDesktopFolder
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::ParseDisplayName failed! hr = %08lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IPersistFolder3_Initialize
(
pPersistFolder3
,
pidlWineTestFolder
);
todo_wine
{
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3::Initialize failed! hr = %08lx
\n
"
,
hr
);
}
if
(
FAILED
(
hr
))
{
IPersistFolder3_Release
(
pPersistFolder3
);
ILFree
(
pidlWineTestFolder
);
return
;
}
hr
=
IPersistFolder3_GetCurFolder
(
pPersistFolder3
,
&
pidlCurrentFolder
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetCurFolder failed! hr=0x%08lx
\n
"
,
hr
);
ok
(
ILIsEqual
(
pidlCurrentFolder
,
pidlWineTestFolder
),
"IPersistFolder3_GetCurFolder should return pidlWineTestFolder!
\n
"
);
ILFree
(
pidlCurrentFolder
);
ILFree
(
pidlWineTestFolder
);
hr
=
IPersistFolder3_QueryInterface
(
pPersistFolder3
,
&
IID_IShellFolder
,
(
LPVOID
*
)
&
pShellFolder
);
IPersistFolder3_Release
(
pPersistFolder3
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_QueryInterface(IShellFolder) failed! hr = %08lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IShellFolder_GetDisplayNameOf
(
pShellFolder
,
NULL
,
SHGDN_FORPARSING
,
&
strret
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder_GetDisplayNameOf(NULL) failed! hr = %08lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
pShellFolder
);
return
;
}
pStrRetToBufW
(
&
strret
,
NULL
,
wszBuffer
,
MAX_PATH
);
ok
(
!
lstrcmpiW
(
wszDesktopPath
,
wszBuffer
),
"FolderShortcut returned incorrect folder!
\n
"
);
/* Next few lines are meant to show that children of FolderShortcuts are not FolderShortcuts,
* but ShellFSFolders. */
PathAddBackslashW
(
wszDesktopPath
);
lstrcatW
(
wszDesktopPath
,
wszSomeSubFolder
);
if
(
!
CreateDirectoryW
(
wszDesktopPath
,
NULL
))
{
IShellFolder_Release
(
pShellFolder
);
return
;
}
hr
=
IShellFolder_ParseDisplayName
(
pShellFolder
,
NULL
,
NULL
,
wszSomeSubFolder
,
NULL
,
&
pidlSubFolder
,
NULL
);
RemoveDirectoryW
(
wszSomeSubFolder
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::ParseDisplayName failed! hr = %08lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
{
IShellFolder_Release
(
pShellFolder
);
return
;
}
hr
=
IShellFolder_BindToObject
(
pShellFolder
,
pidlSubFolder
,
NULL
,
&
IID_IPersistFolder3
,
(
LPVOID
*
)
&
pPersistFolder3
);
IShellFolder_Release
(
pShellFolder
);
ILFree
(
pidlSubFolder
);
ok
(
SUCCEEDED
(
hr
),
"IShellFolder::BindToObject failed! hr = %08lx
\n
"
,
hr
);
if
(
FAILED
(
hr
))
return
;
hr
=
IPersistFolder3_GetClassID
(
pPersistFolder3
,
&
clsid
);
ok
(
SUCCEEDED
(
hr
),
"IPersistFolder3_GetClassID failed! hr=0x%08lx
\n
"
,
hr
);
ok
(
IsEqualCLSID
(
&
clsid
,
&
CLSID_ShellFSFolder
),
"Unexpected CLSID!
\n
"
);
IPersistFolder3_Release
(
pPersistFolder3
);
}
...
...
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