Module: wine Branch: master Commit: 667944a3f78f95159e5ed21a8cd1f16d9168d2cf URL: http://source.winehq.org/git/wine.git/?a=commit;h=667944a3f78f95159e5ed21a8c...
Author: Gerald Pfeifer gerald@pfeifer.com Date: Sun May 9 12:48:34 2010 +0200
localspl/tests: Improve the tests in test_XcvDataPort_AddPort by properly checking return values and avoiding a duplicate test.
---
dlls/localspl/tests/localmon.c | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/localspl/tests/localmon.c b/dlls/localspl/tests/localmon.c index 496be71..413a95a 100644 --- a/dlls/localspl/tests/localmon.c +++ b/dlls/localspl/tests/localmon.c @@ -775,6 +775,8 @@ static void test_XcvClosePort(void)
static void test_XcvDataPort_AddPort(void) { + DWORD res; + /* * The following tests crash with native localspl.dll on w2k and xp, * but it works, when the native dll (w2k and xp) is used in wine. @@ -787,28 +789,28 @@ static void test_XcvDataPort_AddPort(void) { /* create a Port for a normal, writable file */ SetLastError(0xdeadbeef); - pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); + res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); + ok( res == ERROR_SUCCESS, "returned %d with %u (expected ERROR_SUCCESS)\n", res, GetLastError());
/* add our testport again */ SetLastError(0xdeadbeef); - pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); + res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); + ok( res == ERROR_ALREADY_EXISTS, "returned %d with %u (expected ERROR_ALREADY_EXISTS)\n", res, GetLastError());
/* create a well-known Port */ SetLastError(0xdeadbeef); - pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL); - - SetLastError(0xdeadbeef); - pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL); - /* native localspl.dll on wine: ERROR_ALREADY_EXISTS */ + res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_lpt1W, (lstrlenW(portname_lpt1W) + 1) * sizeof(WCHAR), NULL, 0, NULL); + ok( res == ERROR_ALREADY_EXISTS, "returned %d with %u (expected ERROR_ALREADY_EXISTS)\n", res, GetLastError());
/* ERROR_ALREADY_EXISTS is also returned from native localspl.dll on wine, when "RPT1:" was already installed for redmonnt.dll: - pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_rpt1W, ... + res = pXcvDataPort(hXcv, cmd_AddPortW, (PBYTE) portname_rpt1W, ... */
/* cleanup */ SetLastError(0xdeadbeef); - pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); + res = pXcvDataPort(hXcv, cmd_DeletePortW, (PBYTE) tempfileW, (lstrlenW(tempfileW) + 1) * sizeof(WCHAR), NULL, 0, NULL); + ok( res == ERROR_SUCCESS, "returned %d with %u (expected ERROR_SUCCESS)\n", res, GetLastError()); }
}