Author: akhaldi
Date: Sat Oct 5 20:44:20 2013
New Revision: 60546
URL:
http://svn.reactos.org/svn/reactos?rev=60546&view=rev
Log:
[COMDLG32_WINETEST]
* Sync with Wine 1.7.1.
CORE-7469
Modified:
trunk/rostests/winetests/comdlg32/CMakeLists.txt
trunk/rostests/winetests/comdlg32/filedlg.c
trunk/rostests/winetests/comdlg32/finddlg.c
trunk/rostests/winetests/comdlg32/fontdlg.c
trunk/rostests/winetests/comdlg32/itemdlg.c
trunk/rostests/winetests/comdlg32/printdlg.c
trunk/rostests/winetests/comdlg32/rsrc.rc
trunk/rostests/winetests/comdlg32/testlist.c
Modified: trunk/rostests/winetests/comdlg32/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/CMakeL…
==============================================================================
--- trunk/rostests/winetests/comdlg32/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/CMakeLists.txt [iso-8859-1] Sat Oct 5 20:44:20
2013
@@ -1,5 +1,3 @@
-
-add_definitions(-D__ROS_LONG64__)
list(APPEND SOURCE
filedlg.c
@@ -7,12 +5,10 @@
fontdlg.c
itemdlg.c
printdlg.c
- testlist.c
- rsrc.rc)
+ testlist.c)
-add_executable(comdlg32_winetest ${SOURCE})
-target_link_libraries(comdlg32_winetest wine uuid)
-
+add_executable(comdlg32_winetest ${SOURCE} rsrc.rc)
+target_link_libraries(comdlg32_winetest uuid)
set_module_type(comdlg32_winetest win32cui)
-add_importlibs(comdlg32_winetest comdlg32 winspool user32 gdi32 msvcrt kernel32 ntdll
ole32 shell32)
+add_importlibs(comdlg32_winetest comdlg32 winspool user32 gdi32 ole32 shell32 msvcrt
kernel32)
add_cd_file(TARGET comdlg32_winetest DESTINATION reactos/bin FOR all)
Modified: trunk/rostests/winetests/comdlg32/filedlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/filedl…
==============================================================================
--- trunk/rostests/winetests/comdlg32/filedlg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/filedlg.c [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -19,12 +19,23 @@
*
*/
-#include <windows.h>
+//#include <windows.h>
+
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
#include <wine/test.h>
-#include "shlguid.h"
+#include <wingdi.h>
+#include <objbase.h>
+#include <cderr.h>
+#include <dlgs.h>
+#include <commdlg.h>
+
+#include <shlguid.h>
#define COBJMACROS
-#include "shobjidl.h"
+#include <shobjidl.h>
/* ##### */
@@ -93,7 +104,7 @@
ZeroMemory(&ofn, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ofn.hwndOwner = NULL;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
@@ -239,7 +250,7 @@
return 0;
}
-static LONG_PTR WINAPI template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static UINT_PTR WINAPI template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_INITDIALOG)
{
@@ -266,7 +277,7 @@
char filename[1024] = {0};
DWORD ret;
- ofn.lStructSize = sizeof(ofn);
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ofn.lpstrFile = filename;
ofn.nMaxFile = 1024;
ofn.lpfnHook = create_view_window2_hook;
@@ -283,10 +294,10 @@
char filename[1024] = {0};
DWORD ret;
- ofn.lStructSize = sizeof(ofn);
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ofn.lpstrFile = filename;
ofn.nMaxFile = 1024;
- ofn.lpfnHook = (LPOFNHOOKPROC)template_hook;
+ ofn.lpfnHook = template_hook;
ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER| OFN_ENABLETEMPLATE;
ofn.hInstance = GetModuleHandleA(NULL);
ofn.lpTemplateName = "template1";
@@ -318,7 +329,7 @@
{ 0xffffffff }
};
-static LONG_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM
lParam)
+static UINT_PTR WINAPI resize_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM
lParam)
{
static RECT initrc, rc;
static int index, count;
@@ -531,14 +542,14 @@
static void test_resize(void)
{
- OPENFILENAME ofn = { sizeof(OPENFILENAME)};
+ OPENFILENAME ofn = { OPENFILENAME_SIZE_VERSION_400 };
char filename[1024] = {0};
DWORD ret;
int i;
ofn.lpstrFile = filename;
ofn.nMaxFile = 1024;
- ofn.lpfnHook = (LPOFNHOOKPROC) resize_template_hook;
+ ofn.lpfnHook = resize_template_hook;
ofn.hInstance = GetModuleHandle(NULL);
ofn.lpTemplateName = "template_sz";
for( i = 0; resize_testcases[i].flags != 0xffffffff; i++) {
@@ -581,7 +592,7 @@
/* test_ok_wndproc can be used as hook procedure or a subclass
* window proc for the file dialog */
-static LONG_PTR WINAPI test_ok_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static UINT_PTR WINAPI test_ok_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
HWND parent = GetParent( dlg);
static ok_wndproc_testcase *testcase = NULL;
@@ -624,7 +635,7 @@
return FALSE;
}
-static LONG_PTR WINAPI ok_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM
lParam)
+static UINT_PTR WINAPI ok_template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM
lParam)
{
if (msg == WM_SETFONT)
SetWindowLongPtrA( dlg, GWLP_WNDPROC, (LONG_PTR) test_ok_wndproc);
@@ -633,7 +644,7 @@
static void test_ok(void)
{
- OPENFILENAME ofn = { sizeof(OPENFILENAME)};
+ OPENFILENAME ofn = { OPENFILENAME_SIZE_VERSION_400 };
char filename[1024] = {0};
char tmpfilename[ MAX_PATH];
char curdir[MAX_PATH];
@@ -655,9 +666,7 @@
for( i = 0; ok_testcases[i].retval != -1; i++) {
strcpy( filename, tmpfilename);
ofn.lCustData = (LPARAM)(ok_testcases + i);
- ofn.lpfnHook = ok_testcases[i].do_subclass
- ? (LPOFNHOOKPROC) ok_template_hook
- : (LPOFNHOOKPROC) test_ok_wndproc;
+ ofn.lpfnHook = ok_testcases[i].do_subclass ? ok_template_hook : test_ok_wndproc;
ret = GetOpenFileNameA(&ofn);
ok( ok_testcases[i].expclose == ok_testcases[i].actclose,
"testid %d: Open File dialog should %shave closed.\n", i,
@@ -706,7 +715,7 @@
{ -1 }
};
-static LONG_PTR WINAPI template_hook_arrange(HWND dlgChild, UINT msg, WPARAM wParam,
LPARAM lParam)
+static UINT_PTR WINAPI template_hook_arrange(HWND dlgChild, UINT msg, WPARAM wParam,
LPARAM lParam)
{
static int index, fixhelp;
static posz posz0[2];
@@ -843,10 +852,10 @@
return;
}
- ofn.lStructSize = sizeof(ofn);
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ofn.lpstrFile = filename;
ofn.nMaxFile = 1024;
- ofn.lpfnHook = (LPOFNHOOKPROC)template_hook_arrange;
+ ofn.lpfnHook = template_hook_arrange;
ofn.hInstance = hDlgTmpl;
ofn.lpstrFilter="text\0*.txt\0All\0*\0\0";
for( i = 0; arrange_tests[i].nrcontrols != -1; i++) {
@@ -916,7 +925,7 @@
ZeroMemory(&ofn, sizeof(ofn));
- ofn.lStructSize = sizeof(ofn);
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ofn.hwndOwner = NULL;
ofn.lpstrFilter = "Text Files (*.txt)\0*.txt\0All Files (*.*)\0*.*\0";
ofn.lpstrFile = szFileName;
@@ -948,7 +957,7 @@
skip( "some interactive resizable dialog tests (set
WINETEST_INTERACTIVE=1)\n");
return;
}
- ofn.lStructSize = sizeof(ofn);
+ ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
ofn.lpstrFile = filename;
ofn.nMaxFile = 1024;
ofn.lpfnHook = NULL;
@@ -983,7 +992,7 @@
static void test_mru(void)
{
ok_wndproc_testcase testcase = {0};
- OPENFILENAME ofn = {sizeof(OPENFILENAME)};
+ OPENFILENAME ofn = { OPENFILENAME_SIZE_VERSION_400 };
const char *test_dir_name = "C:\\mru_test";
const char *test_file_name = "test.txt";
const char *test_full_path = "C:\\mru_test\\test.txt";
@@ -996,7 +1005,7 @@
ofn.hInstance = GetModuleHandle(NULL);
ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER | OFN_ENABLETEMPLATE | OFN_NOCHANGEDIR;
ofn.lCustData = (LPARAM)&testcase;
- ofn.lpfnHook = (LPOFNHOOKPROC)test_ok_wndproc;
+ ofn.lpfnHook = test_ok_wndproc;
SetLastError(0xdeadbeef);
ret = CreateDirectoryA(test_dir_name, NULL);
@@ -1044,55 +1053,198 @@
return FALSE;
}
-static const char *defext_filters[] = {
- "TestFilter (*.pt*)\0*.pt*\0",
- "TestFilter (*.ab?)\0*.ab?\0",
- "TestFilter (*.*)\0*.*\0",
- NULL /* is a test, not an endmark! */
-};
-
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
+static void test_extension_helper(OPENFILENAME* ofn, const char *filter,
+ const char *expected_filename)
+{
+ char *filename_ptr;
+ DWORD ret;
+ BOOL boolret;
+
+ strcpy(ofn->lpstrFile, "deadbeef");
+ ofn->lpstrFilter = filter;
+
+ boolret = GetSaveFileNameA(ofn);
+ ok(boolret, "%s: expected TRUE\n", filter);
+
+ ret = CommDlgExtendedError();
+ ok(!ret, "%s: CommDlgExtendedError returned %#x\n", filter, ret);
+
+ filename_ptr = ofn->lpstrFile + ofn->nFileOffset;
+ ok(strcmp(filename_ptr, expected_filename) == 0,
+ "%s: Filename is %s, expected %s\n", filter, filename_ptr,
expected_filename);
+}
+
static void test_extension(void)
{
- OPENFILENAME ofn = { sizeof(OPENFILENAME)};
+ OPENFILENAME ofn = { OPENFILENAME_SIZE_VERSION_400 };
char filename[1024] = {0};
char curdir[MAX_PATH];
- char *filename_ptr;
- const char *test_file_name = "deadbeef";
unsigned int i;
- DWORD ret;
BOOL boolret;
+
+ const char *defext_concrete_filters[] = {
+ "TestFilter (*.abc)\0*.abc\0",
+ "TestFilter (*.abc;)\0*.abc;\0",
+ "TestFilter (*.abc;*.def)\0*.abc;*.def\0",
+ };
+
+ const char *defext_wildcard_filters[] = {
+ "TestFilter (*.pt*)\0*.pt*\0",
+ "TestFilter (*.pt*;*.abc)\0*.pt*;*.abc\0",
+ "TestFilter (*.ab?)\0*.ab?\0",
+ "TestFilter (*.*)\0*.*\0",
+ "TestFilter (*sav)\0*sav\0",
+ NULL /* is a test, not an endmark! */
+ };
boolret = GetCurrentDirectoryA(sizeof(curdir), curdir);
ok(boolret, "Failed to get current dir err %d\n", GetLastError());
- /* Ignore .* extension */
- ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = filename;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_ENABLEHOOK;
- ofn.lpstrDefExt = NULL;
ofn.lpstrInitialDir = curdir;
ofn.lpfnHook = test_extension_wndproc;
ofn.nFileExtension = 0;
- for (i = 0; i < ARRAY_SIZE(defext_filters); i++) {
- ofn.lpstrFilter = defext_filters[i];
- strcpy(filename, test_file_name);
- boolret = GetSaveFileNameA(&ofn);
- ok(boolret, "%u: expected true\n", i);
- ret = CommDlgExtendedError();
- ok(!ret, "%u: CommDlgExtendedError returned %#x\n", i, ret);
- filename_ptr = ofn.lpstrFile + strlen( ofn.lpstrFile ) - strlen( test_file_name
);
- ok( strlen(ofn.lpstrFile) >= strlen(test_file_name), "Filename %s is too
short\n", ofn.lpstrFile );
- ok( strcmp(filename_ptr, test_file_name) == 0,
- "Filename is %s, expected %s\n", filename_ptr, test_file_name );
+ ofn.lpstrDefExt = NULL;
+
+ /* Without lpstrDefExt, append no extension */
+ test_extension_helper(&ofn, "TestFilter (*.abc)
lpstrDefExt=NULL\0*.abc\0", "deadbeef");
+ test_extension_helper(&ofn, "TestFilter (*.ab?)
lpstrDefExt=NULL\0*.ab?\0", "deadbeef");
+
+ ofn.lpstrDefExt = "";
+
+ /* If lpstrDefExt="" and the filter has a concrete extension, append it */
+ test_extension_helper(&ofn, "TestFilter (*.abc)
lpstrDefExt=\"\"\0*.abc\0", "deadbeef.abc");
+
+ /* If lpstrDefExt="" and the filter has a wildcard extension, do nothing
*/
+ test_extension_helper(&ofn, "TestFilter (*.ab?)
lpstrDefExt=\"\"\0*.ab?\0", "deadbeef");
+
+ ofn.lpstrDefExt = "xyz";
+
+ /* Append concrete extensions from filters */
+ for (i = 0; i < ARRAY_SIZE(defext_concrete_filters); i++) {
+ test_extension_helper(&ofn, defext_concrete_filters[i],
"deadbeef.abc");
+ }
+
+ /* Append nothing from this filter */
+ test_extension_helper(&ofn, "TestFilter (*.)\0*.\0",
"deadbeef");
+
+ /* Ignore wildcard extensions in filters */
+ for (i = 0; i < ARRAY_SIZE(defext_wildcard_filters); i++) {
+ test_extension_helper(&ofn, defext_wildcard_filters[i],
"deadbeef.xyz");
}
}
#undef ARRAY_SIZE
+
+
+static BOOL WINAPI test_null_enum(HWND hwnd, LPARAM lParam)
+{
+ /* Find the textbox and send a filename so IDOK will work.
+ If the file textbox is empty IDOK will be ignored */
+ CHAR className[20];
+ if(GetClassNameA(hwnd, className, sizeof(className)) > 0 &&
!strcmp("Edit",className))
+ {
+ SetWindowText(hwnd, "testfile");
+ return FALSE; /* break window enumeration */
+ }
+ return TRUE;
+}
+
+static UINT_PTR WINAPI test_null_wndproc(HWND dlg, UINT msg, WPARAM wParam, LPARAM
lParam)
+{
+ HWND parent = GetParent( dlg);
+ if( msg == WM_NOTIFY) {
+ SetTimer( dlg, 0, 100, 0);
+ SetTimer( dlg, 1, 1000, 0);
+ EnumChildWindows( parent, test_null_enum, 0);
+ }
+ if( msg == WM_TIMER) {
+ if(!wParam)
+ PostMessage( parent, WM_COMMAND, IDOK, 0);
+ else {
+ /* the dialog did not close automatically */
+ KillTimer( dlg, 0);
+ PostMessage( parent, WM_COMMAND, IDCANCEL, 0);
+ }
+ }
+ return FALSE;
+}
+
+static void test_null_filename(void)
+{
+ OPENFILENAMEA ofnA = {0};
+ OPENFILENAMEW ofnW = {0};
+ WCHAR filterW[] =
{'t','e','x','t','\0','*','.','t','x','t','\0',
+
'A','l','l','\0','*','\0','\0'};
+ DWORD ret;
+
+ ofnA.lStructSize = OPENFILENAME_SIZE_VERSION_400A;
+ ofnA.lpstrFile = NULL;
+ ofnA.nMaxFile = 0;
+ ofnA.nFileOffset = 0xdead;
+ ofnA.nFileExtension = 0xbeef;
+ ofnA.lpfnHook = test_null_wndproc;
+ ofnA.Flags = OFN_ENABLEHOOK | OFN_EXPLORER;
+ ofnA.hInstance = GetModuleHandleA(NULL);
+ ofnA.lpstrFilter = "text\0*.txt\0All\0*\0\0";
+ ofnA.lpstrDefExt = NULL;
+ ret = GetOpenFileNameA(&ofnA);
+ todo_wine ok(ret, "GetOpenFileNameA returned %#x\n", ret);
+ ret = CommDlgExtendedError();
+ todo_wine ok(!ret, "CommDlgExtendedError returned %#x, should be 0\n",
ret);
+
+ todo_wine ok(ofnA.nFileOffset != 0xdead, "ofnA.nFileOffset is 0xdead\n");
+ todo_wine ok(ofnA.nFileExtension != 0xbeef, "ofnA.nFileExtension is
0xbeef\n");
+
+ ofnA.lpstrFile = NULL;
+ ofnA.nMaxFile = 1024; /* bogus input - lpstrFile = NULL but fake 1024 bytes available
*/
+ ofnA.nFileOffset = 0xdead;
+ ofnA.nFileExtension = 0xbeef;
+ ret = GetOpenFileNameA(&ofnA);
+ ok(ret, "GetOpenFileNameA returned %#x\n", ret);
+ ret = CommDlgExtendedError();
+ ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+
+ ok(ofnA.nFileOffset != 0xdead, "ofnA.nFileOffset is 0xdead\n");
+ ok(ofnA.nFileExtension == 0, "ofnA.nFileExtension is 0x%x, should be 0\n",
ofnA.nFileExtension);
+
+ /* unicode tests */
+ ofnW.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
+ ofnW.lpstrFile = NULL;
+ ofnW.nMaxFile = 0;
+ ofnW.nFileOffset = 0xdead;
+ ofnW.nFileExtension = 0xbeef;
+ ofnW.lpfnHook = test_null_wndproc;
+ ofnW.Flags = OFN_ENABLEHOOK | OFN_EXPLORER;
+ ofnW.hInstance = GetModuleHandleW(NULL);
+ ofnW.lpstrFilter = filterW;
+ ofnW.lpstrDefExt = NULL;
+ ret = GetOpenFileNameW(&ofnW);
+ todo_wine ok(ret, "GetOpenFileNameW returned %#x\n", ret);
+ ret = CommDlgExtendedError();
+ todo_wine ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+
+ todo_wine ok(ofnW.nFileOffset != 0xdead, "ofnW.nFileOffset is 0xdead\n");
+ todo_wine ok(ofnW.nFileExtension != 0xbeef, "ofnW.nFileExtension is
0xbeef\n");
+
+ ofnW.lpstrFile = NULL;
+ ofnW.nMaxFile = 1024; /* bogus input - lpstrFile = NULL but fake 1024 bytes available
*/
+ ofnW.nFileOffset = 0xdead;
+ ofnW.nFileExtension = 0xbeef;
+ ret = GetOpenFileNameW(&ofnW);
+ ok(ret, "GetOpenFileNameA returned %#x\n", ret);
+ ret = CommDlgExtendedError();
+ ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
+
+ ok(ofnW.nFileOffset != 0xdead, "ofnW.nFileOffset is 0xdead\n");
+ ok(ofnW.nFileExtension == 0, "ofnW.nFileExtension is 0x%x, should be 0\n",
ofnW.nFileExtension);
+}
START_TEST(filedlg)
{
@@ -1106,4 +1258,5 @@
test_mru();
if( resizesupported) test_resizable2();
test_extension();
-}
+ test_null_filename();
+}
Modified: trunk/rostests/winetests/comdlg32/finddlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/finddl…
==============================================================================
--- trunk/rostests/winetests/comdlg32/finddlg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/finddlg.c [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -19,9 +19,16 @@
*
*/
-#include "windows.h"
-#include "commdlg.h"
-#include "wine/test.h"
+//#include "windows.h"
+
+#define WIN32_NO_STATUS
+
+#include <wine/test.h>
+
+#include <wingdi.h>
+#include <winuser.h>
+#include <cderr.h>
+#include <commdlg.h>
static UINT ID_FINDMSGSTRING;
Modified: trunk/rostests/winetests/comdlg32/fontdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/fontdl…
==============================================================================
--- trunk/rostests/winetests/comdlg32/fontdlg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/fontdlg.c [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -19,19 +19,21 @@
*
*/
-#include <stdarg.h>
+#define WIN32_NO_STATUS
-#include "windef.h"
-#include "winbase.h"
-#include "winerror.h"
-#include "wingdi.h"
-#include "winspool.h"
-#include "winuser.h"
-#include "objbase.h"
+#include <wine/test.h>
-#include "commdlg.h"
+//#include <stdarg.h>
-#include "wine/test.h"
+//#include "windef.h"
+//#include "winbase.h"
+//#include "winerror.h"
+#include <wingdi.h>
+#include <winspool.h>
+#include <winuser.h>
+//#include "objbase.h"
+
+#include <commdlg.h>
static int get_dpiy(void)
{
Modified: trunk/rostests/winetests/comdlg32/itemdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/itemdl…
==============================================================================
--- trunk/rostests/winetests/comdlg32/itemdlg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/itemdlg.c [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -19,11 +19,16 @@
*
*/
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
+#include <wine/test.h>
+
#define COBJMACROS
#define CONST_VTABLE
-#include "shlobj.h"
-#include "wine/test.h"
+#include <shlobj.h>
static HRESULT (WINAPI
*pSHCreateShellItem)(LPCITEMIDLIST,IShellFolder*,LPCITEMIDLIST,IShellItem**);
static HRESULT (WINAPI *pSHGetIDListFromObject)(IUnknown*, PIDLIST_ABSOLUTE*);
@@ -277,17 +282,26 @@
IExplorerBrowser *peb;
IShellBrowser *psb;
+ hr = IServiceProvider_QueryService(psp, &SID_SExplorerBrowserFrame,
&IID_ICommDlgBrowser, (void**)&punk);
+ ok(hr == S_OK, "got 0x%08x.\n", hr);
+ if(SUCCEEDED(hr)) IUnknown_Release(punk);
+
+ /* since win8, the result is E_NOTIMPL for all other services */
hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser,
&IID_IExplorerBrowser, (void**)&peb);
- ok(hr == E_FAIL, "got 0x%08x.\n", hr);
+ ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08x (expected
E_NOTIMPL)\n", hr);
if(SUCCEEDED(hr)) IExplorerBrowser_Release(peb);
hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser,
&IID_IShellBrowser, (void**)&psb);
- ok(hr == E_FAIL, "got 0x%08x.\n", hr);
+ ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08x (expected
E_NOTIMPL)\n", hr);
if(SUCCEEDED(hr)) IShellBrowser_Release(psb);
hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser,
&IID_ICommDlgBrowser, (void**)&punk);
- ok(hr == E_FAIL, "got 0x%08x.\n", hr);
+ ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08x (expected
E_NOTIMPL)\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
- hr = IServiceProvider_QueryService(psp, &SID_SExplorerBrowserFrame,
&IID_ICommDlgBrowser, (void**)&punk);
- ok(hr == S_OK, "got 0x%08x.\n", hr);
+
+ hr = IServiceProvider_QueryService(psp, &SID_STopLevelBrowser,
&IID_IUnknown, (void**)&punk);
+ ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08x (expected
E_NOTIMPL)\n", hr);
+ if(SUCCEEDED(hr)) IUnknown_Release(punk);
+ hr = IServiceProvider_QueryService(psp, &IID_IUnknown, &IID_IUnknown,
(void**)&punk);
+ ok(hr == E_NOTIMPL || broken(hr == E_FAIL), "got 0x%08x (expected
E_NOTIMPL)\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
IServiceProvider_Release(psp);
@@ -369,7 +383,7 @@
hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IFileDialogEvents,
(void**)&punk);
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
- if(SUCCEEDED(hr)) IUnknown_Release(pfd);
+ if(SUCCEEDED(hr)) IFileDialog_Release(pfd);
hr = IFileSaveDialog_QueryInterface(pfsd, &IID_IExplorerBrowser,
(void**)&punk);
ok(hr == E_NOINTERFACE, "got 0x%08x.\n", hr);
@@ -379,7 +393,7 @@
ok(hr == S_OK, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
- hr = IFileOpenDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3,
(void**)&punk);
+ hr = IFileSaveDialog_QueryInterface(pfsd, &IID_ICommDlgBrowser3,
(void**)&punk);
ok(hr == S_OK, "got 0x%08x.\n", hr);
if(SUCCEEDED(hr)) IUnknown_Release(punk);
@@ -1378,11 +1392,12 @@
&IID_IFileDialog, (void**)&pfod);
ok(hr == S_OK, "got 0x%08x.\n", hr);
- hr = IFileOpenDialog_QueryInterface(pfod, &IID_IFileDialogCustomize,
(void**)&pfdc);
+ hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize,
(void**)&pfdc);
ok(hr == S_OK, "got 0x%08x.\n", hr);
if(FAILED(hr))
{
skip("Skipping IFileDialogCustomize tests.\n");
+ IFileDialog_Release(pfod);
return;
}
@@ -1666,7 +1681,7 @@
IFileDialogEvents_Release(pfde);
IFileDialogCustomize_Release(pfdc);
- ref = IFileOpenDialog_Release(pfod);
+ ref = IFileDialog_Release(pfod);
ok(!ref, "Refcount not zero (%d).\n", ref);
@@ -1674,7 +1689,7 @@
&IID_IFileDialog, (void**)&pfod);
ok(hr == S_OK, "got 0x%08x.\n", hr);
- hr = IFileDialogCustomize_QueryInterface(pfod, &IID_IFileDialogCustomize,
(void**)&pfdc);
+ hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize,
(void**)&pfdc);
ok(hr == S_OK, "got 0x%08x.\n", hr);
i = 0;
@@ -1884,8 +1899,32 @@
}
IFileDialogCustomize_Release(pfdc);
- ref = IFileOpenDialog_Release(pfod);
+ ref = IFileDialog_Release(pfod);
ok(!ref, "Refcount not zero (%d).\n", ref);
+}
+
+static void test_persistent_state(void)
+{
+ IFileDialog *fd;
+ HRESULT hr;
+
+ hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER,
+ &IID_IFileDialog, (void**)&fd);
+ ok(hr == S_OK, "got 0x%08x.\n", hr);
+
+if (0)
+{
+ /* crashes at least on Win8 */
+ hr = IFileDialog_SetClientGuid(fd, NULL);
+}
+
+ hr = IFileDialog_SetClientGuid(fd, &IID_IUnknown);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IFileDialog_SetClientGuid(fd, &IID_NULL);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ IFileDialog_Release(fd);
}
START_TEST(itemdlg)
@@ -1899,6 +1938,7 @@
test_advise();
test_filename();
test_customize();
+ test_persistent_state();
}
else
skip("Skipping all Item Dialog tests.\n");
Modified: trunk/rostests/winetests/comdlg32/printdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/printd…
==============================================================================
--- trunk/rostests/winetests/comdlg32/printdlg.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/printdlg.c [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -2,6 +2,7 @@
* Unit test suite for comdlg32 API functions: printer dialogs
*
* Copyright 2006-2007 Detlef Riekenberg
+ * Copyright 2013 Dmitry Timoshkov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,24 +20,31 @@
*
*/
-#include <stdarg.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "winerror.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "objbase.h"
-
-#include "cderr.h"
-#include "commdlg.h"
-
-#include "wine/test.h"
+#define COBJMACROS
+#define CONST_VTABLE
+#define WIN32_NO_STATUS
+
+#include <wine/test.h>
+
+//#include <stdarg.h>
+#include <stdio.h>
+
+//#include "windef.h"
+//#include "winbase.h"
+//#include "winerror.h"
+#include <wingdi.h>
+#include <winuser.h>
+#include <objbase.h>
+
+#include <cderr.h>
+#include <commdlg.h>
+#include <dlgs.h>
/* ########################### */
+extern const IID IID_IObjectWithSite;
+
static HMODULE hcomdlg32;
-static HRESULT (WINAPI * pPrintDlgExA)(LPPRINTDLGEXA);
static HRESULT (WINAPI * pPrintDlgExW)(LPPRINTDLGEXW);
/* ########################### */
@@ -44,25 +52,16 @@
static const CHAR emptyA[] = "";
static const CHAR PrinterPortsA[] = "PrinterPorts";
-/* ########################### */
-
-static LPCSTR load_functions(void)
-{
- LPCSTR ptr;
-
- ptr = "comdlg32.dll";
- hcomdlg32 = GetModuleHandleA(ptr);
-
- ptr = "PrintDlgExA";
- pPrintDlgExA = (void *) GetProcAddress(hcomdlg32, ptr);
- if (!pPrintDlgExA) return ptr;
-
- ptr = "PrintDlgExW";
- pPrintDlgExW = (void *) GetProcAddress(hcomdlg32, ptr);
- if (!pPrintDlgExW) return ptr;
-
- return NULL;
-
+static const char *debugstr_guid(const GUID *guid)
+{
+ static char buf[50];
+
+ if (!guid) return "(null)";
+ sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
+ guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
+ guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
+ guid->Data4[5], guid->Data4[6], guid->Data4[7]);
+ return buf;
}
/* ########################### */
@@ -127,9 +126,21 @@
/* ########################### */
+static UINT_PTR CALLBACK print_hook_proc(HWND hdlg, UINT msg, WPARAM wp, LPARAM lp)
+{
+ if (msg == WM_INITDIALOG)
+ {
+ /* some driver popup a dialog and hung the test or silently limit the number of
copies,
+ when trying to set more than 999 copies */
+ SetDlgItemInt(hdlg, edt3, 123, FALSE);
+ PostMessage(hdlg, WM_COMMAND, IDOK, FALSE);
+ }
+ return 0;
+}
+
static void test_PrintDlgA(void)
{
- DWORD res;
+ DWORD res, n_copies = 0;
LPPRINTDLGA pDlg;
DEVNAMES *pDevNames;
LPCSTR driver;
@@ -137,7 +148,7 @@
LPCSTR port;
CHAR buffer[MAX_PATH];
LPSTR ptr;
-
+ DEVMODE *dm;
pDlg = HeapAlloc(GetProcessHeap(), 0, (sizeof(PRINTDLGA)) * 2);
if (!pDlg) return;
@@ -200,9 +211,7 @@
/* The Driver Entry does not include a Path */
ptr = strrchr(driver, '\\');
- todo_wine {
ok( ptr == NULL, "got %p for '%s' (expected NULL for a simple
name)\n", ptr, driver);
- }
/* The Driver Entry does not have an extension (fixed to ".drv") */
ptr = strrchr(driver, '.');
@@ -220,37 +229,172 @@
res, GetLastError(), ptr, buffer);
if (ptr) ptr[0] = '\0';
- todo_wine {
ok( lstrcmpiA(driver, buffer) == 0,
"got driver '%s' (expected '%s')\n", driver,
buffer);
- }
-
+
+ n_copies = DeviceCapabilities(device, port, DC_COPIES, NULL, NULL);
+ ok(n_copies > 0, "DeviceCapabilities(DC_COPIES) failed\n");
}
GlobalUnlock(pDlg->hDevNames);
-
GlobalFree(pDlg->hDevMode);
GlobalFree(pDlg->hDevNames);
+
+ /* if device doesn't support printing of multiple copies then
+ * an attempt to set number of copies > 1 in print dialog would
+ * cause the PrintDlg under Windows display the MessageBox and
+ * the test will hang waiting for user response.
+ */
+ if (n_copies > 1)
+ {
+ ZeroMemory(pDlg, sizeof(*pDlg));
+ pDlg->lStructSize = sizeof(*pDlg);
+ pDlg->Flags = PD_ENABLEPRINTHOOK;
+ pDlg->lpfnPrintHook = print_hook_proc;
+ res = PrintDlg(pDlg);
+ ok(res, "PrintDlg error %#x\n", CommDlgExtendedError());
+ /* Version of Microsoft XPS Document Writer driver shipped before Win7
+ * reports that it can print multiple copies, but returns 1.
+ */
+ ok(pDlg->nCopies == 123 || broken(pDlg->nCopies == 1), "expected
nCopies 123, got %d\n", pDlg->nCopies);
+ ok(pDlg->hDevMode != 0, "hDevMode should not be 0\n");
+ dm = GlobalLock(pDlg->hDevMode);
+ /* some broken drivers use always PD_USEDEVMODECOPIES */
+ ok((S1(U1(*dm)).dmCopies == 1) || broken(S1(U1(*dm)).dmCopies == 123),
+ "expected dm->dmCopies 1, got %d\n", S1(U1(*dm)).dmCopies);
+ GlobalUnlock(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+
+ ZeroMemory(pDlg, sizeof(*pDlg));
+ pDlg->lStructSize = sizeof(*pDlg);
+ pDlg->Flags = PD_ENABLEPRINTHOOK | PD_USEDEVMODECOPIES;
+ pDlg->lpfnPrintHook = print_hook_proc;
+ res = PrintDlg(pDlg);
+ ok(res, "PrintDlg error %#x\n", CommDlgExtendedError());
+ ok(pDlg->nCopies == 1, "expected nCopies 1, got %d\n",
pDlg->nCopies);
+ ok(pDlg->hDevMode != 0, "hDevMode should not be 0\n");
+ dm = GlobalLock(pDlg->hDevMode);
+ ok(S1(U1(*dm)).dmCopies == 123, "expected dm->dmCopies 123, got
%d\n", S1(U1(*dm)).dmCopies);
+ GlobalUnlock(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+ }
+
HeapFree(GetProcessHeap(), 0, pDlg);
-
}
/* ########################### */
+static HRESULT WINAPI callback_QueryInterface(IPrintDialogCallback *iface,
+ REFIID riid, void **ppv)
+{
+ ok(0, "callback_QueryInterface(%s): unexpected call\n",
debugstr_guid(riid));
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI callback_AddRef(IPrintDialogCallback *iface)
+{
+ trace("callback_AddRef\n");
+ return 2;
+}
+
+static ULONG WINAPI callback_Release(IPrintDialogCallback *iface)
+{
+ trace("callback_Release\n");
+ return 1;
+}
+
+static HRESULT WINAPI callback_InitDone(IPrintDialogCallback *iface)
+{
+ trace("callback_InitDone\n");
+ return S_OK;
+}
+
+static HRESULT WINAPI callback_SelectionChange(IPrintDialogCallback *iface)
+{
+ trace("callback_SelectionChange\n");
+ return S_OK;
+}
+
+static HRESULT WINAPI callback_HandleMessage(IPrintDialogCallback *iface,
+ HWND hdlg, UINT msg, WPARAM wp, LPARAM lp, LRESULT *res)
+{
+ trace("callback_HandleMessage %p,%04x,%lx,%lx,%p\n", hdlg, msg, wp, lp,
res);
+ /* *res = PD_RESULT_PRINT; */
+ return S_OK;
+}
+
+static const IPrintDialogCallbackVtbl callback_Vtbl =
+{
+ callback_QueryInterface,
+ callback_AddRef,
+ callback_Release,
+ callback_InitDone,
+ callback_SelectionChange,
+ callback_HandleMessage
+};
+
+static IPrintDialogCallback callback = { &callback_Vtbl };
+
+static HRESULT WINAPI unknown_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
+{
+ trace("unknown_QueryInterface %s\n", debugstr_guid(riid));
+
+ if (IsEqualGUID(riid, &IID_IPrintDialogCallback))
+ {
+ *ppv = &callback;
+ return S_OK;
+ }
+ else if (IsEqualGUID(riid, &IID_IObjectWithSite))
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+
+ ok(0, "unexpected IID %s\n", debugstr_guid(riid));
+ *ppv = NULL;
+ return E_NOINTERFACE;
+}
+
+static ULONG WINAPI unknown_AddRef(IUnknown *iface)
+{
+ trace("unknown_AddRef\n");
+ return 2;
+}
+
+static ULONG WINAPI unknown_Release(IUnknown *iface)
+{
+ trace("unknown_Release\n");
+ return 1;
+}
+
+static const IUnknownVtbl unknown_Vtbl =
+{
+ unknown_QueryInterface,
+ unknown_AddRef,
+ unknown_Release
+};
+
+static IUnknown unknown = { &unknown_Vtbl };
+
static void test_PrintDlgExW(void)
{
+ PRINTPAGERANGE pagerange[2];
LPPRINTDLGEXW pDlg;
+ DEVNAMES *dn;
HRESULT res;
+
+ /* PrintDlgEx not present before w2k */
+ if (!pPrintDlgExW) {
+ skip("PrintDlgExW not available\n");
+ return;
+ }
/* Set CommDlgExtendedError != 0 */
PrintDlg(NULL);
SetLastError(0xdeadbeef);
res = pPrintDlgExW(NULL);
- if(res == E_NOTIMPL)
- {
- win_skip("PrintDlgExW returns not implemented\n");
- return;
- }
ok( (res == E_INVALIDARG),
"got 0x%x with %u and %u (expected 'E_INVALIDARG')\n",
res, GetLastError(), CommDlgExtendedError());
@@ -288,10 +432,136 @@
"got 0x%x with %u and %u (expected 'E_HANDLE')\n",
res, GetLastError(), CommDlgExtendedError());
+ /* nStartPage must be START_PAGE_GENERAL for the general page or a valid property
sheet index */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING | PD_NOPAGENUMS;
+ res = pPrintDlgExW(pDlg);
+ ok((res == E_INVALIDARG), "got 0x%x (expected 'E_INVALIDARG')\n",
res);
+
+ /* Use PD_NOPAGENUMS or set nMaxPageRanges and lpPageRanges */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ ok((res == E_INVALIDARG), "got 0x%x (expected 'E_INVALIDARG')\n",
res);
+
+ /* this is invalid: a valid lpPageRanges with 0 for nMaxPageRanges */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
+ pDlg->lpPageRanges = pagerange;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ ok((res == E_INVALIDARG), "got 0x%x (expected 'E_INVALIDARG')\n",
res);
+
+ /* this is invalid: NULL for lpPageRanges with a valid nMaxPageRanges */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
+ pDlg->nMaxPageRanges = 1;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ ok((res == E_INVALIDARG), "got 0x%x (expected 'E_INVALIDARG')\n",
res);
+
+ /* this works: lpPageRanges with a valid nMaxPageRanges */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING;
+ pDlg->nMaxPageRanges = 1;
+ pDlg->lpPageRanges = pagerange;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ if (res == E_FAIL)
+ {
+ skip("No printer configured.\n");
+ HeapFree(GetProcessHeap(), 0, pDlg);
+ return;
+ }
+
+ ok(res == S_OK, "got 0x%x (expected S_OK)\n", res);
+
+ dn = GlobalLock(pDlg->hDevNames);
+ ok(dn != NULL, "expected '!= NULL' for
GlobalLock(%p)\n",pDlg->hDevNames);
+ if (dn)
+ {
+ ok(dn->wDriverOffset, "(expected '!= 0' for
wDriverOffset)\n");
+ ok(dn->wDeviceOffset, "(expected '!= 0' for
wDeviceOffset)\n");
+ ok(dn->wOutputOffset, "(expected '!= 0' for
wOutputOffset)\n");
+ ok(dn->wDefault == DN_DEFAULTPRN, "got 0x%x (expected
DN_DEFAULTPRN)\n", dn->wDefault);
+
+ GlobalUnlock(pDlg->hDevNames);
+ }
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+
+ /* this works also: PD_NOPAGENUMS */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING | PD_NOPAGENUMS;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ ok(res == S_OK, "got 0x%x (expected S_OK)\n", res);
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+
+ /* this works: PD_RETURNDC with PD_RETURNDEFAULT */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING | PD_NOPAGENUMS | PD_RETURNDC;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ ok(res == S_OK, "got 0x%x (expected S_OK)\n", res);
+ ok(pDlg->hDC != NULL, "HDC missing for PD_RETURNDC\n");
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+ DeleteDC(pDlg->hDC);
+
+ /* this works: PD_RETURNIC with PD_RETURNDEFAULT */
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_RETURNDEFAULT | PD_NOWARNING | PD_NOPAGENUMS | PD_RETURNIC;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ res = pPrintDlgExW(pDlg);
+ ok(res == S_OK, "got 0x%x (expected S_OK)\n", res);
+ ok(pDlg->hDC != NULL, "HDC missing for PD_RETURNIC\n");
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+ DeleteDC(pDlg->hDC);
+
+ /* interactive PrintDlgEx tests */
+
+ if (!winetest_interactive)
+ {
+ skip("interactive PrintDlgEx tests (set WINETEST_INTERACTIVE=1)\n");
+ return;
+ }
+
+ ZeroMemory(pDlg, sizeof(PRINTDLGEXW));
+ pDlg->lStructSize = sizeof(PRINTDLGEXW);
+ pDlg->hwndOwner = GetDesktopWindow();
+ pDlg->Flags = PD_NOPAGENUMS | PD_RETURNIC;
+ pDlg->nStartPage = START_PAGE_GENERAL;
+ pDlg->lpCallback = &unknown;
+ pDlg->dwResultAction = S_OK;
+ res = pPrintDlgExW(pDlg);
+ ok(res == S_OK, "got 0x%x (expected S_OK)\n", res);
+ ok(pDlg->dwResultAction == PD_RESULT_PRINT, "expected PD_RESULT_PRINT, got
%#x\n", pDlg->dwResultAction);
+ ok(pDlg->hDC != NULL, "HDC missing for PD_RETURNIC\n");
+ GlobalFree(pDlg->hDevMode);
+ GlobalFree(pDlg->hDevNames);
+ DeleteDC(pDlg->hDC);
HeapFree(GetProcessHeap(), 0, pDlg);
- return;
-
}
static BOOL abort_proc_called = FALSE;
@@ -376,19 +646,11 @@
START_TEST(printdlg)
{
- LPCSTR ptr;
-
- ptr = load_functions();
+ hcomdlg32 = GetModuleHandleA("comdlg32.dll");
+ pPrintDlgExW = (void *) GetProcAddress(hcomdlg32, "PrintDlgExW");
test_PageSetupDlgA();
test_PrintDlgA();
+ test_PrintDlgExW();
test_abort_proc();
-
- /* PrintDlgEx not present before w2k */
- if (ptr) {
- win_skip("%s\n", ptr);
- return;
- }
-
- test_PrintDlgExW();
-}
+}
Modified: trunk/rostests/winetests/comdlg32/rsrc.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/rsrc.r…
==============================================================================
--- trunk/rostests/winetests/comdlg32/rsrc.rc [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/rsrc.rc [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -17,10 +17,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "windef.h"
-#include "winuser.h"
+#include <windef.h>
+#include <winuser.h>
-TEMPLATE1 DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
+TEMPLATE1 DIALOG 5, 43, 227, 215
STYLE WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
FONT 8, "MS Shell Dlg"
{
@@ -38,7 +38,7 @@
* resizing on small desk tops.
* This will work with 640x480 pixels
*/
-TEMPLATE_SZ DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 300, 40
+TEMPLATE_SZ DIALOG 5, 43, 300, 40
STYLE WS_CHILD | WS_CLIPSIBLINGS
FONT 8, "MS Shell Dlg"
{
@@ -50,7 +50,7 @@
}
/* note: the test program will modify coordinates and nr of controls in this template */
-TEMPLATE_STC32 DIALOG LOADONCALL MOVEABLE DISCARDABLE 11111, 0, 316, 76
+TEMPLATE_STC32 DIALOG 11111, 0, 316, 76
STYLE WS_CHILD | WS_CLIPSIBLINGS
FONT 8, "MS Shell Dlg"
{
Modified: trunk/rostests/winetests/comdlg32/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/comdlg32/testli…
==============================================================================
--- trunk/rostests/winetests/comdlg32/testlist.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/comdlg32/testlist.c [iso-8859-1] Sat Oct 5 20:44:20 2013
@@ -1,10 +1,7 @@
/* Automatically generated file; DO NOT EDIT!! */
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-
#define STANDALONE
-#include "wine/test.h"
+#include <wine/test.h>
extern void func_filedlg(void);
extern void func_finddlg(void);