From: Bernhard K��lbl besentv@gmail.com
--- dlls/windows.media.speech/tests/speech.c | 33 +++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/dlls/windows.media.speech/tests/speech.c b/dlls/windows.media.speech/tests/speech.c index 75f0007089e..339f57190ad 100644 --- a/dlls/windows.media.speech/tests/speech.c +++ b/dlls/windows.media.speech/tests/speech.c @@ -73,8 +73,9 @@ static inline void check_refcount_(unsigned int line, void *obj, LONG exp) ok_(__FILE__, line)(exp == ref, "Unexpected refcount %lu, expected %lu\n", ref, exp); }
-#define check_interface(obj, iid, exp) check_interface_(__LINE__, obj, iid, exp) -static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL supported) +#define check_interface(obj, iid, exp) check_interface_(__LINE__, obj, iid, exp, FALSE) +#define check_optional_interface(obj, iid, exp) check_interface_(__LINE__, obj, iid, exp, TRUE) +static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL supported, BOOL optional) { IUnknown *iface = obj; HRESULT hr, expected_hr; @@ -83,7 +84,7 @@ static void check_interface_(unsigned int line, void *obj, const IID *iid, BOOL expected_hr = supported ? S_OK : E_NOINTERFACE;
hr = IUnknown_QueryInterface(iface, iid, (void **)&unk); - ok_(__FILE__, line)(hr == expected_hr, "Got hr %#lx, expected %#lx.\n", hr, expected_hr); + ok_(__FILE__, line)(hr == expected_hr || broken(hr == E_NOINTERFACE && optional), "Got hr %#lx, expected %#lx.\n", hr, expected_hr); if (SUCCEEDED(hr)) IUnknown_Release(unk); } @@ -1017,11 +1018,37 @@ static void test_SpeechSynthesizer(void) hr = IInspectable_QueryInterface(inspectable, &IID_IClosable, (void **)&closable); ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
+ /* Test ISpeechSynthesizer2 iface */ hr = IInspectable_QueryInterface(inspectable, &IID_ISpeechSynthesizer2, (void **)&synthesizer2); ok(hr == S_OK || broken(hr == E_NOINTERFACE), "Got unexpected hr %#lx.\n", hr); /* Requires Win10 >= 1703 */
if (hr == S_OK) { + ISpeechSynthesizerOptions *options; + + hr = ISpeechSynthesizer2_get_Options(synthesizer2, &options); + todo_wine ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr); + + if (hr == S_OK) + { + ISpeechSynthesizerOptions3 *options3; + + check_interface(options, &IID_IAgileObject, TRUE); + check_optional_interface(options, &IID_ISpeechSynthesizerOptions2, TRUE); /* Requires Win10 >= 1709 */ + + hr = ISpeechSynthesizerOptions_QueryInterface(options, &IID_ISpeechSynthesizerOptions3, (void **)&options3); + ok(hr == S_OK || broken(hr == E_NOINTERFACE), "Got unexpected hr %#lx.\n", hr); /* Requires Win10 >= 1803 */ + + if (hr == S_OK) + { + ref = ISpeechSynthesizerOptions3_Release(options3); + ok(ref == 2, "Got unexpected ref %lu.\n", ref); + } + + ref = ISpeechSynthesizerOptions_Release(options); + ok(ref == 1, "Got unexpected ref %lu.\n", ref); + } + ref = ISpeechSynthesizer2_Release(synthesizer2); ok(ref == 3, "Got unexpected ref %lu.\n", ref); }