2 * Copyright (C) 2012 Alistair Leslie-Hughes
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
27 #include "wine/test.h"
31 static void test_interfaces(void)
33 static const WCHAR key_add
[] = {'a', 0};
34 static const WCHAR key_add_value
[] = {'a', 0};
35 static const WCHAR key_non_exist
[] = {'b', 0};
40 IObjectWithSite
*site
;
45 hr
= CoCreateInstance(&CLSID_Dictionary
, NULL
, CLSCTX_INPROC_SERVER
|CLSCTX_INPROC_HANDLER
,
46 &IID_IDispatch
, (void**)&disp
);
48 win_skip("Could not create FileSystem object: %08x\n", hr
);
55 hr
= IDispatch_QueryInterface(disp
, &IID_IDictionary
, (void**)&dict
);
56 ok(hr
== S_OK
, "got 0x%08x, expected 0x%08x\n", hr
, S_OK
);
58 hr
= IDispatch_QueryInterface(disp
, &IID_IObjectWithSite
, (void**)&site
);
59 ok(hr
== E_NOINTERFACE
, "got 0x%08x, expected 0x%08x\n", hr
, E_NOINTERFACE
);
61 hr
= IDispatch_QueryInterface(disp
, &IID_IDispatchEx
, (void**)&dispex
);
62 ok(hr
== E_NOINTERFACE
, "got 0x%08x, expected 0x%08x\n", hr
, E_NOINTERFACE
);
65 V_BSTR(&key
) = SysAllocString(key_add
);
66 V_VT(&value
) = VT_BSTR
;
67 V_BSTR(&value
) = SysAllocString(key_add_value
);
68 hr
= IDictionary_Add(dict
, &key
, &value
);
69 todo_wine
ok(hr
== S_OK
, "got 0x%08x, expected 0x%08x\n", hr
, S_OK
);
72 exists
= VARIANT_FALSE
;
73 hr
= IDictionary_Exists(dict
, &key
, &exists
);
74 todo_wine
ok(hr
== S_OK
, "got 0x%08x, expected 0x%08x\n", hr
, S_OK
);
75 todo_wine
ok(exists
== VARIANT_TRUE
, "Expected TRUE but got FALSE.\n");
78 exists
= VARIANT_TRUE
;
80 V_BSTR(&key
) = SysAllocString(key_non_exist
);
81 hr
= IDictionary_Exists(dict
, &key
, &exists
);
82 todo_wine
ok(hr
== S_OK
, "got 0x%08x, expected 0x%08x\n", hr
, S_OK
);
83 todo_wine
ok(exists
== VARIANT_FALSE
, "Expected FALSE but got TRUE.\n");
86 hr
= IDictionary_get_Count(dict
, &count
);
87 ok(hr
== S_OK
, "got 0x%08x, expected 0x%08x\n", hr
, S_OK
);
88 todo_wine
ok(count
== 1, "got %d, expected 1\n", count
);
90 IDictionary_Release(dict
);
91 IDispatch_Release(disp
);
94 START_TEST(dictionary
)