From 4fed489fe6bd10f4759a34a160782ea6c52625e0 Mon Sep 17 00:00:00 2001 From: Thomas Mullaly Date: Thu, 27 May 2010 15:29:46 -0400 Subject: [PATCH] urlmon/tests: Added the remainder of tests for the IUri_Get* string functions. --- dlls/urlmon/tests/uri.c | 167 ++++++++++++++++++++++++++++++++++++++++ dlls/urlmon/uri.c | 28 +++++++ 2 files changed, 195 insertions(+) diff --git a/dlls/urlmon/tests/uri.c b/dlls/urlmon/tests/uri.c index f1bb062247e..7e2496ecea1 100644 --- a/dlls/urlmon/tests/uri.c +++ b/dlls/urlmon/tests/uri.c @@ -490,6 +490,27 @@ static void test_IUri_GetStrProperties(void) { hr = IUri_GetPassword(uri, NULL); ok(hr == E_POINTER, "Error: GetPassword returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetPath(uri, NULL); + ok(hr == E_POINTER, "Error: GetPath returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetPathAndQuery(uri, NULL); + ok(hr == E_POINTER, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetQuery(uri, NULL); + ok(hr == E_POINTER, "Error: GetQuery returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetRawUri(uri, NULL); + ok(hr == E_POINTER, "Error: GetRawUri returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetSchemeName(uri, NULL); + ok(hr == E_POINTER, "Error: GetSchemeName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetUserInfo(uri, NULL); + ok(hr == E_POINTER, "Error: GetUserInfo returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); + + hr = IUri_GetUserName(uri, NULL); + ok(hr == E_POINTER, "Error: GetUserName returned 0x%08x, expected 0x%08x.\n", hr, E_POINTER); } if(uri) IUri_Release(uri); @@ -660,6 +681,152 @@ static void test_IUri_GetStrProperties(void) { } SysFreeString(received); received = NULL; + + /* GetPath() tests. */ + prop = test.str_props[Uri_PROPERTY_PATH]; + hr = IUri_GetPath(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetPath returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + + /* GetPathAndQuery() tests. */ + prop = test.str_props[Uri_PROPERTY_PATH_AND_QUERY]; + hr = IUri_GetPathAndQuery(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetPathAndQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + + /* GetQuery() tests. */ + prop = test.str_props[Uri_PROPERTY_QUERY]; + hr = IUri_GetQuery(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetQuery returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + + /* GetRawUri() tests. */ + prop = test.str_props[Uri_PROPERTY_RAW_URI]; + hr = IUri_GetRawUri(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetRawUri returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + + /* GetSchemeName() tests. */ + prop = test.str_props[Uri_PROPERTY_SCHEME_NAME]; + hr = IUri_GetSchemeName(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetSchemeName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + + /* GetUserInfo() tests. */ + prop = test.str_props[Uri_PROPERTY_USER_INFO]; + hr = IUri_GetUserInfo(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetUserInfo returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); + received = NULL; + + /* GetUserName() tests. */ + prop = test.str_props[Uri_PROPERTY_USER_NAME]; + hr = IUri_GetUserName(uri, &received); + if(prop.todo) { + todo_wine { + ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + } + todo_wine { + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + } else { + ok(hr == prop.expected, "Error: GetUserName returned 0x%08x, expected 0x%08x on uri_tests[%d].\n", + hr, prop.expected, i); + ok(!strcmp_aw(prop.value, received), "Error: Expected %s but got %s on uri_tests[%d].\n", + prop.value, wine_dbgstr_w(received), i); + } + SysFreeString(received); } if(uri) IUri_Release(uri); diff --git a/dlls/urlmon/uri.c b/dlls/urlmon/uri.c index d9f010c19aa..8d8130e3cf2 100644 --- a/dlls/urlmon/uri.c +++ b/dlls/urlmon/uri.c @@ -210,6 +210,10 @@ static HRESULT WINAPI Uri_GetPath(IUri *iface, BSTR *pstrPath) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrPath); + + if(!pstrPath) + return E_POINTER; + return E_NOTIMPL; } @@ -217,6 +221,10 @@ static HRESULT WINAPI Uri_GetPathAndQuery(IUri *iface, BSTR *pstrPathAndQuery) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrPathAndQuery); + + if(!pstrPathAndQuery) + return E_POINTER; + return E_NOTIMPL; } @@ -224,6 +232,10 @@ static HRESULT WINAPI Uri_GetQuery(IUri *iface, BSTR *pstrQuery) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrQuery); + + if(!pstrQuery) + return E_POINTER; + return E_NOTIMPL; } @@ -231,6 +243,10 @@ static HRESULT WINAPI Uri_GetRawUri(IUri *iface, BSTR *pstrRawUri) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrRawUri); + + if(!pstrRawUri) + return E_POINTER; + return E_NOTIMPL; } @@ -238,6 +254,10 @@ static HRESULT WINAPI Uri_GetSchemeName(IUri *iface, BSTR *pstrSchemeName) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrSchemeName); + + if(!pstrSchemeName) + return E_POINTER; + return E_NOTIMPL; } @@ -245,6 +265,10 @@ static HRESULT WINAPI Uri_GetUserInfo(IUri *iface, BSTR *pstrUserInfo) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrUserInfo); + + if(!pstrUserInfo) + return E_POINTER; + return E_NOTIMPL; } @@ -252,6 +276,10 @@ static HRESULT WINAPI Uri_GetUserName(IUri *iface, BSTR *pstrUserName) { Uri *This = URI_THIS(iface); FIXME("(%p)->(%p)\n", This, pstrUserName); + + if(!pstrUserName) + return E_POINTER; + return E_NOTIMPL; }