ccb5cdbbcf3f4341adc456fc95376ed060cc4066
[reactos.git] / modules / rostests / winetests / browseui / progressdlg.c
1 /* Unit tests for progressdialog object
2 *
3 * Copyright 2012 Detlef Riekenberg
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
18 */
19
20 #define WIN32_NO_STATUS
21 #define _INC_WINDOWS
22 #define COM_NO_WINDOWS_H
23
24 #define COBJMACROS
25
26 #include <wine/test.h>
27
28 //#include <stdarg.h>
29 #include <shlobj.h>
30
31 static void test_IProgressDialog_QueryInterface(void)
32 {
33 IProgressDialog *dlg;
34 IProgressDialog *dlg2;
35 IOleWindow *olewindow;
36 IUnknown *unk;
37 HRESULT hr;
38
39 hr = CoCreateInstance(&CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, &IID_IProgressDialog, (void*)&dlg);
40 if (FAILED(hr)) {
41 win_skip("CoCreateInstance for IProgressDialog returned 0x%x\n", hr);
42 return;
43 }
44
45 hr = IProgressDialog_QueryInterface(dlg, &IID_IUnknown, NULL);
46 ok(hr == E_POINTER, "got 0x%x (expected E_POINTER)\n", hr);
47
48 hr = IProgressDialog_QueryInterface(dlg, &IID_IUnknown, (void**)&unk);
49 ok(hr == S_OK, "QueryInterface (IUnknown) returned 0x%x\n", hr);
50 if (SUCCEEDED(hr)) {
51 IUnknown_Release(unk);
52 }
53
54 hr = IProgressDialog_QueryInterface(dlg, &IID_IOleWindow, (void**)&olewindow);
55 ok(hr == S_OK, "QueryInterface (IOleWindow) returned 0x%x\n", hr);
56 if (SUCCEEDED(hr)) {
57 hr = IOleWindow_QueryInterface(olewindow, &IID_IProgressDialog, (void**)&dlg2);
58 ok(hr == S_OK, "QueryInterface (IProgressDialog) returned 0x%x\n", hr);
59 if (SUCCEEDED(hr)) {
60 IProgressDialog_Release(dlg2);
61 }
62 IOleWindow_Release(olewindow);
63 }
64 IProgressDialog_Release(dlg);
65 }
66
67
68 START_TEST(progressdlg)
69 {
70 CoInitialize(NULL);
71
72 test_IProgressDialog_QueryInterface();
73
74 CoUninitialize();
75 }