From: Vibhav Pant vibhavp@gmail.com
--- dlls/rometadata/tests/rometadata.c | 94 ++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+)
diff --git a/dlls/rometadata/tests/rometadata.c b/dlls/rometadata/tests/rometadata.c index b000e467d3c..fa653977de7 100644 --- a/dlls/rometadata/tests/rometadata.c +++ b/dlls/rometadata/tests/rometadata.c @@ -1020,6 +1020,7 @@ static void test_IMetaDataImport(void) IMetaDataImport *md_import; const BYTE *data = NULL; const GUID *guid; + mdToken token; WCHAR *strW; HRESULT hr; ULONG val; @@ -1201,6 +1202,30 @@ static void test_IMetaDataImport(void) debugstr_mdToken(methoddef_tokens[i])); IMetaDataImport_CloseEnum(md_import, henum2);
+ token = mdTokenNil; + hr = IMetaDataImport_FindMember(md_import, typedef2, name, sig_blob, sig_len, &token); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(token == methoddef_tokens[i], "got token %s != %s\n", debugstr_mdToken(token), + debugstr_mdToken(methoddef_tokens[i])); + token = mdTokenNil; + hr = IMetaDataImport_FindMember(md_import, typedef2, name, NULL, 0, &token); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(token == methoddef_tokens[i], "got token %s != %s\n", debugstr_mdToken(token), + debugstr_mdToken(methoddef_tokens[i])); + + henum2 = NULL; + token = mdTokenNil; + hr = IMetaDataImport_EnumMembersWithName(md_import, &henum2, typedef2, name, &token, 1, NULL); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(!!henum2, "got henum2 %p\n", henum2); + buf_len2 = 0; + hr = IMetaDataImport_CountEnum(md_import, henum2, &buf_len2); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(buf_len2 == 1, "got buf_len2 %lu\n", buf_len2); + todo_wine ok(token == methoddef_tokens[i], "got token %s != %s\n", debugstr_mdToken(token), + debugstr_mdToken(methoddef_tokens[i])); + IMetaDataImport_CloseEnum(md_import, henum2); + winetest_pop_context(); } hr = IMetaDataImport_FindMethod(md_import, typedef2, NULL, NULL, 0, &methoddef); @@ -1221,6 +1246,26 @@ static void test_IMetaDataImport(void) todo_wine ok(buf_len2 == buf_len, "got buf_len2 %lu != %lu\n", buf_len2, buf_len); IMetaDataImport_CloseEnum(md_import, henum);
+ henum = NULL; + hr = IMetaDataImport_EnumMembers(md_import, &henum, typedef2, NULL, 0, NULL); + todo_wine ok(hr == S_FALSE, "got hr %#lx\n", hr); + todo_wine ok(!!henum, "got henum %p\n", henum); + buf_len2 = 0; + hr = IMetaDataImport_CountEnum(md_import, henum, &buf_len2); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(buf_len2 == buf_len, "got buf_len2 %lu != %lu\n", buf_len2, buf_len); + IMetaDataImport_CloseEnum(md_import, henum); + + henum = NULL; + hr = IMetaDataImport_EnumMembersWithName(md_import, &henum, typedef2, NULL, NULL, 0, NULL); + todo_wine ok(hr == S_FALSE, "got hr %#lx\n", hr); + todo_wine ok(!!henum, "got henum %p\n", henum); + buf_len2 = 0; + hr = IMetaDataImport_CountEnum(md_import, henum, &buf_len2); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(buf_len2 == buf_len, "got buf_len2 %lu != %lu\n", buf_len2, buf_len); + IMetaDataImport_CloseEnum(md_import, henum); + for (i = 0; i < ARRAY_SIZE(field_enum_test_cases); i++) { const struct field_props *fields_props = field_enum_test_cases[i].field_props; @@ -1262,6 +1307,26 @@ static void test_IMetaDataImport(void) todo_wine ok(buf_len2 == buf_len, "got buf_len2 %lu != %lu\n", buf_len2, buf_len); IMetaDataImport_CloseEnum(md_import, henum);
+ henum = NULL; + hr = IMetaDataImport_EnumMembers(md_import, &henum, typedef1, NULL, 0, NULL); + todo_wine ok(hr == S_FALSE, "got hr %#lx\n", hr); + todo_wine ok(!!henum, "got henum %p\n", henum); + buf_len2 = 0; + hr = IMetaDataImport_CountEnum(md_import, henum, &buf_len2); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(buf_len2 == buf_len, "got buf_len2 %lu != %lu\n", buf_len2, buf_len); + IMetaDataImport_CloseEnum(md_import, henum); + + henum = NULL; + hr = IMetaDataImport_EnumMembersWithName(md_import, &henum, typedef1, NULL, NULL, 0, NULL); + todo_wine ok(hr == S_FALSE, "got hr %#lx\n", hr); + todo_wine ok(!!henum, "got henum %p\n", henum); + buf_len2 = 0; + hr = IMetaDataImport_CountEnum(md_import, henum, &buf_len2); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(buf_len2 == buf_len, "got buf_len2 %lu != %lu\n", buf_len2, buf_len); + IMetaDataImport_CloseEnum(md_import, henum); + for (field_idx = 0; field_idx < buf_len; field_idx++) { ULONG flags = 0, sig_len = 0, value_type = 0, value_len = 0; @@ -1306,6 +1371,19 @@ static void test_IMetaDataImport(void) debugstr_mdToken(fielddef_tokens[field_idx])); IMetaDataImport_CloseEnum(md_import, henum);
+ henum = NULL; + fielddef = mdFieldDefNil; + hr = IMetaDataImport_EnumMembersWithName(md_import, &henum, typedef2, name, &fielddef, 1, NULL); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(!!henum, "got henum %p\n", henum); + buf_len2 = 0; + hr = IMetaDataImport_CountEnum(md_import, henum, &buf_len2); + ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(buf_len2 == 1, "got buf_len2 %lu\n", buf_len2); + todo_wine ok(fielddef == fielddef_tokens[field_idx], "got fielddef %s != %s\n", debugstr_mdToken(fielddef), + debugstr_mdToken(fielddef_tokens[field_idx])); + IMetaDataImport_CloseEnum(md_import, henum); + fielddef = mdFieldDefNil; hr = IMetaDataImport_FindField(md_import, typedef2, name, sig_blob, sig_len, &fielddef); todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); @@ -1319,6 +1397,17 @@ static void test_IMetaDataImport(void) todo_wine ok(fielddef == fielddef_tokens[field_idx], "got fielddef %s != %s\n", debugstr_mdToken(fielddef), debugstr_mdToken(fielddef_tokens[field_idx]));
+ token = mdTokenNil; + hr = IMetaDataImport_FindMember(md_import, typedef2, name, sig_blob, sig_len, &token); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(token == fielddef_tokens[field_idx], "got token %s != %s\n", debugstr_mdToken(token), + debugstr_mdToken(fielddef_tokens[field_idx])); + token = mdTokenNil; + hr = IMetaDataImport_FindMember(md_import, typedef2, name, NULL, 0, &token); + todo_wine ok(hr == S_OK, "got hr %#lx\n", hr); + todo_wine ok(token == fielddef_tokens[field_idx], "got token %s != %s\n", debugstr_mdToken(token), + debugstr_mdToken(fielddef_tokens[field_idx])); + winetest_pop_context(); } free(fielddef_tokens); @@ -1330,6 +1419,11 @@ static void test_IMetaDataImport(void) hr = IMetaDataImport_FindField(md_import, typedef2, L"foo", NULL, 0, &fielddef); todo_wine ok(hr == CLDB_E_RECORD_NOTFOUND, "got hr %#lx\n", hr);
+ hr = IMetaDataImport_FindMember(md_import, typedef1, NULL, NULL, 0, &token); + todo_wine ok(hr == E_INVALIDARG, "got hr %#lx\n", hr); + hr = IMetaDataImport_FindMember(md_import, typedef1, L"foo", NULL, 0, &token); + todo_wine ok(hr == CLDB_E_RECORD_NOTFOUND, "got hr %#lx\n", hr); + typedef1 = buf_len = 0; data = NULL; hr = IMetaDataImport_FindTypeDefByName(md_import, L"Wine.Test.ITest2", 0, &typedef1);