From 6d150b1c57e0b649092e0dc0ee216284cf29d867 Mon Sep 17 00:00:00 2001 From: The Wine Synchronizer Date: Fri, 24 Aug 2007 09:07:52 +0000 Subject: [PATCH] Autosyncing with Wine HEAD svn path=/trunk/; revision=28511 --- rostests/winetests/comdlg32/comdlg32.rbuild | 15 ++ rostests/winetests/comdlg32/filedlg.c | 116 +++++++++++++++ rostests/winetests/comdlg32/printdlg.c | 153 ++++++++++++++++++++ rostests/winetests/comdlg32/testlist.c | 17 +++ rostests/winetests/directory.rbuild | 7 +- 5 files changed, 306 insertions(+), 2 deletions(-) create mode 100644 rostests/winetests/comdlg32/comdlg32.rbuild create mode 100644 rostests/winetests/comdlg32/filedlg.c create mode 100644 rostests/winetests/comdlg32/printdlg.c create mode 100644 rostests/winetests/comdlg32/testlist.c diff --git a/rostests/winetests/comdlg32/comdlg32.rbuild b/rostests/winetests/comdlg32/comdlg32.rbuild new file mode 100644 index 00000000000..2b7ed263c46 --- /dev/null +++ b/rostests/winetests/comdlg32/comdlg32.rbuild @@ -0,0 +1,15 @@ + + . + + 0x600 + 0x501 + 0x501 + wine + comdlg32 + user32 + kernel32 + ntdll + filedlg.c + printdlg.c + testlist.c + diff --git a/rostests/winetests/comdlg32/filedlg.c b/rostests/winetests/comdlg32/filedlg.c new file mode 100644 index 00000000000..698af1ac036 --- /dev/null +++ b/rostests/winetests/comdlg32/filedlg.c @@ -0,0 +1,116 @@ +/* + * Unit test suite for comdlg32 API functions: file dialogs + * + * Copyright 2007 Google (Lei Zhang) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include +#include + + +/* ##### */ + +static UINT CALLBACK OFNHookProc( HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + LPNMHDR nmh; + + if( msg == WM_NOTIFY) + { + nmh = (LPNMHDR) lParam; + if( nmh->code == CDN_INITDONE) + { + PostMessage( GetParent(hDlg), WM_COMMAND, IDCANCEL, FALSE); + } + } + + return 0; +} + +/* bug 6829 */ +static void test_DialogCancel(void) +{ + OPENFILENAMEA ofn; + BOOL result; + char szFileName[MAX_PATH] = ""; + + ZeroMemory(&ofn, sizeof(ofn)); + + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = NULL; + ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0"; + ofn.lpstrFile = szFileName; + ofn.nMaxFile = MAX_PATH; + ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLEHOOK; + ofn.lpstrDefExt = "txt"; + ofn.lpfnHook = (LPOFNHOOKPROC) OFNHookProc; + + PrintDlgA(NULL); + ok(CDERR_INITIALIZATION == CommDlgExtendedError(), "expected %d, got %d\n", + CDERR_INITIALIZATION, CommDlgExtendedError()); + + result = GetOpenFileNameA(&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); + result = GetOpenFileNameW((LPOPENFILENAMEW) &ofn); + if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + skip("GetOpenFileNameW is not implemented\n"); + else + { + 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()); + + 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); + result = GetSaveFileNameW((LPOPENFILENAMEW) &ofn); + if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + skip("GetSaveFileNameW is not implemented\n"); + else + { + ok(0 == result, "expected %d, got %d\n", 0, result); + ok(0 == CommDlgExtendedError(), "expected %d, got %d\n", 0, + CommDlgExtendedError()); + } +} + + +START_TEST(filedlg) +{ + test_DialogCancel(); + +} diff --git a/rostests/winetests/comdlg32/printdlg.c b/rostests/winetests/comdlg32/printdlg.c new file mode 100644 index 00000000000..5ace767872a --- /dev/null +++ b/rostests/winetests/comdlg32/printdlg.c @@ -0,0 +1,153 @@ +/* + * Unit test suite for comdlg32 API functions: printer dialogs + * + * Copyright 2006 Detlef Riekenberg + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + * + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "winerror.h" +#include "wingdi.h" +#include "wingdi.h" +#include "winuser.h" + +#include "cderr.h" +#include "commdlg.h" + +#include "wine/test.h" + + +/* ######## */ + +static void test_PageSetupDlgA(void) +{ + LPPAGESETUPDLGA pDlg; + DWORD res; + + pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PAGESETUPDLGA)) * 2); + if (!pDlg) return; + + SetLastError(0xdeadbeef); + res = PageSetupDlgA(NULL); + ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION), + "returned %u with %u and 0x%x (expected '0' and " + "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError()); + + ZeroMemory(pDlg, sizeof(PAGESETUPDLGA)); + pDlg->lStructSize = sizeof(PAGESETUPDLGA) -1; + SetLastError(0xdeadbeef); + res = PageSetupDlgA(pDlg); + ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE), + "returned %u with %u and 0x%x (expected '0' and " + "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError()); + + ZeroMemory(pDlg, sizeof(PAGESETUPDLGA)); + pDlg->lStructSize = sizeof(PAGESETUPDLGA) +1; + pDlg->Flags = PSD_RETURNDEFAULT; + SetLastError(0xdeadbeef); + res = PageSetupDlgA(pDlg); + ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE), + "returned %u with %u and 0x%x (expected '0' and CDERR_STRUCTSIZE)\n", + res, GetLastError(), CommDlgExtendedError()); + + + ZeroMemory(pDlg, sizeof(PAGESETUPDLGA)); + pDlg->lStructSize = sizeof(PAGESETUPDLGA); + pDlg->Flags = PSD_RETURNDEFAULT; + SetLastError(0xdeadbeef); + res = PageSetupDlgA(pDlg); + trace("after pagesetupdlga res = %d, le %d, ext error 0x%x\n", + res, GetLastError(), CommDlgExtendedError()); + ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN), + "returned %u with %u and 0x%x (expected '!= 0' or '0' and " + "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError()); + if (!res && (CommDlgExtendedError() == PDERR_NODEFAULTPRN)) { + skip("No printer configured.\n"); + HeapFree(GetProcessHeap(), 0, pDlg); + return; + } + ok( pDlg->hDevMode && pDlg->hDevNames, + "got %p and %p (expected '!= NULL' for both)\n", + pDlg->hDevMode, pDlg->hDevNames); + + GlobalFree(pDlg->hDevMode); + GlobalFree(pDlg->hDevNames); + + HeapFree(GetProcessHeap(), 0, pDlg); + +} + +/* ##### */ + +static void test_PrintDlgA(void) +{ + DWORD res; + LPPRINTDLGA pDlg; + + + pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PRINTDLGA)) * 2); + if (!pDlg) return; + + + /* will crash with unpatched wine */ + SetLastError(0xdeadbeef); + res = PrintDlgA(NULL); + ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION), + "returned %d with 0x%x and 0x%x (expected '0' and " + "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError()); + + ZeroMemory(pDlg, sizeof(PRINTDLGA)); + pDlg->lStructSize = sizeof(PRINTDLGA) - 1; + SetLastError(0xdeadbeef); + res = PrintDlgA(pDlg); + ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE), + "returned %d with 0x%x and 0x%x (expected '0' and " + "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError()); + + ZeroMemory(pDlg, sizeof(PRINTDLGA)); + pDlg->lStructSize = sizeof(PRINTDLGA) + 1; + pDlg->Flags = PD_RETURNDEFAULT; + SetLastError(0xdeadbeef); + res = PrintDlgA(pDlg); + ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE), + "returned %u with %u and 0x%x (expected '0' and " + "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError()); + + + ZeroMemory(pDlg, sizeof(PRINTDLGA)); + pDlg->lStructSize = sizeof(PRINTDLGA); + pDlg->Flags = PD_RETURNDEFAULT; + SetLastError(0xdeadbeef); + res = PrintDlgA(pDlg); + ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN), + "returned %d with 0x%x and 0x%x (expected '!= 0' or '0' and " + "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError()); + + HeapFree(GetProcessHeap(), 0, pDlg); + +} + + +START_TEST(printdlg) +{ + test_PageSetupDlgA(); + test_PrintDlgA(); + +} diff --git a/rostests/winetests/comdlg32/testlist.c b/rostests/winetests/comdlg32/testlist.c new file mode 100644 index 00000000000..abbda30eb5f --- /dev/null +++ b/rostests/winetests/comdlg32/testlist.c @@ -0,0 +1,17 @@ +/* Automatically generated file; DO NOT EDIT!! */ + +#define WIN32_LEAN_AND_MEAN +#include + +#define STANDALONE +#include "wine/test.h" + +extern void func_filedlg(void); +extern void func_printdlg(void); + +const struct test winetest_testlist[] = +{ + { "filedlg", func_filedlg }, + { "printdlg", func_printdlg }, + { 0, 0 } +}; diff --git a/rostests/winetests/directory.rbuild b/rostests/winetests/directory.rbuild index b05b0f0e4d7..2f8e1c86939 100644 --- a/rostests/winetests/directory.rbuild +++ b/rostests/winetests/directory.rbuild @@ -8,17 +8,20 @@ + + + - + - + -- 2.17.1