progressdlg.c 2.15 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
/* Unit tests for progressdialog object
 *
 * Copyright 2012 Detlef Riekenberg
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#define COBJMACROS

#include <stdarg.h>
#include <shlobj.h>

#include "wine/test.h"


static void test_IProgressDialog_QueryInterface(void)
{
    IProgressDialog *dlg;
    IProgressDialog *dlg2;
    IOleWindow *olewindow;
    IUnknown *unk;
    HRESULT hr;

36 37 38 39
    hr = CoCreateInstance(&CLSID_ProgressDialog, NULL, CLSCTX_INPROC_SERVER, &IID_IProgressDialog, (void **)&dlg);
    if (FAILED(hr))
    {
        win_skip("ProgressDialog is not supported, hr %#lx.\n", hr);
40 41 42
        return;
    }

43
    hr = IProgressDialog_QueryInterface(dlg, &IID_IUnknown, NULL);
44
    ok(hr == E_POINTER, "Unexpected hr %#lx.\n", hr);
45

46
    hr = IProgressDialog_QueryInterface(dlg, &IID_IUnknown, (void**)&unk);
47
    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
48 49 50 51
    if (SUCCEEDED(hr)) {
        IUnknown_Release(unk);
    }

52
    hr = IProgressDialog_QueryInterface(dlg, &IID_IOleWindow, (void**)&olewindow);
53
    ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
54
    if (SUCCEEDED(hr)) {
55
        hr = IOleWindow_QueryInterface(olewindow, &IID_IProgressDialog, (void**)&dlg2);
56
        ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
        if (SUCCEEDED(hr)) {
            IProgressDialog_Release(dlg2);
        }
        IOleWindow_Release(olewindow);
    }
    IProgressDialog_Release(dlg);
}


START_TEST(progressdlg)
{
    CoInitialize(NULL);

    test_IProgressDialog_QueryInterface();

    CoUninitialize();
}