2 * Copyright 2017 Alistair Leslie-Hughes
3 * Copyright 2019 Vijay Kiran Kamuju
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define WIN32_LEAN_AND_MEAN
24 #include "wine/test.h"
26 HRESULT WINAPI
WMCreateWriterPriv(IWMWriter
**writer
);
28 #define check_interface(a, b, c) check_interface_(__LINE__, a, b, c)
29 static HRESULT
check_interface_(unsigned int line
, void *iface
, REFIID riid
, BOOL supported
)
31 HRESULT hr
, expected_hr
;
32 IUnknown
*unknown
= iface
, *out
;
34 expected_hr
= supported
? S_OK
: E_NOINTERFACE
;
36 hr
= IUnknown_QueryInterface(unknown
, riid
, (void **)&out
);
37 ok_(__FILE__
, line
)(hr
== expected_hr
, "Got hr %#x, expected %#x.\n", hr
, expected_hr
);
39 IUnknown_Release(out
);
43 static void test_wmwriter_interfaces(void)
48 hr
= WMCreateWriter( NULL
, &writer
);
49 ok(hr
== S_OK
, "WMCreateWriter failed 0x%08x\n", hr
);
52 win_skip("Failed to create IWMWriter\n");
56 check_interface(writer
, &IID_IWMWriterSink
, FALSE
);
58 check_interface(writer
, &IID_IWMWriter
, TRUE
);
59 check_interface(writer
, &IID_IWMWriterAdvanced
, TRUE
);
60 check_interface(writer
, &IID_IWMWriterAdvanced2
, TRUE
);
61 check_interface(writer
, &IID_IWMWriterAdvanced3
, TRUE
);
62 todo_wine
check_interface(writer
, &IID_IWMWriterPreprocess
, TRUE
);
63 todo_wine
check_interface(writer
, &IID_IWMHeaderInfo
, TRUE
);
64 todo_wine
check_interface(writer
, &IID_IWMHeaderInfo2
, TRUE
);
65 todo_wine
check_interface(writer
, &IID_IWMHeaderInfo3
, TRUE
);
67 IWMWriter_Release(writer
);
70 static void test_wmreader_interfaces(void)
75 hr
= WMCreateReader( NULL
, 0, &reader
);
76 ok(hr
== S_OK
, "WMCreateReader failed 0x%08x\n", hr
);
79 win_skip("Failed to create IWMReader\n");
83 check_interface(reader
, &IID_IWMDRMReader
, FALSE
);
84 check_interface(reader
, &IID_IWMDRMReader2
, FALSE
);
85 check_interface(reader
, &IID_IWMDRMReader3
, FALSE
);
86 check_interface(reader
, &IID_IWMSyncReader
, FALSE
);
87 check_interface(reader
, &IID_IWMSyncReader2
, FALSE
);
89 check_interface(reader
, &IID_IWMReader
, TRUE
);
90 check_interface(reader
, &IID_IWMReaderAdvanced
, TRUE
);
91 check_interface(reader
, &IID_IWMReaderAdvanced2
, TRUE
);
92 check_interface(reader
, &IID_IWMReaderAdvanced3
, TRUE
);
93 check_interface(reader
, &IID_IWMReaderAdvanced4
, TRUE
);
94 check_interface(reader
, &IID_IWMReaderAdvanced5
, TRUE
);
95 check_interface(reader
, &IID_IWMReaderAdvanced6
, TRUE
);
96 check_interface(reader
, &IID_IWMHeaderInfo
, TRUE
);
97 check_interface(reader
, &IID_IWMHeaderInfo2
, TRUE
);
98 check_interface(reader
, &IID_IWMHeaderInfo3
, TRUE
);
99 check_interface(reader
, &IID_IWMProfile
, TRUE
);
100 check_interface(reader
, &IID_IWMProfile2
, TRUE
);
101 check_interface(reader
, &IID_IWMProfile3
, TRUE
);
102 check_interface(reader
, &IID_IWMPacketSize
, TRUE
);
103 check_interface(reader
, &IID_IWMPacketSize2
, TRUE
);
104 check_interface(reader
, &IID_IWMReaderAccelerator
, TRUE
);
105 check_interface(reader
, &IID_IWMReaderTimecode
, TRUE
);
106 check_interface(reader
, &IID_IWMReaderNetworkConfig
, TRUE
);
107 check_interface(reader
, &IID_IWMReaderNetworkConfig2
, TRUE
);
108 check_interface(reader
, &IID_IWMReaderStreamClock
, TRUE
);
109 check_interface(reader
, &IID_IWMReaderTypeNegotiation
, TRUE
);
110 check_interface(reader
, &IID_IWMReaderPlaylistBurn
, TRUE
);
111 check_interface(reader
, &IID_IWMLanguageList
, TRUE
);
112 check_interface(reader
, &IID_IReferenceClock
, TRUE
);
114 IWMReader_Release(reader
);
117 static void test_wmsyncreader_interfaces(void)
120 IWMSyncReader
*reader
;
122 hr
= WMCreateSyncReader( NULL
, 0, &reader
);
123 ok(hr
== S_OK
, "WMCreateSyncReader failed 0x%08x\n", hr
);
126 win_skip("Failed to create IWMSyncReader\n");
130 check_interface(reader
, &IID_IWMDRMReader
, FALSE
);
131 check_interface(reader
, &IID_IWMDRMReader2
, FALSE
);
132 check_interface(reader
, &IID_IWMDRMReader3
, FALSE
);
133 check_interface(reader
, &IID_IWMReader
, FALSE
);
134 check_interface(reader
, &IID_IWMReaderAccelerator
, FALSE
);
135 check_interface(reader
, &IID_IWMReaderAdvanced
, FALSE
);
136 check_interface(reader
, &IID_IWMReaderAdvanced2
, FALSE
);
137 check_interface(reader
, &IID_IWMReaderAdvanced3
, FALSE
);
138 check_interface(reader
, &IID_IWMReaderAdvanced4
, FALSE
);
139 check_interface(reader
, &IID_IWMReaderAdvanced5
, FALSE
);
140 check_interface(reader
, &IID_IWMReaderAdvanced6
, FALSE
);
141 check_interface(reader
, &IID_IWMReaderNetworkConfig
, FALSE
);
142 check_interface(reader
, &IID_IWMReaderNetworkConfig2
, FALSE
);
143 check_interface(reader
, &IID_IWMReaderStreamClock
, FALSE
);
144 check_interface(reader
, &IID_IWMReaderTypeNegotiation
, FALSE
);
145 check_interface(reader
, &IID_IReferenceClock
, FALSE
);
147 check_interface(reader
, &IID_IWMSyncReader
, TRUE
);
148 check_interface(reader
, &IID_IWMSyncReader2
, TRUE
);
149 todo_wine
check_interface(reader
, &IID_IWMHeaderInfo
, TRUE
);
150 todo_wine
check_interface(reader
, &IID_IWMHeaderInfo2
, TRUE
);
151 todo_wine
check_interface(reader
, &IID_IWMHeaderInfo3
, TRUE
);
152 check_interface(reader
, &IID_IWMProfile
, TRUE
);
153 check_interface(reader
, &IID_IWMProfile2
, TRUE
);
154 check_interface(reader
, &IID_IWMProfile3
, TRUE
);
155 todo_wine
check_interface(reader
, &IID_IWMPacketSize
, TRUE
);
156 todo_wine
check_interface(reader
, &IID_IWMPacketSize2
, TRUE
);
157 todo_wine
check_interface(reader
, &IID_IWMReaderTimecode
, TRUE
);
158 todo_wine
check_interface(reader
, &IID_IWMReaderPlaylistBurn
, TRUE
);
159 todo_wine
check_interface(reader
, &IID_IWMLanguageList
, TRUE
);
161 IWMSyncReader_Release(reader
);
165 static void test_profile_manager_interfaces(void)
168 IWMProfileManager
*profile
;
170 hr
= WMCreateProfileManager(&profile
);
171 ok(hr
== S_OK
, "WMCreateProfileManager failed 0x%08x\n", hr
);
174 win_skip("Failed to create IWMProfileManager\n");
178 IWMProfileManager_Release(profile
);
181 static void test_WMCreateWriterPriv(void)
183 IWMWriter
*writer
, *writer2
;
186 hr
= WMCreateWriterPriv(&writer
);
187 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
189 hr
= IWMWriter_QueryInterface(writer
, &IID_IWMWriter
, (void**)&writer2
);
190 ok(hr
== S_OK
, "got 0x%08x\n", hr
);
192 IWMWriter_Release(writer
);
193 IWMWriter_Release(writer2
);
196 static void test_urlextension(void)
200 hr
= WMCheckURLExtension(NULL
);
201 ok(hr
== E_INVALIDARG
, "WMCheckURLExtension failed 0x%08x\n", hr
);
202 hr
= WMCheckURLExtension(L
"test.mkv");
203 ok(hr
== NS_E_INVALID_NAME
, "WMCheckURLExtension failed 0x%08x\n", hr
);
204 hr
= WMCheckURLExtension(L
"test.mp3");
205 todo_wine
ok(hr
== S_OK
, "WMCheckURLExtension failed 0x%08x\n", hr
);
206 hr
= WMCheckURLExtension(L
"abcd://test/test.wmv");
207 todo_wine
ok(hr
== S_OK
, "WMCheckURLExtension failed 0x%08x\n", hr
);
208 hr
= WMCheckURLExtension(L
"http://test/t.asf?alt=t.mkv");
209 todo_wine
ok(hr
== S_OK
, "WMCheckURLExtension failed 0x%08x\n", hr
);
212 static void test_iscontentprotected(void)
217 hr
= WMIsContentProtected(NULL
, NULL
);
218 ok(hr
== E_INVALIDARG
, "WMIsContentProtected failed 0x%08x\n", hr
);
219 hr
= WMIsContentProtected(NULL
, &drm
);
220 ok(hr
== E_INVALIDARG
, "WMIsContentProtected failed 0x%08x\n", hr
);
221 hr
= WMIsContentProtected(L
"test.mp3", NULL
);
222 ok(hr
== E_INVALIDARG
, "WMIsContentProtected failed 0x%08x\n", hr
);
223 hr
= WMIsContentProtected(L
"test.mp3", &drm
);
224 ok(hr
== S_FALSE
, "WMIsContentProtected failed 0x%08x\n", hr
);
225 ok(drm
== FALSE
, "got %0dx\n", drm
);
232 hr
= CoInitialize(0);
233 ok(hr
== S_OK
, "failed to init com\n");
237 test_wmreader_interfaces();
238 test_wmsyncreader_interfaces();
239 test_wmwriter_interfaces();
240 test_profile_manager_interfaces();
241 test_WMCreateWriterPriv();
243 test_iscontentprotected();