Commit a2ea406e authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

oleaut32: Add ICreateTypeInfo2::SetVarName implementation.

parent f21961cc
...@@ -4287,13 +4287,14 @@ static void test_SetVarDocString(void) ...@@ -4287,13 +4287,14 @@ static void test_SetVarDocString(void)
static OLECHAR nameW[] = {'n','a','m','e',0}; static OLECHAR nameW[] = {'n','a','m','e',0};
static OLECHAR doc1W[] = {'d','o','c','1',0}; static OLECHAR doc1W[] = {'d','o','c','1',0};
static OLECHAR doc2W[] = {'d','o','c','2',0}; static OLECHAR doc2W[] = {'d','o','c','2',0};
static OLECHAR var_nameW[] = {'v','a','r','n','a','m','e',0};
CHAR filenameA[MAX_PATH]; CHAR filenameA[MAX_PATH];
WCHAR filenameW[MAX_PATH]; WCHAR filenameW[MAX_PATH];
ICreateTypeLib2 *ctl; ICreateTypeLib2 *ctl;
ICreateTypeInfo *cti; ICreateTypeInfo *cti;
ITypeLib *tl; ITypeLib *tl;
ITypeInfo *ti; ITypeInfo *ti;
BSTR docstr; BSTR namestr, docstr;
VARDESC desc, *pdesc; VARDESC desc, *pdesc;
HRESULT hr; HRESULT hr;
VARIANT v; VARIANT v;
...@@ -4324,6 +4325,15 @@ static void test_SetVarDocString(void) ...@@ -4324,6 +4325,15 @@ static void test_SetVarDocString(void)
hr = ICreateTypeInfo_AddVarDesc(cti, 0, &desc); hr = ICreateTypeInfo_AddVarDesc(cti, 0, &desc);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeInfo_SetVarName(cti, 0, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
hr = ICreateTypeInfo_SetVarName(cti, 1, var_nameW);
ok(hr == TYPE_E_ELEMENTNOTFOUND, "got %08x\n", hr);
hr = ICreateTypeInfo_SetVarName(cti, 0, var_nameW);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeInfo_SetVarDocString(cti, 0, NULL); hr = ICreateTypeInfo_SetVarDocString(cti, 0, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr); ok(hr == E_INVALIDARG, "got %08x\n", hr);
...@@ -4359,10 +4369,12 @@ static void test_SetVarDocString(void) ...@@ -4359,10 +4369,12 @@ static void test_SetVarDocString(void)
ok(V_VT(U(pdesc)->lpvarValue) == VT_INT, "got wrong value type: %u\n", V_VT(U(pdesc)->lpvarValue)); ok(V_VT(U(pdesc)->lpvarValue) == VT_INT, "got wrong value type: %u\n", V_VT(U(pdesc)->lpvarValue));
ok(V_INT(U(pdesc)->lpvarValue) == 1, "got wrong value: 0x%x\n", V_INT(U(pdesc)->lpvarValue)); ok(V_INT(U(pdesc)->lpvarValue) == 1, "got wrong value: 0x%x\n", V_INT(U(pdesc)->lpvarValue));
hr = ITypeInfo_GetDocumentation(ti, pdesc->memid, NULL, &docstr, NULL, NULL); hr = ITypeInfo_GetDocumentation(ti, pdesc->memid, &namestr, &docstr, NULL, NULL);
ok(hr == S_OK, "got %08x\n", hr); ok(hr == S_OK, "got %08x\n", hr);
ok(memcmp(namestr, var_nameW, sizeof(var_nameW)) == 0, "got wrong name: %s\n", wine_dbgstr_w(namestr));
ok(memcmp(docstr, doc2W, sizeof(doc2W)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr)); ok(memcmp(docstr, doc2W, sizeof(doc2W)) == 0, "got wrong docstring: %s\n", wine_dbgstr_w(docstr));
SysFreeString(namestr);
SysFreeString(docstr); SysFreeString(docstr);
ITypeInfo_ReleaseVarDesc(ti, pdesc); ITypeInfo_ReleaseVarDesc(ti, pdesc);
......
...@@ -10688,8 +10688,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarName(ICreateTypeInfo2 *iface, ...@@ -10688,8 +10688,17 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetVarName(ICreateTypeInfo2 *iface,
UINT index, LPOLESTR name) UINT index, LPOLESTR name)
{ {
ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface); ITypeInfoImpl *This = info_impl_from_ICreateTypeInfo2(iface);
FIXME("%p %u %s - stub\n", This, index, wine_dbgstr_w(name));
return E_NOTIMPL; TRACE("%p %u %s\n", This, index, wine_dbgstr_w(name));
if(!name)
return E_INVALIDARG;
if(index >= This->cVars)
return TYPE_E_ELEMENTNOTFOUND;
This->vardescs[index].Name = TLB_append_str(&This->pTypeLib->name_list, name);
return S_OK;
} }
static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeDescAlias(ICreateTypeInfo2 *iface, static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeDescAlias(ICreateTypeInfo2 *iface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment