2006-07-03 22:55:53 +02:00
|
|
|
/*
|
|
|
|
* 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_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),
|
2006-12-14 18:13:01 +01:00
|
|
|
"returned %d with 0x%x and 0x%x (expected '0' and " \
|
2006-07-03 22:55:53 +02:00
|
|
|
"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),
|
2006-10-05 22:05:21 +02:00
|
|
|
"returned %d with 0x%x and 0x%x (expected '0' and " \
|
2006-07-03 22:55:53 +02:00
|
|
|
"CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
|
|
|
|
|
|
|
|
|
|
|
|
ZeroMemory(pDlg, sizeof(PRINTDLGA));
|
|
|
|
pDlg->lStructSize = sizeof(PRINTDLGA);
|
|
|
|
pDlg->Flags = PD_RETURNDEFAULT;
|
|
|
|
SetLastError(0xdeadbeef);
|
|
|
|
res = PrintDlgA(pDlg);
|
2006-07-23 20:39:18 +02:00
|
|
|
ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN),
|
2006-10-05 22:05:21 +02:00
|
|
|
"returned %d with 0x%x and 0x%x (expected '!= 0' or '0' and " \
|
2006-07-23 20:39:18 +02:00
|
|
|
"PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());
|
2006-07-03 22:55:53 +02:00
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, pDlg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
START_TEST(printdlg)
|
|
|
|
{
|
|
|
|
test_PrintDlgA();
|
|
|
|
|
|
|
|
}
|