[PATCH 5/5] shell32/tests: Simple tests for IApplicationAssociationRegistration

Detlef Riekenberg wine.dev at web.de
Sun Jan 15 17:06:16 CST 2012


---
 dlls/shell32/tests/assoc.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/dlls/shell32/tests/assoc.c b/dlls/shell32/tests/assoc.c
index 8d09ec2..488f8e9 100644
--- a/dlls/shell32/tests/assoc.c
+++ b/dlls/shell32/tests/assoc.c
@@ -23,6 +23,7 @@
 
 #include "shlwapi.h"
 #include "shlguid.h"
+#include "shobjidl.h"
 
 #include "wine/test.h"
 
@@ -61,11 +62,47 @@ static void test_IQueryAssociations_QueryInterface(void)
 }
 
 
+static void test_IApplicationAssociationRegistration_QueryInterface(void)
+{
+    IApplicationAssociationRegistration *appreg;
+    IApplicationAssociationRegistration *appreg2;
+    IUnknown *unk;
+    HRESULT hr;
+
+    /* this works since Vista */
+    hr = CoCreateInstance(&CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC_SERVER,
+                          &IID_IApplicationAssociationRegistration, (LPVOID*)&appreg);
+
+    if (FAILED(hr)) {
+        skip("IApplicationAssociationRegistration not created: 0x%x\n", hr);
+        return;
+    }
+
+    hr = IUnknown_QueryInterface(appreg, &IID_IApplicationAssociationRegistration, (void**)&appreg2);
+    ok(hr == S_OK, "QueryInterface (IApplicationAssociationRegistration) returned 0x%x\n", hr);
+    if (SUCCEEDED(hr)) {
+        IUnknown_Release(appreg2);
+    }
+
+    hr = IUnknown_QueryInterface(appreg, &IID_IUnknown, (void**)&unk);
+    ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr);
+    if (SUCCEEDED(hr)) {
+        IUnknown_Release(unk);
+    }
+
+    hr = IUnknown_QueryInterface(appreg, &IID_IUnknown, NULL);
+    ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
+
+    IApplicationAssociationRegistration_Release(appreg);
+}
+
+
 START_TEST(assoc)
 {
     CoInitialize(NULL);
 
     test_IQueryAssociations_QueryInterface();
+    test_IApplicationAssociationRegistration_QueryInterface();
 
     CoUninitialize();
 }
-- 
1.7.5.4




More information about the wine-patches mailing list