2 * Component Object Tests
4 * Copyright 2005 Robert Shearman
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
30 #include "wine/test.h"
32 #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08x\n", hr)
34 static const CLSID CLSID_WineTest =
35 { /* 9474ba1a-258b-490b-bc13-516e9239ace0 */
39 {0xbc, 0x13, 0x51, 0x6e, 0x92, 0x39, 0xac, 0xe0}
42 static void test_error_info(void)
45 ICreateErrorInfo *pCreateErrorInfo;
46 IErrorInfo *pErrorInfo;
47 static WCHAR wszDescription[] = {'F','a','i','l','e','d',' ','S','p','r','o','c','k','e','t',0};
48 static WCHAR wszHelpFile[] = {'s','p','r','o','c','k','e','t','.','h','l','p',0};
49 static WCHAR wszSource[] = {'s','p','r','o','c','k','e','t',0};
51 hr = CreateErrorInfo(&pCreateErrorInfo);
52 ok_ole_success(hr, "CreateErrorInfo");
54 hr = ICreateErrorInfo_SetDescription(pCreateErrorInfo, NULL);
55 ok_ole_success(hr, "ICreateErrorInfo_SetDescription");
57 hr = ICreateErrorInfo_SetDescription(pCreateErrorInfo, wszDescription);
58 ok_ole_success(hr, "ICreateErrorInfo_SetDescription");
60 hr = ICreateErrorInfo_SetGUID(pCreateErrorInfo, &CLSID_WineTest);
61 ok_ole_success(hr, "ICreateErrorInfo_SetGUID");
63 hr = ICreateErrorInfo_SetHelpContext(pCreateErrorInfo, 0xdeadbeef);
64 ok_ole_success(hr, "ICreateErrorInfo_SetHelpContext");
66 hr = ICreateErrorInfo_SetHelpFile(pCreateErrorInfo, NULL);
67 ok_ole_success(hr, "ICreateErrorInfo_SetHelpFile");
69 hr = ICreateErrorInfo_SetHelpFile(pCreateErrorInfo, wszHelpFile);
70 ok_ole_success(hr, "ICreateErrorInfo_SetHelpFile");
72 hr = ICreateErrorInfo_SetSource(pCreateErrorInfo, NULL);
73 ok_ole_success(hr, "ICreateErrorInfo_SetSource");
75 hr = ICreateErrorInfo_SetSource(pCreateErrorInfo, wszSource);
76 ok_ole_success(hr, "ICreateErrorInfo_SetSource");
78 hr = ICreateErrorInfo_QueryInterface(pCreateErrorInfo, &IID_IErrorInfo, (void **)&pErrorInfo);
79 ok_ole_success(hr, "ICreateErrorInfo_QueryInterface");
81 ICreateErrorInfo_Release(pCreateErrorInfo);
83 hr = SetErrorInfo(0, pErrorInfo);
84 ok_ole_success(hr, "SetErrorInfo");
86 IErrorInfo_Release(pErrorInfo);
89 hr = GetErrorInfo(0, &pErrorInfo);
90 ok_ole_success(hr, "GetErrorInfo");
92 IErrorInfo_Release(pErrorInfo);
94 hr = GetErrorInfo(0, &pErrorInfo);
95 ok(hr == S_FALSE, "GetErrorInfo should have returned S_FALSE instead of 0x%08x\n", hr);
96 ok(!pErrorInfo, "pErrorInfo should be set to NULL\n");
98 hr = SetErrorInfo(0, NULL);
99 ok_ole_success(hr, "SetErrorInfo");
101 hr = GetErrorInfo(0xdeadbeef, &pErrorInfo);
102 ok(hr == E_INVALIDARG, "GetErrorInfo should have returned E_INVALIDARG instead of 0x%08x\n", hr);
104 hr = SetErrorInfo(0xdeadbeef, NULL);
105 ok(hr == E_INVALIDARG, "SetErrorInfo should have returned E_INVALIDARG instead of 0x%08x\n", hr);
108 START_TEST(errorinfo)