Author: pschweitzer Date: Tue Jul 8 14:30:15 2008 New Revision: 34373
URL: http://svn.reactos.org/svn/reactos?rev=34373&view=rev Log: Synced riched32_winetest.exe, shlwapi_winetest.exe, urlmon_winetest.exe with Wine HEAD
Modified: trunk/rostests/winetests/riched32/editor.c trunk/rostests/winetests/shlwapi/istream.c trunk/rostests/winetests/shlwapi/path.c trunk/rostests/winetests/shlwapi/url.c trunk/rostests/winetests/urlmon/protocol.c trunk/rostests/winetests/urlmon/stream.c trunk/rostests/winetests/urlmon/url.c
Modified: trunk/rostests/winetests/riched32/editor.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/riched32/editor.... ============================================================================== --- trunk/rostests/winetests/riched32/editor.c [iso-8859-1] (original) +++ trunk/rostests/winetests/riched32/editor.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -696,6 +696,130 @@ DestroyWindow(hwndRichEdit); }
+static void test_EM_POSFROMCHAR(void) +{ + HWND hwndRichEdit = new_richedit(NULL); + int i; + POINTL pl; + LRESULT result; + unsigned int height = 0; + int xpos = 0; + static const char text[] = "aa\n" + "this is a long line of text that should be longer than the " + "control's width\n" + "cc\n" + "dd\n" + "ee\n" + "ff\n" + "gg\n" + "hh\n"; + + /* Fill the control to lines to ensure that most of them are offscreen */ + for (i = 0; i < 50; i++) + { + /* Do not modify the string; it is exactly 16 characters long. */ + SendMessage(hwndRichEdit, EM_SETSEL, 0, 0); + SendMessage(hwndRichEdit, EM_REPLACESEL, 0, (LPARAM)"0123456789ABCD\r\n"); + } + + /* + Richedit 1.0 receives a POINTL* on wParam and character offset on lParam, returns void. + Richedit 2.0 receives character offset on wParam, ignores lParam, returns MAKELONG(x,y) + Richedit 3.0 accepts either of the above API conventions. + */ + + /* Testing Richedit 1.0 API format */ + + /* Testing start of lines. X-offset should be constant on all cases (native is 1). + Since all lines are identical and drawn with the same font, + they should have the same height... right? + */ + for (i = 0; i < 50; i++) + { + /* All the lines are 16 characters long */ + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, i * 16); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + if (i == 0) + { + ok(pl.y == 0, "EM_POSFROMCHAR reports y=%d, expected 0\n", pl.y); + todo_wine { + ok(pl.x == 1, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + } + xpos = pl.x; + } + else if (i == 1) + { + ok(pl.y > 0, "EM_POSFROMCHAR reports y=%d, expected > 0\n", pl.y); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + height = pl.y; + } + else + { + ok(pl.y == i * height, "EM_POSFROMCHAR reports y=%d, expected %d\n", pl.y, i * height); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + } + } + + /* Testing position at end of text */ + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, 50 * 16); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == 50 * height, "EM_POSFROMCHAR reports y=%d, expected %d\n", pl.y, 50 * height); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + + /* Testing position way past end of text */ + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, 55 * 16); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == 50 * height, "EM_POSFROMCHAR reports y=%d, expected %d\n", pl.y, 50 * height); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + + + /* Testing that vertical scrolling does, in fact, have an effect on EM_POSFROMCHAR */ + SendMessage(hwndRichEdit, EM_SCROLL, SB_LINEDOWN, 0); /* line down */ + for (i = 0; i < 50; i++) + { + /* All the lines are 16 characters long */ + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, i * 16); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == (i - 1) * height, + "EM_POSFROMCHAR reports y=%d, expected %d\n", + pl.y, (i - 1) * height); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + } + + /* Testing position at end of text */ + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, 50 * 16); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == (50 - 1) * height, "EM_POSFROMCHAR reports y=%d, expected %d\n", pl.y, (50 - 1) * height); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + + /* Testing position way past end of text */ + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, 55 * 16); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == (50 - 1) * height, "EM_POSFROMCHAR reports y=%d, expected %d\n", pl.y, (50 - 1) * height); + ok(pl.x == xpos, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + + /* Testing that horizontal scrolling does, in fact, have an effect on EM_POSFROMCHAR */ + SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text); + SendMessage(hwndRichEdit, EM_SCROLL, SB_LINEUP, 0); /* line up */ + + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, 0); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == 0, "EM_POSFROMCHAR reports y=%d, expected 0\n", pl.y); + todo_wine { + ok(pl.x == 1, "EM_POSFROMCHAR reports x=%d, expected 1\n", pl.x); + } + xpos = pl.x; + + SendMessage(hwndRichEdit, WM_HSCROLL, SB_LINERIGHT, 0); + result = SendMessage(hwndRichEdit, EM_POSFROMCHAR, (WPARAM)&pl, 0); + ok(result == 0, "EM_POSFROMCHAR returned %ld, expected 0\n", result); + ok(pl.y == 0, "EM_POSFROMCHAR reports y=%d, expected 0\n", pl.y); + todo_wine { + /* Fails on builtin because horizontal scrollbar is not being shown */ + ok(pl.x < xpos, "EM_POSFROMCHAR reports x=%hd, expected value less than %d\n", pl.x, xpos); + } + DestroyWindow(hwndRichEdit); +}
START_TEST( editor ) @@ -717,6 +841,7 @@ test_EM_GETLINE(); test_EM_LINELENGTH(); test_EM_FINDTEXT(); + test_EM_POSFROMCHAR();
/* Set the environment variable WINETEST_RICHED32 to keep windows * responsive and open for 30 seconds. This is useful for debugging.
Modified: trunk/rostests/winetests/shlwapi/istream.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/istream.... ============================================================================== --- trunk/rostests/winetests/shlwapi/istream.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shlwapi/istream.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -384,9 +384,14 @@ IStream * template = NULL; HRESULT ret; ULONG refcount; - static const WCHAR test_file[] = { 'c', ':', '\', 't', 'e', 's', 't', '.', 't', 'x', 't', '\0' }; + WCHAR test_file[MAX_PATH]; + static const WCHAR testEx_txt[] = { '\', 't', 'e', 's', 't', 'E','x', '.', 't', 'x', 't', '\0' };
trace("SHCreateStreamOnFileEx: testing mode %d, STGM flags %08x\n", mode, stgm); + + /* Don't used a fixed path for the testEx.txt file */ + GetTempPathW(MAX_PATH, test_file); + lstrcatW(test_file, testEx_txt);
/* invalid arguments */
Modified: trunk/rostests/winetests/shlwapi/path.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/path.c?r... ============================================================================== --- trunk/rostests/winetests/shlwapi/path.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shlwapi/path.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -537,9 +537,13 @@ SetLastError(0xdeadbeef); lstrcpyA(dest, "control"); str = PathCombineA(dest, "relative\dir", "\one\two\three\"); - ok(str == dest, "Expected str == dest, got %p\n", str); - ok(!lstrcmp(str, "one\two\three\"), "Expected one\two\three\, got %s\n", str); - ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); + ok(GetLastError() == 0xdeadbeef, "Expected 0xdeadbeef, got %d\n", GetLastError()); + /* Vista fails which probably makes sense as PathCombineA expects an absolute dir */ + if (str) + { + ok(str == dest, "Expected str == dest, got %p\n", str); + ok(!lstrcmp(str, "one\two\three\"), "Expected one\two\three\, got %s\n", str); + }
/* try forward slashes */ SetLastError(0xdeadbeef); @@ -806,10 +810,8 @@ ok(!res, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - todo_wine - { - ok(!lstrcmp(dest, "test"), "Expected test, got %s\n", dest); - } + ok(dest[0] == 0 || !lstrcmp(dest, "test"), + "Expected either an empty string (Vista) or test, got %s\n", dest);
/* try an empty source */ lstrcpy(dest, "test");
Modified: trunk/rostests/winetests/shlwapi/url.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/shlwapi/url.c?re... ============================================================================== --- trunk/rostests/winetests/shlwapi/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/shlwapi/url.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -74,6 +74,10 @@ {"file:///c:/tests\foo%20bar", URL_UNESCAPE , S_OK, "file:///c:/tests/foo bar", FALSE}, {"file:///c:/tests/foo%20bar", 0, S_OK, "file:///c:/tests/foo%20bar", FALSE}, {"file:///c:/tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, + {"file://localhost/c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, + {"file://localhost\c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, + {"file://localhost\\c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, + {"file://localhost\c:\tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, {"file://c:/tests/../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, {"file://c:/tests\../tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, {"file://c:/tests/foo%20bar", URL_FILE_USE_PATHURL, S_OK, "file://c:\tests\foo bar", FALSE}, @@ -575,6 +579,7 @@ DWORD dwSize; DWORD urllen; HRESULT hr; + int i;
if (!pUrlCanonicalizeW) { @@ -624,6 +629,21 @@ "got 0x%x with %u and size %u for %u (expected 'S_OK' and size %u)\n", hr, GetLastError(), dwSize, lstrlenW(szReturnUrl), urllen);
+ /* check that the characters 1..32 are chopped from the end of the string */ + for (i = 1; i < 65536; i++) + { + WCHAR szUrl[128]; + BOOL choped; + int pos; + + MultiByteToWideChar(CP_UTF8, 0, "http://www.winehq.org/X", -1, szUrl, 128); + pos = lstrlenW(szUrl) - 1; + szUrl[pos] = i; + urllen = INTERNET_MAX_URL_LENGTH; + pUrlCanonicalizeW(szUrl, szReturnUrl, &urllen, 0); + choped = lstrlenW(szReturnUrl) < lstrlenW(szUrl); + ok(choped == (i <= 32), "Incorrect char chopping for char %d\n", i); + } }
/* ########################### */ @@ -781,8 +801,8 @@ DWORD dwEscaped; size_t i; static char inplace[] = "file:///C:/Program%20Files"; - static WCHAR inplaceW[] = {'f','i','l','e',':','/','/','/','C',':','/', - 'P','r','o','g','r','a','m','%','2','0','F','i','l','e','s',0}; + static const char expected[] = "file:///C:/Program Files"; + static WCHAR inplaceW[] = {'f','i','l','e',':','/','/','/','C',':','/','P','r','o','g','r','a','m',' ','F','i','l','e','s',0};
for(i=0; i<sizeof(TEST_URL_UNESCAPE)/sizeof(TEST_URL_UNESCAPE[0]); i++) { dwEscaped=INTERNET_MAX_URL_LENGTH; @@ -801,9 +821,12 @@
dwEscaped = sizeof(inplace); ok(UrlUnescapeA(inplace, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK, "UrlUnescapeA failed unexpectedly\n"); + ok(!strcmp(inplace, expected), "got %s expected %s\n", inplace, expected); + ok(dwEscaped == 27, "got %d expected 27\n", dwEscaped);
dwEscaped = sizeof(inplaceW); ok(UrlUnescapeW(inplaceW, NULL, &dwEscaped, URL_UNESCAPE_INPLACE) == S_OK, "UrlUnescapeW failed unexpectedly\n"); + ok(dwEscaped == 50, "got %d expected 50\n", dwEscaped); }
/* ########################### */
Modified: trunk/rostests/winetests/urlmon/protocol.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/urlmon/protocol.... ============================================================================== --- trunk/rostests/winetests/urlmon/protocol.c [iso-8859-1] (original) +++ trunk/rostests/winetests/urlmon/protocol.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -426,7 +426,7 @@ ok(szStatusText != NULL, "szStatusText == NULL\n"); if(szStatusText) { if(binding_test) - ok(szStatusText == expect_wsz, "unexpected szStatusText\n"); + ok(!lstrcmpW(szStatusText, expect_wsz), "unexpected szStatusText\n"); else if(tested_protocol == FILE_TEST) ok(!lstrcmpW(szStatusText, file_name), "szStatusText = "%s"\n", debugstr_w(szStatusText)); else @@ -1342,8 +1342,10 @@ SET_EXPECT(GetBindInfo); expect_hrResult = MK_E_SYNTAX; hres = IInternetProtocol_Start(protocol, wszIndexHtml, &protocol_sink, &bind_info, 0, 0); - ok(hres == MK_E_SYNTAX, "Start failed: %08x, expected MK_E_SYNTAX\n", hres); - CHECK_CALLED(GetBindInfo); + ok(hres == MK_E_SYNTAX || + hres == E_INVALIDARG, + "Start failed: %08x, expected MK_E_SYNTAX or E_INVALIDARG\n", hres); + CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
SET_EXPECT(GetBindInfo); if(!(bindf & BINDF_FROMURLMON)) @@ -1387,12 +1389,12 @@ SET_EXPECT(GetBindInfo); hres = IInternetProtocol_Start(protocol, NULL, &protocol_sink, &bind_info, 0, 0); ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres); - CHECK_CALLED(GetBindInfo); + CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
SET_EXPECT(GetBindInfo); hres = IInternetProtocol_Start(protocol, emptyW, &protocol_sink, &bind_info, 0, 0); ok(hres == E_INVALIDARG, "Start failed: %08x, expected E_INVALIDARG\n", hres); - CHECK_CALLED(GetBindInfo); + CLEAR_CALLED(GetBindInfo); /* GetBindInfo not called in IE7 */
IInternetProtocol_Release(protocol); } @@ -1721,13 +1723,23 @@ expect_hrResult = INET_E_RESOURCE_NOT_FOUND;
hres = IInternetProtocol_Start(protocol, wrong_url2, &protocol_sink, &bind_info, 0, 0); - ok(hres == INET_E_RESOURCE_NOT_FOUND, "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND\n", hres); - - CHECK_CALLED(GetBindInfo); - CLEAR_CALLED(ReportProgress_DIRECTBIND); - CHECK_CALLED(ReportProgress_SENDINGREQUEST); - CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE); - CHECK_CALLED(ReportResult); + ok(hres == INET_E_RESOURCE_NOT_FOUND || + hres == INET_E_INVALID_URL, /* win2k3 */ + "Start failed: %08x, expected INET_E_RESOURCE_NOT_FOUND or INET_E_INVALID_URL\n", hres); + + if (hres == INET_E_RESOURCE_NOT_FOUND) { + CHECK_CALLED(GetBindInfo); + CLEAR_CALLED(ReportProgress_DIRECTBIND); + CHECK_CALLED(ReportProgress_SENDINGREQUEST); + CHECK_CALLED(ReportProgress_MIMETYPEAVAILABLE); + CHECK_CALLED(ReportResult); + }else { + CLEAR_CALLED(GetBindInfo); + CLEAR_CALLED(ReportProgress_DIRECTBIND); + CLEAR_CALLED(ReportProgress_SENDINGREQUEST); + CLEAR_CALLED(ReportProgress_MIMETYPEAVAILABLE); + CLEAR_CALLED(ReportResult); + }
IInternetProtocol_Release(protocol); }
Modified: trunk/rostests/winetests/urlmon/stream.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/urlmon/stream.c?... ============================================================================== --- trunk/rostests/winetests/urlmon/stream.c [iso-8859-1] (original) +++ trunk/rostests/winetests/urlmon/stream.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -294,7 +294,7 @@ static void test_URLOpenBlockingStreamW(void) { HRESULT hr; - IStream *pStream; + IStream *pStream = NULL; char buffer[256];
hr = URLOpenBlockingStreamW(NULL, NULL, &pStream, 0, &BindStatusCallback); @@ -324,12 +324,14 @@ CHECK_CALLED(OnStopBinding);
ok(pStream != NULL, "pStream is NULL\n"); - - hr = IStream_Read(pStream, buffer, sizeof(buffer), NULL); - ok(hr == S_OK, "IStream_Read failed with error 0x%08x\n", hr); - ok(!memcmp(buffer, szHtmlDoc, sizeof(szHtmlDoc)-1), "read data differs from file\n"); - - IStream_Release(pStream); + if(pStream) + { + hr = IStream_Read(pStream, buffer, sizeof(buffer), NULL); + ok(hr == S_OK, "IStream_Read failed with error 0x%08x\n", hr); + ok(!memcmp(buffer, szHtmlDoc, sizeof(szHtmlDoc)-1), "read data differs from file\n"); + + IStream_Release(pStream); + } }
static void test_URLOpenStreamW(void)
Modified: trunk/rostests/winetests/urlmon/url.c URL: http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/urlmon/url.c?rev... ============================================================================== --- trunk/rostests/winetests/urlmon/url.c [iso-8859-1] (original) +++ trunk/rostests/winetests/urlmon/url.c [iso-8859-1] Tue Jul 8 14:30:15 2008 @@ -2194,6 +2194,8 @@ SET_EXPECT(Start); if(test_protocol == HTTP_TEST) SET_EXPECT(Terminate); + if(test_protocol == FILE_TEST) + SET_EXPECT(OnProgress_MIMETYPEAVAILABLE); SET_EXPECT(UnlockRequest); }else { if(test_protocol == HTTP_TEST) { @@ -2260,6 +2262,8 @@ CHECK_CALLED(Start); if(test_protocol == HTTP_TEST) CHECK_CALLED(Terminate); + if(test_protocol == FILE_TEST) + CLEAR_CALLED(OnProgress_MIMETYPEAVAILABLE); /* not called in IE7 */ CHECK_CALLED(UnlockRequest); }else { if(test_protocol == HTTP_TEST) { @@ -2302,9 +2306,13 @@ if(test_protocol != HTTP_TEST || emul || urls[test_protocol] == SHORT_RESPONSE_URL) { ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n"); ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); - }else todo_wine { - ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n"); - ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); + }else { + todo_wine ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n"); + + if(bindf & BINDF_ASYNCHRONOUS) + ok(IBindCtx_Release(bctx) != 0, "bctx should not be destroyed here\n"); + else + todo_wine ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); }
if(emul)