[DXDIAGN_WINETEST] Sync with Wine Staging 1.7.55. CORE-10536
authorAmine Khaldi <amine.khaldi@reactos.org>
Tue, 24 Nov 2015 11:02:38 +0000 (11:02 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Tue, 24 Nov 2015 11:02:38 +0000 (11:02 +0000)
svn path=/trunk/; revision=70090

rostests/winetests/dxdiagn/container.c

index 3da9985..3359a97 100644 (file)
@@ -36,6 +36,11 @@ static IDxDiagContainer *pddc;
 
 static const WCHAR DxDiag_SystemInfo[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
 static const WCHAR DxDiag_DisplayDevices[] = {'D','x','D','i','a','g','_','D','i','s','p','l','a','y','D','e','v','i','c','e','s',0};
+static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d','.',
+                                            'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
+static const WCHAR DxDiag_SoundCaptureDevices[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d','.',
+                                                   'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e',
+                                                   'D','e','v','i','c','e','s',0};
 
 /* Based on debugstr_variant in dlls/jscript/jsutils.c. */
 static const char *debugstr_variant(const VARIANT *var)
@@ -896,7 +901,8 @@ static void test_DxDiag_SystemInfo(void)
         {szProcessorEnglish, VT_BSTR},
     };
 
-    IDxDiagContainer *container;
+    IDxDiagContainer *container, *container2;
+    static const WCHAR empty[] = {0};
     HRESULT hr;
 
     if (!create_root_IDxDiagContainer())
@@ -905,6 +911,9 @@ static void test_DxDiag_SystemInfo(void)
         return;
     }
 
+    hr = IDxDiagContainer_GetChildContainer(pddc, empty, &container2);
+    ok(hr == E_INVALIDARG, "Expected IDxDiagContainer::GetChildContainer to return E_INVALIDARG, got 0x%08x\n", hr);
+
     hr = IDxDiagContainer_GetChildContainer(pddc, DxDiag_SystemInfo, &container);
     ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
 
@@ -912,6 +921,14 @@ static void test_DxDiag_SystemInfo(void)
     {
         trace("Testing container DxDiag_SystemInfo\n");
         test_container_properties(container, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+
+        container2 = NULL;
+        hr = IDxDiagContainer_GetChildContainer(container, empty, &container2);
+        ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+        ok(container2 != NULL, "Expected container2 != NULL\n");
+        ok(container2 != container, "Expected container != container2\n");
+        if (hr == S_OK) IDxDiagContainer_Release(container2);
+
         IDxDiagContainer_Release(container);
     }
 
@@ -1020,6 +1037,149 @@ cleanup:
     IDxDiagProvider_Release(pddp);
 }
 
+static void test_DxDiag_SoundDevices(void)
+{
+    static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
+    static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+    static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+    static const WCHAR szDriverName[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
+    static const WCHAR empty[] = {0};
+
+    static const struct property_test property_tests[] =
+    {
+        {szDescription, VT_BSTR},
+        {szGuidDeviceID, VT_BSTR},
+        {szDriverName, VT_BSTR},
+        {szDriverPath, VT_BSTR},
+    };
+
+    IDxDiagContainer *sound_cont = NULL;
+    DWORD count, i;
+    HRESULT hr;
+
+    if (!create_root_IDxDiagContainer())
+    {
+        skip("Unable to create the root IDxDiagContainer\n");
+        return;
+    }
+
+    hr = IDxDiagContainer_GetChildContainer(pddc, DxDiag_SoundDevices, &sound_cont);
+    ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+    if (hr != S_OK)
+        goto cleanup;
+
+    hr = IDxDiagContainer_GetNumberOfProps(sound_cont, &count);
+    ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr);
+    if (hr == S_OK)
+        ok(count == 0, "Expected count to be 0, got %u\n", count);
+
+    hr = IDxDiagContainer_GetNumberOfChildContainers(sound_cont, &count);
+    ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr);
+
+    if (hr != S_OK)
+        goto cleanup;
+
+    for (i = 0; i < count; i++)
+    {
+        WCHAR child_container[256];
+        IDxDiagContainer *child, *child2;
+
+        hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
+        ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
+
+        hr = IDxDiagContainer_GetChildContainer(sound_cont, child_container, &child);
+        ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+        if (hr == S_OK)
+        {
+            trace("Testing container %s\n", wine_dbgstr_w(child_container));
+            test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+        }
+
+        child2 = NULL;
+        hr = IDxDiagContainer_GetChildContainer(child, empty, &child2);
+        ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+        ok(child2 != NULL, "Expected child2 != NULL\n");
+        ok(child2 != child, "Expected child != child2\n");
+        if (hr == S_OK) IDxDiagContainer_Release(child2);
+
+        IDxDiagContainer_Release(child);
+    }
+
+cleanup:
+    if (sound_cont) IDxDiagContainer_Release(sound_cont);
+    IDxDiagContainer_Release(pddc);
+    IDxDiagProvider_Release(pddp);
+}
+
+static void test_DxDiag_SoundCaptureDevices(void)
+{
+    static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
+    static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+    static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+    static const WCHAR szDriverName[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
+
+    static const struct property_test property_tests[] =
+    {
+        {szDescription, VT_BSTR},
+        {szGuidDeviceID, VT_BSTR},
+        {szDriverName, VT_BSTR},
+        {szDriverPath, VT_BSTR},
+    };
+
+    IDxDiagContainer *sound_cont = NULL;
+    DWORD count, i;
+    HRESULT hr;
+
+    if (!create_root_IDxDiagContainer())
+    {
+        skip("Unable to create the root IDxDiagContainer\n");
+        return;
+    }
+
+    hr = IDxDiagContainer_GetChildContainer(pddc, DxDiag_SoundCaptureDevices, &sound_cont);
+    ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+    if (hr != S_OK)
+        goto cleanup;
+
+    hr = IDxDiagContainer_GetNumberOfProps(sound_cont, &count);
+    ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr);
+    if (hr == S_OK)
+        ok(count == 0, "Expected count to be 0, got %u\n", count);
+
+    hr = IDxDiagContainer_GetNumberOfChildContainers(sound_cont, &count);
+    ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr);
+
+    if (hr != S_OK)
+        goto cleanup;
+
+    for (i = 0; i < count; i++)
+    {
+        WCHAR child_container[256];
+        IDxDiagContainer *child;
+
+        hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
+        ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
+
+        hr = IDxDiagContainer_GetChildContainer(sound_cont, child_container, &child);
+        ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+        if (hr == S_OK)
+        {
+            trace("Testing container %s\n", wine_dbgstr_w(child_container));
+            test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+        }
+        IDxDiagContainer_Release(child);
+    }
+
+cleanup:
+    if (sound_cont) IDxDiagContainer_Release(sound_cont);
+    IDxDiagContainer_Release(pddc);
+    IDxDiagProvider_Release(pddp);
+}
+
 START_TEST(container)
 {
     CoInitialize(NULL);
@@ -1034,5 +1194,7 @@ START_TEST(container)
     test_root_children();
     test_DxDiag_SystemInfo();
     test_DxDiag_DisplayDevices();
+    test_DxDiag_SoundDevices();
+    test_DxDiag_SoundCaptureDevices();
     CoUninitialize();
 }