localspl/tests: Improve the tests in test_XcvDataPort_AddPort by properly checking return values and avoiding a duplicate test.

This commit is contained in:
Gerald Pfeifer 2010-05-09 12:48:34 +02:00 committed by Alexandre Julliard
parent 47fff748cc
commit 667944a3f7
1 changed files with 11 additions and 9 deletions

View File

@ -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());
}
}