Autosyncing with Wine HEAD

svn path=/trunk/; revision=28511
This commit is contained in:
The Wine Synchronizer 2007-08-24 09:07:52 +00:00
parent bbc41d3721
commit 6d150b1c57
5 changed files with 306 additions and 2 deletions

View file

@ -0,0 +1,15 @@
<module name="comdlg32_winetest" type="win32cui" installbase="bin" installname="comdlg32_winetest.exe" allowwarnings="true">
<include base="comdlg32_winetest">.</include>
<define name="__USE_W32API" />
<define name="_WIN32_IE">0x600</define>
<define name="_WIN32_WINNT">0x501</define>
<define name="WINVER">0x501</define>
<library>wine</library>
<library>comdlg32</library>
<library>user32</library>
<library>kernel32</library>
<library>ntdll</library>
<file>filedlg.c</file>
<file>printdlg.c</file>
<file>testlist.c</file>
</module>

View file

@ -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 <windows.h>
#include <wine/test.h>
/* ##### */
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();
}

View file

@ -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 <stdarg.h>
#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();
}

View file

@ -0,0 +1,17 @@
/* Automatically generated file; DO NOT EDIT!! */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#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 }
};

View file

@ -8,17 +8,20 @@
<directory name="comctl32">
<xi:include href="comctl32/comctl32.rbuild" />
</directory>
<directory name="comdlg32">
<xi:include href="comdlg32/comdlg32.rbuild" />
</directory>
<directory name="gdi32">
<xi:include href="gdi32/gdi32.rbuild" />
</directory>
<directory name="icmp">
<xi:include href="icmp/icmp.rbuild" />
<xi:include href="icmp/icmp.rbuild" />
</directory>
<directory name="kernel32">
<xi:include href="kernel32/kernel32.rbuild" />
</directory>
<directory name="lz32">
<xi:include href="lz32/lz32.rbuild" />
<xi:include href="lz32/lz32.rbuild" />
</directory>
<directory name="msi">
<xi:include href="msi/msi.rbuild" />