mmdevapi: Add some DEVPKEY's to property tests.

This commit is contained in:
Maarten Lankhorst 2010-04-22 22:59:58 +02:00 committed by Alexandre Julliard
parent bbd882a3d2
commit 85339cdb5f
3 changed files with 22 additions and 4 deletions

View File

@ -1211,6 +1211,7 @@ static HRESULT WINAPI MMDevPropStore_GetValue(IPropertyStore *iface, REFPROPERTY
/* Special case */ /* Special case */
if (IsEqualPropertyKey(*key, PKEY_AudioEndpoint_GUID)) if (IsEqualPropertyKey(*key, PKEY_AudioEndpoint_GUID))
{ {
pv->vt = VT_LPWSTR;
pv->u.pwszVal = CoTaskMemAlloc(39 * sizeof(WCHAR)); pv->u.pwszVal = CoTaskMemAlloc(39 * sizeof(WCHAR));
if (!pv->u.pwszVal) if (!pv->u.pwszVal)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;

View File

@ -26,6 +26,7 @@
#include "audioclient.h" #include "audioclient.h"
#include "dshow.h" #include "dshow.h"
#include "dsound.h" #include "dsound.h"
#include "devpkey.h"
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);

View File

@ -29,22 +29,38 @@
#include "unknwn.h" #include "unknwn.h"
#include "uuids.h" #include "uuids.h"
#include "mmdeviceapi.h" #include "mmdeviceapi.h"
#include "devpkey.h"
static void test_propertystore(IPropertyStore *store) static void test_propertystore(IPropertyStore *store)
{ {
HRESULT hr; HRESULT hr;
PROPVARIANT pv = { 0 }; PROPVARIANT pv;
char temp[40]; char temp[128];
temp[sizeof(temp)-1] = 0;
pv.vt = VT_EMPTY;
hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_GUID, &pv); hr = IPropertyStore_GetValue(store, &PKEY_AudioEndpoint_GUID, &pv);
ok(hr == S_OK, "Failed with %08x\n", hr); ok(hr == S_OK, "Failed with %08x\n", hr);
if (hr == S_OK) ok(pv.vt == VT_LPWSTR, "Value should be %i, is %i\n", VT_LPWSTR, pv.vt);
if (hr == S_OK && pv.vt == VT_LPWSTR)
{ {
WideCharToMultiByte(CP_ACP, 0, pv.u.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, pv.u.pwszVal, -1, temp, sizeof(temp)-1, NULL, NULL);
temp[sizeof(temp)-1] = 0;
trace("guid: %s\n", temp); trace("guid: %s\n", temp);
CoTaskMemFree(pv.u.pwszVal); CoTaskMemFree(pv.u.pwszVal);
} }
pv.vt = VT_EMPTY;
hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_FriendlyName, &pv);
ok(hr == S_OK, "Failed with %08x\n", hr);
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
pv.vt = VT_EMPTY;
hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_Enabled, &pv);
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
pv.vt = VT_EMPTY;
hr = IPropertyStore_GetValue(store, (const PROPERTYKEY*)&DEVPKEY_DeviceInterface_ClassGuid, &pv);
ok(pv.vt == VT_EMPTY, "Key should not be found\n");
} }
START_TEST(propstore) START_TEST(propstore)