comdlg32/tests: Make sure no ANSI strings are passed to Unicode functions.

This commit is contained in:
Mikołaj Zalewski 2008-06-20 23:03:20 +02:00 committed by Alexandre Julliard
parent 901969f624
commit 2879c39d4f
1 changed files with 18 additions and 13 deletions

View File

@ -82,6 +82,24 @@ static void test_DialogCancel(void)
ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0, ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,
CommDlgExtendedError()); CommDlgExtendedError());
PrintDlgA(NULL);
ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",
CDERR_INITIALIZATION, CommDlgExtendedError());
result = GetSaveFileNameA(&ofn);
ok(0 == result, "expected %d, got %d\n", 0, result);
ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,
CommDlgExtendedError());
PrintDlgA(NULL);
ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",
CDERR_INITIALIZATION, CommDlgExtendedError());
/* Before passing the ofn to Unicode functions, remove the ANSI strings */
ofn.lpstrFilter = NULL;
ofn.lpstrInitialDir = NULL;
ofn.lpstrDefExt = NULL;
PrintDlgA(NULL); PrintDlgA(NULL);
ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n", ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",
CDERR_INITIALIZATION, CommDlgExtendedError()); CDERR_INITIALIZATION, CommDlgExtendedError());
@ -97,19 +115,6 @@ static void test_DialogCancel(void)
CommDlgExtendedError()); CommDlgExtendedError());
} }
PrintDlgA(NULL);
ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",
CDERR_INITIALIZATION, CommDlgExtendedError());
result = GetSaveFileNameA(&ofn);
ok(0 == result, "expected %d, got %d\n", 0, result);
ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0,
CommDlgExtendedError());
PrintDlgA(NULL);
ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n",
CDERR_INITIALIZATION, CommDlgExtendedError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
result = GetSaveFileNameW((LPOPENFILENAMEW) &ofn); result = GetSaveFileNameW((LPOPENFILENAMEW) &ofn);
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)