user32: Check the DpiScalingVer registry key to enable DPI scaling.
[wine.git] / dlls / msdmo / tests / msdmo.c
blob7617123aa52920105782041c83ee3b69ff857d73
1 /*
2 * MSDMO tests
4 * Copyright 2014 Nikolay Sivov for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdio.h>
22 #define COBJMACROS
23 #include "dmo.h"
24 #include "wine/test.h"
26 DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
27 static const GUID GUID_unknowndmo = {0x14d99047,0x441f,0x4cd3,{0xbc,0xa8,0x3e,0x67,0x99,0xaf,0x34,0x75}};
28 static const GUID GUID_unknowncategory = {0x14d99048,0x441f,0x4cd3,{0xbc,0xa8,0x3e,0x67,0x99,0xaf,0x34,0x75}};
29 static const GUID GUID_wmp1 = {0x13a7995e,0x7d8f,0x45b4,{0x9c,0x77,0x81,0x92,0x65,0x22,0x57,0x63}};
31 static const char *guid_to_string(const GUID *guid)
33 static char buffer[50];
34 sprintf(buffer, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
35 guid->Data1, guid->Data2, guid->Data3,
36 guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
37 guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
38 return buffer;
41 static void test_DMOUnregister(void)
43 static char buffer[200];
44 static const WCHAR testdmoW[] = {'t','e','s','t','d','m','o',0};
45 HRESULT hr;
47 hr = DMOUnregister(&GUID_unknowndmo, &GUID_unknowncategory);
48 ok(hr == S_FALSE, "got 0x%08x\n", hr);
50 hr = DMOUnregister(&GUID_unknowndmo, &GUID_NULL);
51 ok(hr == S_FALSE, "got 0x%08x\n", hr);
53 /* can't register for all categories */
54 hr = DMORegister(testdmoW, &GUID_unknowndmo, &GUID_NULL, 0, 0, NULL, 0, NULL);
55 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
57 hr = DMORegister(testdmoW, &GUID_unknowndmo, &GUID_unknowncategory, 0, 0, NULL, 0, NULL);
58 if (hr != S_OK) {
59 win_skip("Failed to register DMO. Probably user doesn't have persmissions to do so.\n");
60 return;
63 hr = DMOUnregister(&GUID_unknowndmo, &GUID_NULL);
64 ok(hr == S_OK, "got 0x%08x\n", hr);
66 hr = DMOUnregister(&GUID_unknowndmo, &GUID_NULL);
67 ok(hr == S_FALSE, "got 0x%08x\n", hr);
69 /* clean up category since Windows doesn't */
70 sprintf(buffer, "DirectShow\\MediaObjects\\Categories\\%s", guid_to_string(&GUID_unknowncategory));
71 RegDeleteKeyA(HKEY_CLASSES_ROOT, buffer);
74 static void test_DMOGetName(void)
76 WCHAR name[80];
77 HRESULT hr;
79 hr = DMOGetName(&GUID_unknowndmo, NULL);
80 ok(hr == E_FAIL, "got 0x%08x\n", hr);
82 /* no such DMO */
83 name[0] = 'a';
84 hr = DMOGetName(&GUID_wmp1, name);
85 ok(hr == E_FAIL, "got 0x%08x\n", hr);
86 ok(name[0] == 'a', "got %x\n", name[0]);
89 static void test_DMOEnum(void)
91 IEnumDMO *enum_dmo;
92 HRESULT hr;
93 CLSID clsid;
94 WCHAR *name;
95 DWORD count;
97 hr = DMOEnum(&GUID_unknowncategory, 0, 0, NULL, 0, NULL, &enum_dmo);
98 ok(hr == S_OK, "DMOEnum() failed with %#x\n", hr);
100 hr = IEnumDMO_Next(enum_dmo, 1, &clsid, &name, NULL);
101 ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
103 hr = IEnumDMO_Next(enum_dmo, 2, &clsid, &name, NULL);
104 ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
106 hr = IEnumDMO_Next(enum_dmo, 2, &clsid, &name, &count);
107 ok(hr == S_FALSE, "expected S_FALSE, got %#x\n", hr);
108 ok(count == 0, "expected 0, got %d\n", count);
110 IEnumDMO_Release(enum_dmo);
113 START_TEST(msdmo)
115 test_DMOUnregister();
116 test_DMOGetName();
117 test_DMOEnum();