[PATCH] dsound/tests: Add media object query tests

Alistair Leslie-Hughes leslie_alistair at hotmail.com
Wed Nov 6 16:02:59 CST 2019


Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
---
 dlls/dsound/tests/dsound8.c | 60 +++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index b66275973f..c99c6e8153 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -1424,6 +1424,50 @@ static void test_effects(void)
     while (IDirectSound8_Release(dso));
 }
 
+static void test_dsfx_interfaces(IUnknown *dmo, REFGUID refguid)
+{
+    HRESULT rc;
+    IMediaObject *mediaobject;
+    IMediaObjectInPlace *inplace;
+    IUnknown *parent, *obj;
+
+    rc = IUnknown_QueryInterface(dmo, &IID_IMediaObject, (void**)&mediaobject);
+    ok(rc == DS_OK, "Failed: %08x\n", rc);
+    if (rc == DS_OK)
+    {
+        rc = IMediaObject_QueryInterface(mediaobject, &IID_IUnknown, (void**)&obj);
+        ok(rc == S_OK, "Failed: %08x\n", rc);
+        ok((IUnknown *)mediaobject != obj, "Objects are equal\n");
+        ok(dmo != obj, "Objects are equal\n");
+        IUnknown_Release(obj);
+
+        rc = IMediaObject_QueryInterface(mediaobject, refguid, (void**)&parent);
+        ok(rc == S_OK, "got: %08x\n", rc);
+        ok(dmo == parent, "Objects not equal\n");
+        IUnknown_Release(parent);
+
+        IMediaObject_Release(mediaobject);
+    }
+
+    rc = IUnknown_QueryInterface(dmo, &IID_IMediaObject, (void**)&inplace);
+    ok(rc == DS_OK, "Failed: %08x\n", rc);
+    if (rc == DS_OK)
+    {
+        rc = IMediaObjectInPlace_QueryInterface(inplace, &IID_IUnknown, (void**)&obj);
+        ok(rc == S_OK, "Failed: %08x\n", rc);
+        ok((IUnknown *)inplace != obj, "Objects are equal\n");
+        ok(dmo != obj, "Objects are equal\n");
+        IUnknown_Release(obj);
+
+        rc = IMediaObjectInPlace_QueryInterface(inplace, refguid, (void**)&parent);
+        ok(rc == S_OK, "got: %08x\n", rc);
+        ok(dmo == parent, "Objects not equal\n");
+        IUnknown_Release(parent);
+
+        IMediaObjectInPlace_Release(inplace);
+    }
+}
+
 static void test_echo_parameters(IDirectSoundBuffer8 *secondary8)
 {
     HRESULT rc;
@@ -1446,6 +1490,8 @@ static void test_echo_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.lPanDelay == 0, "got %d\n", params.lPanDelay);
         }
 
+        test_dsfx_interfaces( (IUnknown *)echo, &IID_IDirectSoundFXEcho);
+
         IDirectSoundFXEcho_Release(echo);
     }
 }
@@ -1469,6 +1515,8 @@ static void test_gargle_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.dwWaveShape == DSFXGARGLE_WAVE_TRIANGLE, "got %d\n", params.dwWaveShape);
         }
 
+        test_dsfx_interfaces( (IUnknown *)gargle, &IID_IDirectSoundFXGargle);
+
         IDirectSoundFXGargle_Release(gargle);
     }
 }
@@ -1497,6 +1545,8 @@ static void test_chorus_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.lPhase == 3, "got %d\n", params.lPhase);
         }
 
+        test_dsfx_interfaces( (IUnknown *)chorus, &IID_IDirectSoundFXChorus);
+
         IDirectSoundFXChorus_Release(chorus);
     }
 }
@@ -1525,6 +1575,8 @@ static void test_flanger_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.lPhase == 2, "got %d\n", params.lPhase);
         }
 
+        test_dsfx_interfaces( (IUnknown *)flanger, &IID_IDirectSoundFXFlanger);
+
         IDirectSoundFXFlanger_Release(flanger);
     }
 }
@@ -1551,6 +1603,8 @@ static void test_distortion_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.fPreLowpassCutoff == 3675.0f, "got %f\n", params.fPreLowpassCutoff);
         }
 
+        test_dsfx_interfaces( (IUnknown *)distortion, &IID_IDirectSoundFXDistortion);
+
         IDirectSoundFXDistortion_Release(distortion);
     }
 }
@@ -1577,6 +1631,8 @@ static void test_compressor_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.fPredelay == 4.0f, "got %f\n", params.fPredelay);
         }
 
+        test_dsfx_interfaces( (IUnknown *)compressor, &IID_IDirectSoundFXCompressor);
+
         IDirectSoundFXCompressor_Release(compressor);
     }
 }
@@ -1601,6 +1657,8 @@ static void test_parameq_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.fGain == 0.0f, "got %f\n", params.fGain);
         }
 
+        test_dsfx_interfaces( (IUnknown *)parameq, &IID_IDirectSoundFXParamEq);
+
         IDirectSoundFXParamEq_Release(parameq);
     }
 }
@@ -1632,6 +1690,8 @@ static void test_reverb_parameters(IDirectSoundBuffer8 *secondary8)
             ok(params.flHFReference == 5000.0f, "got %f\n", params.flHFReference);
         }
 
+        test_dsfx_interfaces( (IUnknown *)reverb, &IID_IDirectSoundFXI3DL2Reverb);
+
         IDirectSoundFXI3DL2Reverb_Release(reverb);
     }
 }
-- 
2.17.1




More information about the wine-devel mailing list