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
1b1ed8f1
Commit
1b1ed8f1
authored
May 11, 2022
by
Bernhard Kölbl
Committed by
Alexandre Julliard
May 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows.media.speech/tests: Add await helper for IAsyncOperation.
Signed-off-by:
Bernhard Kölbl
<
besentv@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
00e3dccb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
21 deletions
+22
-21
speech.c
dlls/windows.media.speech/tests/speech.c
+22
-21
No files found.
dlls/windows.media.speech/tests/speech.c
View file @
1b1ed8f1
...
...
@@ -307,7 +307,6 @@ static const struct IAsyncOperationCompletedHandler_IInspectableVtbl asnyc_inspe
async_inspectable_handler_Invoke
};
static
HRESULT
WINAPI
async_inspectable_handler_create_static
(
struct
async_inspectable_handler
*
impl
,
const
GUID
*
iid
)
{
impl
->
IAsyncOperationCompletedHandler_IInspectable_iface
.
lpVtbl
=
&
asnyc_inspectable_handler_vtbl
;
...
...
@@ -317,6 +316,22 @@ static HRESULT WINAPI async_inspectable_handler_create_static( struct async_insp
return
S_OK
;
}
#define await_async_inspectable(operation, handler, iid) await_async_inspectable_(__LINE__, operation, handler, iid)
static
void
await_async_inspectable_
(
unsigned
int
line
,
IAsyncOperation_IInspectable
*
operation
,
struct
async_inspectable_handler
*
handler
,
const
GUID
*
handler_iid
)
{
HRESULT
hr
;
async_inspectable_handler_create_static
(
handler
,
handler_iid
);
handler
->
event_block
=
NULL
;
handler
->
event_finished
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
ok_
(
__FILE__
,
line
)(
!!
handler
->
event_finished
,
"event_finished wasn't created.
\n
"
);
hr
=
IAsyncOperation_IInspectable_put_Completed
(
operation
,
&
handler
->
IAsyncHandler_IInspectable_iface
);
ok_
(
__FILE__
,
line
)(
hr
==
S_OK
,
"IAsyncOperation_IInspectable_put_Completed failed, hr %#lx.
\n
"
,
hr
);
ok_
(
__FILE__
,
line
)(
!
WaitForSingleObject
(
handler
->
event_finished
,
5000
),
"Wait for event_finished failed.
\n
"
);
CloseHandle
(
handler
->
event_finished
);
}
struct
iterator_hstring
{
IIterator_HSTRING
IIterator_HSTRING_iface
;
...
...
@@ -972,10 +987,6 @@ static void test_SpeechRecognizer(void)
ref
=
IVector_ISpeechRecognitionConstraint_Release
(
constraints
);
ok
(
ref
==
1
,
"Got unexpected ref %lu.
\n
"
,
ref
);
async_inspectable_handler_create_static
(
&
compilation_handler
,
&
IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult
);
compilation_handler
.
event_finished
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
compilation_handler
.
thread_id
=
GetCurrentThreadId
();
hr
=
ISpeechRecognizer_CompileConstraintsAsync
(
recognizer
,
&
operation
);
ok
(
hr
==
S_OK
,
"ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.
\n
"
,
hr
);
...
...
@@ -991,11 +1002,9 @@ static void test_SpeechRecognizer(void)
ok
(
hr
==
E_ILLEGAL_METHOD_CALL
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
compilation_result
==
(
void
*
)
0xdeadbeef
,
"Compilation result had value %p.
\n
"
,
compilation_result
);
hr
=
IAsyncOperation_IInspectable_put_Completed
((
IAsyncOperation_IInspectable
*
)
operation
,
&
compilation_handler
.
IAsyncHandler_IInspectable_iface
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
WaitForSingleObject
(
compilation_handler
.
event_finished
,
1000
),
"Wait for event_finished failed.
\n
"
);
CloseHandle
(
compilation_handler
.
event_finished
);
await_async_inspectable
((
IAsyncOperation_IInspectable
*
)
operation
,
&
compilation_handler
,
&
IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult
);
hr
=
IAsyncOperation_SpeechRecognitionCompilationResult_put_Completed
(
operation
,
NULL
);
ok
(
hr
==
E_ILLEGAL_DELEGATE_ASSIGNMENT
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
...
...
@@ -1072,12 +1081,6 @@ static void test_SpeechRecognizer(void)
IAsyncOperation_SpeechRecognitionCompilationResult_Release
(
operation
);
/* Test if AsyncOperation is started immediately. */
async_inspectable_handler_create_static
(
&
compilation_handler
,
&
IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult
);
compilation_handler
.
event_finished
=
CreateEventW
(
NULL
,
FALSE
,
FALSE
,
NULL
);
compilation_handler
.
thread_id
=
GetCurrentThreadId
();
ok
(
compilation_handler
.
event_finished
!=
NULL
,
"Finished event wasn't created.
\n
"
);
hr
=
ISpeechRecognizer_CompileConstraintsAsync
(
recognizer
,
&
operation
);
ok
(
hr
==
S_OK
,
"ISpeechRecognizer_CompileConstraintsAsync failed, hr %#lx.
\n
"
,
hr
);
check_interface
(
operation
,
&
IID_IAgileObject
,
TRUE
);
...
...
@@ -1090,11 +1093,9 @@ static void test_SpeechRecognizer(void)
ok
(
hr
==
S_OK
,
"IAsyncInfo_get_Status failed, hr %#lx.
\n
"
,
hr
);
ok
(
async_status
!=
AsyncStatus_Closed
,
"Status was %#x.
\n
"
,
async_status
);
hr
=
IAsyncOperation_IInspectable_put_Completed
((
IAsyncOperation_IInspectable
*
)
operation
,
&
compilation_handler
.
IAsyncHandler_IInspectable_iface
);
ok
(
hr
==
S_OK
,
"Got unexpected hr %#lx.
\n
"
,
hr
);
ok
(
!
WaitForSingleObject
(
compilation_handler
.
event_finished
,
1000
),
"Wait for event_finished failed.
\n
"
);
CloseHandle
(
compilation_handler
.
event_finished
);
await_async_inspectable
((
IAsyncOperation_IInspectable
*
)
operation
,
&
compilation_handler
,
&
IID_IAsyncOperationCompletedHandler_SpeechRecognitionCompilationResult
);
async_status
=
0xdeadbeef
;
hr
=
IAsyncInfo_get_Status
(
info
,
&
async_status
);
...
...
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