https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4203ed112ef687cc179ff2ef8a5b4083edc34917

commit 4203ed112ef687cc179ff2ef8a5b4083edc34917
Author:     Amine Khaldi <[email protected]>
AuthorDate: Thu Mar 8 13:41:10 2018 +0100
Commit:     Amine Khaldi <[email protected]>
CommitDate: Thu Mar 8 13:41:10 2018 +0100

    [DXDIAGN_WINETEST] Sync with Wine Staging 3.3. CORE-14434
---
 modules/rostests/winetests/dxdiagn/container.c | 172 ++++++++++++++++++++++++-
 modules/rostests/winetests/dxdiagn/provider.c  |   6 +-
 2 files changed, 171 insertions(+), 7 deletions(-)

diff --git a/modules/rostests/winetests/dxdiagn/container.c 
b/modules/rostests/winetests/dxdiagn/container.c
index 3da9985b8d..2e58493a8f 100644
--- a/modules/rostests/winetests/dxdiagn/container.c
+++ b/modules/rostests/winetests/dxdiagn/container.c
@@ -21,9 +21,9 @@
 #define COBJMACROS
 
 #include <stdio.h>
-#include <wine/dxdiag.h>
-#include <oleauto.h>
-#include <wine/test.h>
+#include "wine/dxdiag.h"
+#include "oleauto.h"
+#include "wine/test.h"
 
 struct property_test
 {
@@ -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);
     }
 
@@ -942,6 +959,7 @@ static void test_DxDiag_DisplayDevices(void)
     static const WCHAR b3DAccelerationExists[] = 
{'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','x','i','s','t','s',0};
     static const WCHAR b3DAccelerationEnabled[] = 
{'b','3','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0};
     static const WCHAR bDDAccelerationEnabled[] = 
{'b','D','D','A','c','c','e','l','e','r','a','t','i','o','n','E','n','a','b','l','e','d',0};
+    static const WCHAR iAdapter[] = {'i','A','d','a','p','t','e','r',0};
 
     static const struct property_test property_tests[] =
     {
@@ -966,6 +984,7 @@ static void test_DxDiag_DisplayDevices(void)
         {b3DAccelerationExists, VT_BOOL},
         {b3DAccelerationEnabled, VT_BOOL},
         {bDDAccelerationEnabled, VT_BOOL},
+        {iAdapter, VT_UI4},
     };
 
     IDxDiagContainer *display_cont = NULL;
@@ -1020,6 +1039,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 +1196,7 @@ START_TEST(container)
     test_root_children();
     test_DxDiag_SystemInfo();
     test_DxDiag_DisplayDevices();
+    test_DxDiag_SoundDevices();
+    test_DxDiag_SoundCaptureDevices();
     CoUninitialize();
 }
diff --git a/modules/rostests/winetests/dxdiagn/provider.c 
b/modules/rostests/winetests/dxdiagn/provider.c
index bd30c31c77..2364e2aef8 100644
--- a/modules/rostests/winetests/dxdiagn/provider.c
+++ b/modules/rostests/winetests/dxdiagn/provider.c
@@ -20,9 +20,9 @@
 
 #define COBJMACROS
 
-#include <initguid.h>
-#include <wine/dxdiag.h>
-#include <wine/test.h>
+#include "initguid.h"
+#include "wine/dxdiag.h"
+#include "wine/test.h"
 
 static void test_Initialize(void)
 {

Reply via email to