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
5e16cf4c
Commit
5e16cf4c
authored
Feb 21, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Feb 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
quartz/tests/filesource: Add tests for IAsyncReader_SyncRead().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e7b8a2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
79 additions
and
0 deletions
+79
-0
filesource.c
dlls/quartz/tests/filesource.c
+79
-0
No files found.
dlls/quartz/tests/filesource.c
View file @
5e16cf4c
...
...
@@ -666,6 +666,84 @@ todo_wine
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
}
static
void
test_async_reader
(
void
)
{
IBaseFilter
*
filter
=
create_file_source
();
IFileSourceFilter
*
filesource
;
LONGLONG
length
,
available
;
WCHAR
filename
[
MAX_PATH
];
IAsyncReader
*
reader
;
BYTE
buffer
[
20
];
DWORD
written
;
HANDLE
file
;
HRESULT
hr
;
ULONG
ref
;
IPin
*
pin
;
BOOL
ret
;
int
i
;
GetTempPathW
(
ARRAY_SIZE
(
filename
),
filename
);
lstrcatW
(
filename
,
avifile
);
file
=
CreateFileW
(
filename
,
GENERIC_READ
|
GENERIC_WRITE
,
0
,
NULL
,
CREATE_ALWAYS
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Failed to create file, error %u.
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
600
;
i
++
)
{
BYTE
b
=
i
%
111
;
WriteFile
(
file
,
&
b
,
1
,
&
written
,
NULL
);
}
CloseHandle
(
file
);
IBaseFilter_QueryInterface
(
filter
,
&
IID_IFileSourceFilter
,
(
void
**
)
&
filesource
);
IFileSourceFilter_Load
(
filesource
,
filename
,
NULL
);
IBaseFilter_FindPin
(
filter
,
source_id
,
&
pin
);
hr
=
IPin_QueryInterface
(
pin
,
&
IID_IAsyncReader
,
(
void
**
)
&
reader
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
hr
=
IAsyncReader_Length
(
reader
,
&
length
,
&
available
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
length
==
600
,
"Got length %s.
\n
"
,
wine_dbgstr_longlong
(
length
));
ok
(
available
==
600
,
"Got available length %s.
\n
"
,
wine_dbgstr_longlong
(
available
));
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
hr
=
IAsyncReader_SyncRead
(
reader
,
0
,
10
,
buffer
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
10
;
i
++
)
ok
(
buffer
[
i
]
==
i
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
hr
=
IAsyncReader_SyncRead
(
reader
,
0
,
10
,
buffer
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
10
;
i
++
)
ok
(
buffer
[
i
]
==
i
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
hr
=
IAsyncReader_SyncRead
(
reader
,
10
,
10
,
buffer
);
ok
(
hr
==
S_OK
,
"Got hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
10
;
i
++
)
ok
(
buffer
[
i
]
==
(
10
+
i
)
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
hr
=
IAsyncReader_SyncRead
(
reader
,
590
,
20
,
buffer
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
for
(
i
=
0
;
i
<
10
;
i
++
)
ok
(
buffer
[
i
]
==
(
590
+
i
)
%
111
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
for
(;
i
<
20
;
i
++
)
ok
(
buffer
[
i
]
==
0xcc
,
"Got wrong byte %02x at %u.
\n
"
,
buffer
[
i
],
i
);
memset
(
buffer
,
0xcc
,
sizeof
(
buffer
));
hr
=
IAsyncReader_SyncRead
(
reader
,
600
,
10
,
buffer
);
todo_wine
ok
(
hr
==
S_FALSE
,
"Got hr %#x.
\n
"
,
hr
);
ok
(
buffer
[
0
]
==
0xcc
,
"Got wrong byte %02x.
\n
"
,
buffer
[
0
]);
IAsyncReader_Release
(
reader
);
IPin_Release
(
pin
);
IFileSourceFilter_Release
(
filesource
);
ref
=
IBaseFilter_Release
(
filter
);
ok
(
!
ref
,
"Got outstanding refcount %d.
\n
"
,
ref
);
ret
=
DeleteFileW
(
filename
);
ok
(
ret
,
"Failed to delete file, error %u.
\n
"
,
GetLastError
());
}
START_TEST
(
filesource
)
{
CoInitialize
(
NULL
);
...
...
@@ -676,6 +754,7 @@ START_TEST(filesource)
test_pin_info
();
test_filter_state
();
test_file_source_filter
();
test_async_reader
();
CoUninitialize
();
}
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