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
f4e4a608
Commit
f4e4a608
authored
Jul 30, 2013
by
Piotr Caban
Committed by
Alexandre Julliard
Jul 30, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun/tests: Add IFilesystem3::CopyFolder tests.
parent
a20c9738
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
0 deletions
+125
-0
filesystem.c
dlls/scrrun/tests/filesystem.c
+125
-0
No files found.
dlls/scrrun/tests/filesystem.c
View file @
f4e4a608
...
...
@@ -526,6 +526,130 @@ static void test_GetFile(void)
SysFreeString
(
path
);
}
static
inline
BOOL
create_file
(
const
WCHAR
*
name
)
{
HANDLE
f
=
CreateFileW
(
name
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
0
,
NULL
);
CloseHandle
(
f
);
return
f
!=
INVALID_HANDLE_VALUE
;
}
static
inline
void
create_path
(
const
WCHAR
*
folder
,
const
WCHAR
*
name
,
WCHAR
*
ret
)
{
DWORD
len
=
lstrlenW
(
folder
);
memmove
(
ret
,
folder
,
len
*
sizeof
(
WCHAR
));
ret
[
len
]
=
'\\'
;
memmove
(
ret
+
len
+
1
,
name
,
(
lstrlenW
(
name
)
+
1
)
*
sizeof
(
WCHAR
));
}
static
void
test_CopyFolder
(
void
)
{
static
const
WCHAR
filesystem3_dir
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
's'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
'3'
,
'_'
,
't'
,
'e'
,
's'
,
't'
,
0
};
static
const
WCHAR
s1
[]
=
{
's'
,
'r'
,
'c'
,
'1'
,
0
};
static
const
WCHAR
s
[]
=
{
's'
,
'r'
,
'c'
,
'*'
,
0
};
static
const
WCHAR
d
[]
=
{
'd'
,
's'
,
't'
,
0
};
static
const
WCHAR
empty
[]
=
{
0
};
WCHAR
tmp
[
MAX_PATH
];
BSTR
bsrc
,
bdst
;
HRESULT
hr
;
if
(
!
CreateDirectoryW
(
filesystem3_dir
,
NULL
))
{
skip
(
"can't create temporary directory
\n
"
);
return
;
}
create_path
(
filesystem3_dir
,
s1
,
tmp
);
bsrc
=
SysAllocString
(
tmp
);
create_path
(
filesystem3_dir
,
d
,
tmp
);
bdst
=
SysAllocString
(
tmp
);
hr
=
IFileSystem3_CopyFile
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
CTL_E_FILENOTFOUND
,
"CopyFile returned %x, expected CTL_E_FILENOTFOUND
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
CTL_E_PATHNOTFOUND
,
"CopyFolder returned %x, expected CTL_E_PATHNOTFOUND
\n
"
,
hr
);
ok
(
create_file
(
bsrc
),
"can't create %s file
\n
"
,
wine_dbgstr_w
(
bsrc
));
hr
=
IFileSystem3_CopyFile
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"CopyFile returned %x, expected S_OK
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
CTL_E_PATHNOTFOUND
,
"CopyFolder returned %x, expected CTL_E_PATHNOTFOUND
\n
"
,
hr
);
hr
=
IFileSystem3_DeleteFile
(
fs3
,
bsrc
,
VARIANT_FALSE
);
ok
(
hr
==
S_OK
,
"DeleteFile returned %x, expected S_OK
\n
"
,
hr
);
ok
(
CreateDirectoryW
(
bsrc
,
NULL
),
"can't create %s
\n
"
,
wine_dbgstr_w
(
bsrc
));
hr
=
IFileSystem3_CopyFile
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
CTL_E_FILENOTFOUND
,
"CopyFile returned %x, expected CTL_E_FILENOTFOUND
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
CTL_E_FILEALREADYEXISTS
,
"CopyFolder returned %x, expected CTL_E_FILEALREADYEXISTS
\n
"
,
hr
);
hr
=
IFileSystem3_DeleteFile
(
fs3
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"DeleteFile returned %x, expected S_OK
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"CopyFolder returned %x, expected S_OK
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"CopyFolder returned %x, expected S_OK
\n
"
,
hr
);
create_path
(
tmp
,
s1
,
tmp
);
ok
(
GetFileAttributesW
(
tmp
)
==
INVALID_FILE_ATTRIBUTES
,
"%s file exists
\n
"
,
wine_dbgstr_w
(
tmp
));
create_path
(
filesystem3_dir
,
d
,
tmp
);
create_path
(
tmp
,
empty
,
tmp
);
SysFreeString
(
bdst
);
bdst
=
SysAllocString
(
tmp
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"CopyFolder returned %x, expected S_OK
\n
"
,
hr
);
create_path
(
tmp
,
s1
,
tmp
);
ok
(
GetFileAttributesW
(
tmp
)
!=
INVALID_FILE_ATTRIBUTES
,
"%s directory doesn't exist
\n
"
,
wine_dbgstr_w
(
tmp
));
ok
(
RemoveDirectoryW
(
tmp
),
"can't remove %s directory
\n
"
,
wine_dbgstr_w
(
tmp
));
create_path
(
filesystem3_dir
,
d
,
tmp
);
SysFreeString
(
bdst
);
bdst
=
SysAllocString
(
tmp
);
create_path
(
filesystem3_dir
,
s
,
tmp
);
SysFreeString
(
bsrc
);
bsrc
=
SysAllocString
(
tmp
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"CopyFolder returned %x, expected S_OK
\n
"
,
hr
);
create_path
(
filesystem3_dir
,
d
,
tmp
);
create_path
(
tmp
,
s1
,
tmp
);
ok
(
GetFileAttributesW
(
tmp
)
!=
INVALID_FILE_ATTRIBUTES
,
"%s directory doesn't exist
\n
"
,
wine_dbgstr_w
(
tmp
));
hr
=
IFileSystem3_DeleteFolder
(
fs3
,
bdst
,
VARIANT_FALSE
);
ok
(
hr
==
S_OK
,
"DeleteFolder returned %x, expected S_OK
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
CTL_E_PATHNOTFOUND
,
"CopyFolder returned %x, expected CTL_E_PATHNOTFOUND
\n
"
,
hr
);
create_path
(
filesystem3_dir
,
s1
,
tmp
);
SysFreeString
(
bsrc
);
bsrc
=
SysAllocString
(
tmp
);
create_path
(
tmp
,
s1
,
tmp
);
ok
(
create_file
(
tmp
),
"can't create %s file
\n
"
,
wine_dbgstr_w
(
tmp
));
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_FALSE
);
ok
(
hr
==
S_OK
,
"CopyFolder returned %x, expected S_OK
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_FALSE
);
ok
(
hr
==
CTL_E_FILEALREADYEXISTS
,
"CopyFolder returned %x, expected CTL_E_FILEALREADYEXISTS
\n
"
,
hr
);
hr
=
IFileSystem3_CopyFolder
(
fs3
,
bsrc
,
bdst
,
VARIANT_TRUE
);
ok
(
hr
==
S_OK
,
"CopyFolder returned %x, expected S_OK
\n
"
,
hr
);
SysFreeString
(
bsrc
);
SysFreeString
(
bdst
);
bsrc
=
SysAllocString
(
filesystem3_dir
);
hr
=
IFileSystem3_DeleteFolder
(
fs3
,
bsrc
,
VARIANT_FALSE
);
ok
(
hr
==
S_OK
,
"DeleteFolder returned %x, expected S_OK
\n
"
,
hr
);
SysFreeString
(
bsrc
);
}
START_TEST
(
filesystem
)
{
HRESULT
hr
;
...
...
@@ -548,6 +672,7 @@ START_TEST(filesystem)
test_GetBaseName
();
test_GetAbsolutePathName
();
test_GetFile
();
test_CopyFolder
();
IFileSystem3_Release
(
fs3
);
...
...
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