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
9dbdd8c8
Commit
9dbdd8c8
authored
Jan 18, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Jan 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Added file move/rename ReadDirectoryChangesW tests.
parent
be5a757c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
19 deletions
+62
-19
change.c
dlls/kernel32/tests/change.c
+62
-19
No files found.
dlls/kernel32/tests/change.c
View file @
9dbdd8c8
...
...
@@ -795,8 +795,9 @@ static void test_readdirectorychanges_cr(void)
static
const
WCHAR
szBoo
[]
=
{
'\\'
,
'b'
,
'o'
,
'o'
,
'\\'
,
0
};
static
const
WCHAR
szDir
[]
=
{
'd'
,
'i'
,
'r'
,
0
};
static
const
WCHAR
szFile
[]
=
{
'f'
,
'i'
,
'l'
,
'e'
,
0
};
static
const
WCHAR
szBackslash
[]
=
{
'\\'
,
0
};
WCHAR
path
[
MAX_PATH
],
file
[
MAX_PATH
],
dir
[
MAX_PATH
];
WCHAR
path
[
MAX_PATH
],
file
[
MAX_PATH
],
dir
[
MAX_PATH
]
,
sub_file
[
MAX_PATH
]
;
FILE_NOTIFY_INFORMATION
fni
[
1024
],
*
fni_next
;
OVERLAPPED
ov
;
HANDLE
hdir
,
hfile
;
...
...
@@ -824,6 +825,9 @@ static void test_readdirectorychanges_cr(void)
lstrcatW
(
dir
,
szDir
);
lstrcpyW
(
file
,
path
);
lstrcatW
(
file
,
szFile
);
lstrcpyW
(
sub_file
,
dir
);
lstrcatW
(
sub_file
,
szBackslash
);
lstrcatW
(
sub_file
,
szFile
);
DeleteFileW
(
file
);
RemoveDirectoryW
(
dir
);
...
...
@@ -864,6 +868,38 @@ static void test_readdirectorychanges_cr(void)
r
=
CreateDirectoryW
(
dir
,
NULL
);
ok
(
r
==
TRUE
,
"failed to create directory
\n
"
);
r
=
MoveFileW
(
file
,
sub_file
);
ok
(
r
==
TRUE
,
"failed to move file
\n
"
);
r
=
SleepEx
(
1000
,
TRUE
);
ok
(
r
!=
0
,
"failed to receive file move event
\n
"
);
ok
(
fni
->
NextEntryOffset
==
0
,
"there should be no more events in buffer
\n
"
);
ok
(
fni
->
Action
==
FILE_ACTION_REMOVED
,
"Action = %d
\n
"
,
fni
->
Action
);
ok
(
fni
->
FileNameLength
==
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
),
"FileNameLength = %d
\n
"
,
fni
->
FileNameLength
);
ok
(
!
memcmp
(
fni
->
FileName
,
szFile
,
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
)),
"FileName = %s
\n
"
,
wine_dbgstr_w
(
fni
->
FileName
));
r
=
pReadDirectoryChangesW
(
hdir
,
fni
,
sizeof
(
fni
),
FALSE
,
FILE_NOTIFY_CHANGE_FILE_NAME
,
NULL
,
&
ov
,
readdirectorychanges_cr
);
ok
(
r
==
TRUE
,
"pReadDirectoryChangesW failed
\n
"
);
r
=
MoveFileW
(
sub_file
,
file
);
ok
(
r
==
TRUE
,
"failed to move file
\n
"
);
r
=
SleepEx
(
1000
,
TRUE
);
ok
(
r
!=
0
,
"failed to receive file move event
\n
"
);
ok
(
fni
->
NextEntryOffset
==
0
,
"there should be no more events in buffer
\n
"
);
ok
(
fni
->
Action
==
FILE_ACTION_ADDED
,
"Action = %d
\n
"
,
fni
->
Action
);
ok
(
fni
->
FileNameLength
==
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
),
"FileNameLength = %d
\n
"
,
fni
->
FileNameLength
);
ok
(
!
memcmp
(
fni
->
FileName
,
szFile
,
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
)),
"FileName = %s
\n
"
,
wine_dbgstr_w
(
fni
->
FileName
));
r
=
pReadDirectoryChangesW
(
hdir
,
fni
,
sizeof
(
fni
),
FALSE
,
FILE_NOTIFY_CHANGE_FILE_NAME
,
NULL
,
&
ov
,
readdirectorychanges_cr
);
ok
(
r
==
TRUE
,
"pReadDirectoryChangesW failed
\n
"
);
r
=
DeleteFileW
(
file
);
ok
(
r
==
TRUE
,
"failed to delete file
\n
"
);
...
...
@@ -892,29 +928,36 @@ static void test_readdirectorychanges_cr(void)
r
=
SleepEx
(
1000
,
TRUE
);
ok
(
r
!=
0
,
"failed to receive directory move event
\n
"
);
ok
(
fni
->
Action
==
FILE_ACTION_RENAMED_OLD_NAME
,
"Action = %d
\n
"
,
fni
->
Action
);
ok
(
fni
->
FileNameLength
==
lstrlenW
(
szDir
)
*
sizeof
(
WCHAR
),
"FileNameLength = %d
\n
"
,
fni
->
FileNameLength
);
ok
(
!
memcmp
(
fni
->
FileName
,
szDir
,
lstrlenW
(
szDir
)
*
sizeof
(
WCHAR
)),
"FileName = %s
\n
"
,
wine_dbgstr_w
(
fni
->
FileName
));
if
(
fni
->
NextEntryOffset
)
if
(
fni
->
Action
==
FILE_ACTION_RENAMED_OLD_NAME
)
{
ok
(
fni
->
Action
==
FILE_ACTION_RENAMED_OLD_NAME
,
"Action = %d
\n
"
,
fni
->
Action
);
ok
(
fni
->
FileNameLength
==
lstrlenW
(
szDir
)
*
sizeof
(
WCHAR
),
"FileNameLength = %d
\n
"
,
fni
->
FileNameLength
);
ok
(
!
memcmp
(
fni
->
FileName
,
szDir
,
lstrlenW
(
szDir
)
*
sizeof
(
WCHAR
)),
"FileName = %s
\n
"
,
wine_dbgstr_w
(
fni
->
FileName
));
ok
(
fni
->
NextEntryOffset
!=
0
,
"no next entry in movement event
\n
"
);
fni_next
=
(
FILE_NOTIFY_INFORMATION
*
)((
char
*
)
fni
+
fni
->
NextEntryOffset
);
ok
(
fni_next
->
NextEntryOffset
==
0
,
"there should be no more events in buffer
\n
"
);
ok
(
fni_next
->
Action
==
FILE_ACTION_RENAMED_NEW_NAME
,
"Action = %d
\n
"
,
fni_next
->
Action
);
ok
(
fni_next
->
FileNameLength
==
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
),
"FileNameLength = %d
\n
"
,
fni_next
->
FileNameLength
);
ok
(
!
memcmp
(
fni_next
->
FileName
,
szFile
,
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
)),
"FileName = %s
\n
"
,
wine_dbgstr_w
(
fni_next
->
FileName
));
}
else
{
r
=
pReadDirectoryChangesW
(
hdir
,
fni
,
sizeof
(
fni
),
FALSE
,
FILE_NOTIFY_CHANGE_DIR_NAME
,
NULL
,
&
ov
,
readdirectorychanges_cr
);
ok
(
r
==
TRUE
,
"pReadDirectoryChangesW failed
\n
"
);
todo_wine
ok
(
0
,
"Expected rename event
\n
"
);
r
=
SleepEx
(
1000
,
TRUE
);
ok
(
r
!=
0
,
"failed to receive directory move event
\n
"
);
fni_next
=
fni
;
if
(
fni
->
NextEntryOffset
==
0
)
{
r
=
pReadDirectoryChangesW
(
hdir
,
fni
,
sizeof
(
fni
),
FALSE
,
FILE_NOTIFY_CHANGE_DIR_NAME
,
NULL
,
&
ov
,
readdirectorychanges_cr
);
ok
(
r
==
TRUE
,
"pReadDirectoryChangesW failed
\n
"
);
r
=
SleepEx
(
1000
,
TRUE
);
ok
(
r
!=
0
,
"failed to receive directory move event
\n
"
);
}
}
ok
(
fni_next
->
NextEntryOffset
==
0
,
"there should be no more events in buffer
\n
"
);
ok
(
fni_next
->
Action
==
FILE_ACTION_RENAMED_NEW_NAME
,
"Action = %d
\n
"
,
fni_next
->
Action
);
ok
(
fni_next
->
FileNameLength
==
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
),
"FileNameLength = %d
\n
"
,
fni_next
->
FileNameLength
);
ok
(
!
memcmp
(
fni_next
->
FileName
,
szFile
,
lstrlenW
(
szFile
)
*
sizeof
(
WCHAR
)),
"FileName = %s
\n
"
,
wine_dbgstr_w
(
fni_next
->
FileName
));
r
=
CreateDirectoryW
(
dir
,
NULL
);
ok
(
r
==
TRUE
,
"failed to create directory
\n
"
);
...
...
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