d3d: Remove AddRef from IWineD3DDevice_GetDepthStencilSurface.
[wine.git] / dlls / comdlg32 / tests / printdlg.c
blobbd3ddf1364f35ff0db0344e11ef37436b077f18d
1 /*
2 * Unit test suite for comdlg32 API functions: printer dialogs
4 * Copyright 2006 Detlef Riekenberg
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include <stdarg.h>
24 #include "windef.h"
25 #include "winbase.h"
26 #include "winerror.h"
27 #include "wingdi.h"
28 #include "wingdi.h"
29 #include "winuser.h"
31 #include "cderr.h"
32 #include "commdlg.h"
34 #include "wine/test.h"
37 /* ##### */
39 static void test_PrintDlgA(void)
41 DWORD res;
42 LPPRINTDLGA pDlg;
45 pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PRINTDLGA)) * 2);
46 if (!pDlg) return;
49 #if 0
50 /* will crash with unpatched wine */
51 SetLastError(0xdeadbeef);
52 res = PrintDlgA(NULL);
53 ok( !res && (CommDlgExtendedError() == CDERR_INITIALIZATION),
54 "returned %ld with 0x%lx and 0x%lx (expected '0' and " \
55 "CDERR_INITIALIZATION)\n", res, GetLastError(), CommDlgExtendedError());
57 #endif
59 ZeroMemory(pDlg, sizeof(PRINTDLGA));
60 pDlg->lStructSize = sizeof(PRINTDLGA) - 1;
61 SetLastError(0xdeadbeef);
62 res = PrintDlgA(pDlg);
63 ok( !res && (CommDlgExtendedError() == CDERR_STRUCTSIZE),
64 "returned %d with 0x%x and 0x%x (expected '0' and " \
65 "CDERR_STRUCTSIZE)\n", res, GetLastError(), CommDlgExtendedError());
68 ZeroMemory(pDlg, sizeof(PRINTDLGA));
69 pDlg->lStructSize = sizeof(PRINTDLGA);
70 pDlg->Flags = PD_RETURNDEFAULT;
71 SetLastError(0xdeadbeef);
72 res = PrintDlgA(pDlg);
73 ok( res || (CommDlgExtendedError() == PDERR_NODEFAULTPRN),
74 "returned %d with 0x%x and 0x%x (expected '!= 0' or '0' and " \
75 "PDERR_NODEFAULTPRN)\n", res, GetLastError(), CommDlgExtendedError());
77 HeapFree(GetProcessHeap(), 0, pDlg);
82 START_TEST(printdlg)
84 test_PrintDlgA();