2 * Unit tests for IDxDiagContainer
4 * Copyright 2010 Andrew Nguyen
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
26 #include "wine/test.h"
28 static IDxDiagProvider
*pddp
;
29 static IDxDiagContainer
*pddc
;
31 static BOOL
create_root_IDxDiagContainer(void)
34 DXDIAG_INIT_PARAMS params
;
36 hr
= CoCreateInstance(&CLSID_DxDiagProvider
, NULL
, CLSCTX_INPROC_SERVER
,
37 &IID_IDxDiagProvider
, (LPVOID
*)&pddp
);
40 params
.dwSize
= sizeof(params
);
41 params
.dwDxDiagHeaderVersion
= DXDIAG_DX9_SDK_VERSION
;
42 params
.bAllowWHQLChecks
= FALSE
;
43 params
.pReserved
= NULL
;
44 hr
= IDxDiagProvider_Initialize(pddp
, ¶ms
);
47 hr
= IDxDiagProvider_GetRootContainer(pddp
, &pddc
);
51 IDxDiagProvider_Release(pddp
);
56 static void test_GetNumberOfChildContainers(void)
61 if (!create_root_IDxDiagContainer())
63 skip("Unable to create the root IDxDiagContainer\n");
67 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, NULL
);
68 ok(hr
== E_INVALIDARG
,
69 "Expected IDxDiagContainer::GetNumberOfChildContainers to return E_INVALIDARG, got 0x%08x\n", hr
);
71 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
73 "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
75 ok(count
!= 0, "Expected the number of child containers for the root container to be non-zero\n");
77 IDxDiagContainer_Release(pddc
);
78 IDxDiagProvider_Release(pddp
);
81 static void test_GetNumberOfProps(void)
86 if (!create_root_IDxDiagContainer())
88 skip("Unable to create the root IDxDiagContainer\n");
92 hr
= IDxDiagContainer_GetNumberOfProps(pddc
, NULL
);
93 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetNumberOfProps to return E_INVALIDARG, got 0x%08x\n", hr
);
95 hr
= IDxDiagContainer_GetNumberOfProps(pddc
, &count
);
96 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
98 ok(count
== 0, "Expected the number of properties for the root container to be zero\n");
100 IDxDiagContainer_Release(pddc
);
101 IDxDiagProvider_Release(pddp
);
104 static void test_EnumChildContainerNames(void)
107 WCHAR container
[256];
108 DWORD maxcount
, index
;
109 static const WCHAR testW
[] = {'t','e','s','t',0};
110 static const WCHAR zerotestW
[] = {0,'e','s','t',0};
112 if (!create_root_IDxDiagContainer())
114 skip("Unable to create the root IDxDiagContainer\n");
118 /* Test various combinations of invalid parameters. */
119 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, NULL
, 0);
120 ok(hr
== E_INVALIDARG
,
121 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
123 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, NULL
, sizeof(container
)/sizeof(WCHAR
));
124 ok(hr
== E_INVALIDARG
,
125 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
127 /* Test the conditions in which the output buffer can be modified. */
128 memcpy(container
, testW
, sizeof(testW
));
129 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, container
, 0);
130 ok(hr
== E_INVALIDARG
,
131 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
132 ok(!memcmp(container
, testW
, sizeof(testW
)),
133 "Expected the container buffer to be untouched, got %s\n", wine_dbgstr_w(container
));
135 memcpy(container
, testW
, sizeof(testW
));
136 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, ~0, container
, 0);
137 ok(hr
== E_INVALIDARG
,
138 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
139 ok(!memcmp(container
, testW
, sizeof(testW
)),
140 "Expected the container buffer to be untouched, got %s\n", wine_dbgstr_w(container
));
142 memcpy(container
, testW
, sizeof(testW
));
143 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, ~0, container
, sizeof(container
)/sizeof(WCHAR
));
144 ok(hr
== E_INVALIDARG
,
145 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG, got 0x%08x\n", hr
);
146 ok(!memcmp(container
, zerotestW
, sizeof(zerotestW
)),
147 "Expected the container buffer string to be empty, got %s\n", wine_dbgstr_w(container
));
149 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &maxcount
);
150 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
153 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
157 trace("Starting child container enumeration of the root container:\n");
159 /* We should be able to enumerate as many child containers as the value
160 * that IDxDiagContainer::GetNumberOfChildContainers returns. */
161 for (index
= 0; index
<= maxcount
; index
++)
163 /* A buffer size of 1 is unlikely to be valid, as only a null terminator
164 * could be stored, and it is unlikely that a container name could be empty. */
165 DWORD buffersize
= 1;
166 memcpy(container
, testW
, sizeof(testW
));
167 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, buffersize
);
168 if (hr
== E_INVALIDARG
)
170 /* We should get here when index is one more than the maximum index value. */
171 ok(maxcount
== index
,
172 "Expected IDxDiagContainer::EnumChildContainerNames to return E_INVALIDARG "
173 "on the last index %d, got 0x%08x\n", index
, hr
);
174 ok(container
[0] == '\0',
175 "Expected the container buffer string to be empty, got %s\n", wine_dbgstr_w(container
));
178 else if (hr
== DXDIAG_E_INSUFFICIENT_BUFFER
)
182 ok(container
[0] == '\0',
183 "Expected the container buffer string to be empty, got %s\n", wine_dbgstr_w(container
));
185 /* Get the container name to compare against. */
186 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, temp
, sizeof(temp
)/sizeof(WCHAR
));
188 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
190 /* Show that the DirectX SDK's stipulation that the buffer be at
191 * least 256 characters long is a mere suggestion, and smaller sizes
192 * can be acceptable also. IDxDiagContainer::EnumChildContainerNames
193 * doesn't provide a way of getting the exact size required, so the
194 * buffersize value will be iterated to at most 256 characters. */
195 for (buffersize
= 2; buffersize
<= 256; buffersize
++)
197 memcpy(container
, testW
, sizeof(testW
));
198 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, buffersize
);
199 if (hr
!= DXDIAG_E_INSUFFICIENT_BUFFER
)
202 ok(!memcmp(temp
, container
, sizeof(WCHAR
)*(buffersize
- 1)),
203 "Expected truncated container name string, got %s\n", wine_dbgstr_w(container
));
207 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, "
208 "got hr = 0x%08x, buffersize = %d\n", hr
, buffersize
);
210 trace("pddc[%d] = %s, length = %d\n", index
, wine_dbgstr_w(container
), buffersize
);
214 ok(0, "IDxDiagContainer::EnumChildContainerNames unexpectedly returned 0x%08x\n", hr
);
220 IDxDiagContainer_Release(pddc
);
221 IDxDiagProvider_Release(pddp
);
224 static void test_GetChildContainer(void)
227 WCHAR container
[256] = {0};
228 IDxDiagContainer
*child
;
230 if (!create_root_IDxDiagContainer())
232 skip("Unable to create the root IDxDiagContainer\n");
236 /* Test various combinations of invalid parameters. */
237 hr
= IDxDiagContainer_GetChildContainer(pddc
, NULL
, NULL
);
238 ok(hr
== E_INVALIDARG
,
239 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
241 child
= (void*)0xdeadbeef;
242 hr
= IDxDiagContainer_GetChildContainer(pddc
, NULL
, &child
);
243 ok(hr
== E_INVALIDARG
,
244 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
245 ok(child
== (void*)0xdeadbeef, "Expected output pointer to be unchanged, got %p\n", child
);
247 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, NULL
);
248 ok(hr
== E_INVALIDARG
,
249 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
251 child
= (void*)0xdeadbeef;
252 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
253 ok(hr
== E_INVALIDARG
,
254 "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr
);
255 ok(child
== NULL
, "Expected output pointer to be NULL, got %p\n", child
);
257 /* Get the name of a suitable child container. */
258 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, 0, container
, sizeof(container
)/sizeof(WCHAR
));
260 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
263 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
267 child
= (void*)0xdeadbeef;
268 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
270 "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
271 ok(child
!= NULL
&& child
!= (void*)0xdeadbeef, "Expected a valid output pointer, got %p\n", child
);
275 IDxDiagContainer
*ptr
;
277 /* Show that IDxDiagContainer::GetChildContainer returns a different pointer
278 * for multiple calls for the same container name. */
279 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &ptr
);
281 "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
283 todo_wine
ok(ptr
!= child
, "Expected the two pointers (%p vs. %p) to be unequal\n", child
, ptr
);
285 IDxDiagContainer_Release(ptr
);
286 IDxDiagContainer_Release(child
);
290 IDxDiagContainer_Release(pddc
);
291 IDxDiagProvider_Release(pddp
);
294 static void test_dot_parsing(void)
297 WCHAR containerbufW
[256] = {0}, childbufW
[256] = {0};
303 const HRESULT expect
;
307 { ".%s.%s", E_INVALIDARG
},
308 { "%s.%s..", E_INVALIDARG
},
309 { ".%s.%s.", E_INVALIDARG
},
310 { "..%s.%s", E_INVALIDARG
},
313 if (!create_root_IDxDiagContainer())
315 skip("Unable to create the root IDxDiagContainer\n");
319 /* Find a container with a child container of its own. */
320 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
321 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
324 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
328 for (index
= 0; index
< count
; index
++)
330 IDxDiagContainer
*child
;
332 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, containerbufW
, sizeof(containerbufW
)/sizeof(WCHAR
));
333 ok(hr
== S_OK
, "Expected IDxDiagContainer_EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
336 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
340 hr
= IDxDiagContainer_GetChildContainer(pddc
, containerbufW
, &child
);
341 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
345 hr
= IDxDiagContainer_EnumChildContainerNames(child
, 0, childbufW
, sizeof(childbufW
)/sizeof(WCHAR
));
346 ok(hr
== S_OK
|| hr
== E_INVALIDARG
,
347 "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK or E_INVALIDARG, got 0x%08x\n", hr
);
348 IDxDiagContainer_Release(child
);
355 if (!*containerbufW
|| !*childbufW
)
357 skip("Unable to find a suitable container\n");
361 trace("Testing IDxDiagContainer::GetChildContainer dot parsing with container %s and child container %s.\n",
362 wine_dbgstr_w(containerbufW
), wine_dbgstr_w(childbufW
));
364 for (i
= 0; i
< sizeof(test_strings
)/sizeof(test_strings
[0]); i
++)
366 IDxDiagContainer
*child
;
367 char containerbufA
[256];
369 char dotbufferA
[255 + 255 + 3 + 1];
370 WCHAR dotbufferW
[255 + 255 + 3 + 1]; /* containerbuf + childbuf + dots + null terminator */
372 WideCharToMultiByte(CP_ACP
, 0, containerbufW
, -1, containerbufA
, sizeof(containerbufA
), NULL
, NULL
);
373 WideCharToMultiByte(CP_ACP
, 0, childbufW
, -1, childbufA
, sizeof(childbufA
), NULL
, NULL
);
374 sprintf(dotbufferA
, test_strings
[i
].format
, containerbufA
, childbufA
);
375 MultiByteToWideChar(CP_ACP
, 0, dotbufferA
, -1, dotbufferW
, sizeof(dotbufferW
)/sizeof(WCHAR
));
377 trace("Trying container name %s\n", wine_dbgstr_w(dotbufferW
));
378 hr
= IDxDiagContainer_GetChildContainer(pddc
, dotbufferW
, &child
);
379 ok(hr
== test_strings
[i
].expect
,
380 "Expected IDxDiagContainer::GetChildContainer to return 0x%08x for %s, got 0x%08x\n",
381 test_strings
[i
].expect
, wine_dbgstr_w(dotbufferW
), hr
);
383 IDxDiagContainer_Release(child
);
387 IDxDiagContainer_Release(pddc
);
388 IDxDiagProvider_Release(pddp
);
391 static void test_EnumPropNames(void)
394 WCHAR container
[256], property
[256];
395 IDxDiagContainer
*child
= NULL
;
396 DWORD count
, index
, propcount
;
397 static const WCHAR testW
[] = {'t','e','s','t',0};
399 if (!create_root_IDxDiagContainer())
401 skip("Unable to create the root IDxDiagContainer\n");
405 /* Find a container with a non-zero number of properties. */
406 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
407 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
410 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
414 for (index
= 0; index
< count
; index
++)
416 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, sizeof(container
)/sizeof(WCHAR
));
417 ok(hr
== S_OK
, "Expected IDxDiagContainer_EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
420 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
424 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
425 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
429 hr
= IDxDiagContainer_GetNumberOfProps(child
, &propcount
);
430 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr
);
434 IDxDiagContainer_Release(child
);
444 skip("Unable to find a container with non-zero property count\n");
448 hr
= IDxDiagContainer_EnumPropNames(child
, ~0, NULL
, 0);
449 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG, got 0x%08x\n", hr
);
451 memcpy(property
, testW
, sizeof(testW
));
452 hr
= IDxDiagContainer_EnumPropNames(child
, ~0, property
, 0);
453 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG, got 0x%08x\n", hr
);
454 ok(!memcmp(property
, testW
, sizeof(testW
)),
455 "Expected the property buffer to be unchanged, got %s\n", wine_dbgstr_w(property
));
457 memcpy(property
, testW
, sizeof(testW
));
458 hr
= IDxDiagContainer_EnumPropNames(child
, ~0, property
, sizeof(property
)/sizeof(WCHAR
));
459 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG, got 0x%08x\n", hr
);
460 ok(!memcmp(property
, testW
, sizeof(testW
)),
461 "Expected the property buffer to be unchanged, got %s\n", wine_dbgstr_w(property
));
463 trace("Starting property enumeration of the %s container:\n", wine_dbgstr_w(container
));
465 /* We should be able to enumerate as many properties as the value that
466 * IDxDiagContainer::GetNumberOfProps returns. */
467 for (index
= 0; index
<= propcount
; index
++)
469 /* A buffer size of 1 is unlikely to be valid, as only a null terminator
470 * could be stored, and it is unlikely that a property name could be empty. */
471 DWORD buffersize
= 1;
473 memcpy(property
, testW
, sizeof(testW
));
474 hr
= IDxDiagContainer_EnumPropNames(child
, index
, property
, buffersize
);
475 if (hr
== E_INVALIDARG
)
477 /* We should get here when index is one more than the maximum index value. */
478 ok(propcount
== index
,
479 "Expected IDxDiagContainer::EnumPropNames to return E_INVALIDARG "
480 "on the last index %d, got 0x%08x\n", index
, hr
);
481 ok(!memcmp(property
, testW
, sizeof(testW
)),
482 "Expected the property buffer to be unchanged, got %s\n", wine_dbgstr_w(property
));
485 else if (hr
== DXDIAG_E_INSUFFICIENT_BUFFER
)
489 ok(property
[0] == '\0',
490 "Expected the property buffer string to be empty, got %s\n", wine_dbgstr_w(property
));
491 hr
= IDxDiagContainer_EnumPropNames(child
, index
, temp
, sizeof(temp
)/sizeof(WCHAR
));
493 "Expected IDxDiagContainer::EnumPropNames to return S_OK, got 0x%08x\n", hr
);
495 /* Show that the DirectX SDK's stipulation that the buffer be at
496 * least 256 characters long is a mere suggestion, and smaller sizes
497 * can be acceptable also. IDxDiagContainer::EnumPropNames doesn't
498 * provide a way of getting the exact size required, so the buffersize
499 * value will be iterated to at most 256 characters. */
500 for (buffersize
= 2; buffersize
<= 256; buffersize
++)
502 memcpy(property
, testW
, sizeof(testW
));
503 hr
= IDxDiagContainer_EnumPropNames(child
, index
, property
, buffersize
);
504 if (hr
!= DXDIAG_E_INSUFFICIENT_BUFFER
)
507 ok(!memcmp(temp
, property
, sizeof(WCHAR
)*(buffersize
- 1)),
508 "Expected truncated property name string, got %s\n", wine_dbgstr_w(property
));
512 "Expected IDxDiagContainer::EnumPropNames to return S_OK, "
513 "got hr = 0x%08x, buffersize = %d\n", hr
, buffersize
);
515 trace("child[%d] = %s, length = %d\n", index
, wine_dbgstr_w(property
), buffersize
);
519 ok(0, "IDxDiagContainer::EnumPropNames unexpectedly returned 0x%08x\n", hr
);
524 IDxDiagContainer_Release(child
);
527 IDxDiagContainer_Release(pddc
);
528 IDxDiagProvider_Release(pddp
);
531 static void test_GetProp(void)
534 WCHAR container
[256], property
[256];
535 IDxDiagContainer
*child
= NULL
;
539 SAFEARRAYBOUND bound
;
540 static const WCHAR emptyW
[] = {0};
541 static const WCHAR testW
[] = {'t','e','s','t',0};
543 if (!create_root_IDxDiagContainer())
545 skip("Unable to create the root IDxDiagContainer\n");
549 /* Find a container with a property. */
550 hr
= IDxDiagContainer_GetNumberOfChildContainers(pddc
, &count
);
551 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr
);
554 skip("IDxDiagContainer::GetNumberOfChildContainers failed\n");
558 for (index
= 0; index
< count
; index
++)
560 hr
= IDxDiagContainer_EnumChildContainerNames(pddc
, index
, container
, sizeof(container
)/sizeof(WCHAR
));
561 ok(hr
== S_OK
, "Expected IDxDiagContainer_EnumChildContainerNames to return S_OK, got 0x%08x\n", hr
);
564 skip("IDxDiagContainer::EnumChildContainerNames failed\n");
568 hr
= IDxDiagContainer_GetChildContainer(pddc
, container
, &child
);
569 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr
);
573 hr
= IDxDiagContainer_EnumPropNames(child
, 0, property
, sizeof(property
)/sizeof(WCHAR
));
574 ok(hr
== S_OK
|| hr
== E_INVALIDARG
,
575 "Expected IDxDiagContainer::EnumPropNames to return S_OK or E_INVALIDARG, got 0x%08x\n", hr
);
581 IDxDiagContainer_Release(child
);
589 skip("Unable to find a suitable container\n");
593 hr
= IDxDiagContainer_GetProp(child
, NULL
, NULL
);
594 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
597 hr
= IDxDiagContainer_GetProp(child
, NULL
, &var
);
598 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
599 ok(V_VT(&var
) == 0xdead, "Expected the variant to be untouched, got %u\n", V_VT(&var
));
601 hr
= IDxDiagContainer_GetProp(child
, emptyW
, NULL
);
602 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
605 hr
= IDxDiagContainer_GetProp(child
, emptyW
, &var
);
606 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
607 ok(V_VT(&var
) == 0xdead, "Expected the variant to be untouched, got %u\n", V_VT(&var
));
609 hr
= IDxDiagContainer_GetProp(child
, testW
, NULL
);
610 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
613 hr
= IDxDiagContainer_GetProp(child
, testW
, &var
);
614 ok(hr
== E_INVALIDARG
, "Expected IDxDiagContainer::GetProp to return E_INVALIDARG, got 0x%08x\n", hr
);
615 ok(V_VT(&var
) == 0xdead, "Expected the variant to be untouched, got %u\n", V_VT(&var
));
618 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
619 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
620 ok(V_VT(&var
) != VT_EMPTY
, "Expected the variant to be modified, got %d\n", V_VT(&var
));
622 /* Since the documentation for IDxDiagContainer::GetProp claims that the
623 * function reports return values from VariantCopy, try to exercise failure
624 * paths in handling the destination variant. */
626 /* Try an invalid variant type. */
628 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
629 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
630 ok(V_VT(&var
) != 0xdead, "Expected the variant to be modified, got %d\n", V_VT(&var
));
632 /* Try passing a variant with a locked SAFEARRAY. */
635 sa
= SafeArrayCreate(VT_UI1
, 1, &bound
);
636 ok(sa
!= NULL
, "Expected SafeArrayCreate to return a valid pointer\n");
638 V_VT(&var
) = (VT_ARRAY
| VT_UI1
);
641 hr
= SafeArrayLock(sa
);
642 ok(hr
== S_OK
, "Expected SafeArrayLock to return S_OK, got 0x%08x\n", hr
);
644 hr
= IDxDiagContainer_GetProp(child
, property
, &var
);
645 ok(hr
== S_OK
, "Expected IDxDiagContainer::GetProp to return S_OK, got 0x%08x\n", hr
);
646 ok(V_VT(&var
) != (VT_ARRAY
| VT_UI1
), "Expected the variant to be modified\n");
648 hr
= SafeArrayUnlock(sa
);
649 ok(hr
== S_OK
, "Expected SafeArrayUnlock to return S_OK, got 0x%08x\n", hr
);
650 hr
= SafeArrayDestroy(sa
);
651 ok(hr
== S_OK
, "Expected SafeArrayDestroy to return S_OK, got 0x%08x\n", hr
);
652 IDxDiagContainer_Release(child
);
655 IDxDiagContainer_Release(pddc
);
656 IDxDiagProvider_Release(pddp
);
659 START_TEST(container
)
662 test_GetNumberOfChildContainers();
663 test_GetNumberOfProps();
664 test_EnumChildContainerNames();
665 test_GetChildContainer();
667 test_EnumPropNames();