mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 09:50:07 +00:00
sync comdlg32 winetest to wine 1.1.11
svn path=/trunk/; revision=38411
This commit is contained in:
parent
2057ac87a7
commit
bcf598695c
|
@ -7,9 +7,11 @@
|
|||
<file>filedlg.c</file>
|
||||
<file>printdlg.c</file>
|
||||
<file>testlist.c</file>
|
||||
<file>rsrc.rc</file>
|
||||
<library>wine</library>
|
||||
<library>comdlg32</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>kernel32</library>
|
||||
<library>ntdll</library>
|
||||
</module>
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include <windows.h>
|
||||
#include <wine/test.h>
|
||||
|
||||
#include "initguid.h"
|
||||
#include "shlguid.h"
|
||||
#define COBJMACROS
|
||||
#include "shobjidl.h"
|
||||
|
||||
/* ##### */
|
||||
|
||||
|
@ -131,9 +135,144 @@ static void test_DialogCancel(void)
|
|||
}
|
||||
}
|
||||
|
||||
static UINT CALLBACK create_view_window2_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (msg == WM_NOTIFY)
|
||||
{
|
||||
if (((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE)
|
||||
{
|
||||
IShellBrowser *shell_browser = (IShellBrowser *)SendMessage(GetParent(dlg), WM_USER + 7 /* WM_GETISHELLBROWSER */, 0, 0);
|
||||
IShellView *shell_view = NULL;
|
||||
IShellView2 *shell_view2 = NULL;
|
||||
SV2CVW2_PARAMS view_params;
|
||||
FOLDERSETTINGS folder_settings;
|
||||
HRESULT hr;
|
||||
RECT rect = {0, 0, 0, 0};
|
||||
|
||||
hr = IShellBrowser_QueryActiveShellView(shell_browser, &shell_view);
|
||||
ok(SUCCEEDED(hr), "QueryActiveShellView returned %#x\n", hr);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
hr = IShellView_QueryInterface(shell_view, &IID_IShellView2, (void **)&shell_view2);
|
||||
if (hr == E_NOINTERFACE)
|
||||
{
|
||||
skip("IShellView2 not supported\n");
|
||||
goto cleanup;
|
||||
}
|
||||
ok(SUCCEEDED(hr), "QueryInterface returned %#x\n", hr);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
hr = IShellView2_DestroyViewWindow(shell_view2);
|
||||
ok(SUCCEEDED(hr), "DestroyViewWindow returned %#x\n", hr);
|
||||
|
||||
folder_settings.ViewMode = FVM_LIST;
|
||||
folder_settings.fFlags = 0;
|
||||
|
||||
view_params.cbSize = sizeof(view_params);
|
||||
view_params.psvPrev = NULL;
|
||||
view_params.pfs = &folder_settings;
|
||||
view_params.psbOwner = shell_browser;
|
||||
view_params.prcView = ▭
|
||||
view_params.pvid = NULL;
|
||||
view_params.hwndView = NULL;
|
||||
|
||||
hr = IShellView2_CreateViewWindow2(shell_view2, &view_params);
|
||||
ok(SUCCEEDED(hr), "CreateViewWindow2 returned %#x\n", hr);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
hr = IShellView2_GetCurrentInfo(shell_view2, &folder_settings);
|
||||
ok(SUCCEEDED(hr), "GetCurrentInfo returned %#x\n", hr);
|
||||
ok(folder_settings.ViewMode == FVM_LIST, "view mode is %d, expected %d\n", folder_settings.ViewMode, FVM_LIST);
|
||||
|
||||
hr = IShellView2_DestroyViewWindow(shell_view2);
|
||||
ok(SUCCEEDED(hr), "DestroyViewWindow returned %#x\n", hr);
|
||||
|
||||
/* XP and W2K3 need this. On Win9x and W2K the call to DestroyWindow() fails and has
|
||||
* no side effects. NT4 doesn't get here. (FIXME: Vista doesn't get here yet).
|
||||
*/
|
||||
DestroyWindow(view_params.hwndView);
|
||||
|
||||
view_params.pvid = &VID_Details;
|
||||
hr = IShellView2_CreateViewWindow2(shell_view2, &view_params);
|
||||
ok(SUCCEEDED(hr), "CreateViewWindow2 returned %#x\n", hr);
|
||||
if (FAILED(hr)) goto cleanup;
|
||||
|
||||
hr = IShellView2_GetCurrentInfo(shell_view2, &folder_settings);
|
||||
ok(SUCCEEDED(hr), "GetCurrentInfo returned %#x\n", hr);
|
||||
ok(folder_settings.ViewMode == FVM_DETAILS ||
|
||||
broken(folder_settings.ViewMode == FVM_LIST), /* Win9x */
|
||||
"view mode is %d, expected %d\n", folder_settings.ViewMode, FVM_DETAILS);
|
||||
|
||||
cleanup:
|
||||
if (shell_view2) IShellView2_Release(shell_view2);
|
||||
if (shell_view) IShellView_Release(shell_view);
|
||||
PostMessage(GetParent(dlg), WM_COMMAND, IDCANCEL, 0);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static LONG_PTR WINAPI template_hook(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (msg == WM_INITDIALOG)
|
||||
{
|
||||
HWND p,cb;
|
||||
INT sel;
|
||||
p = GetParent(dlg);
|
||||
ok(p!=NULL, "Failed to get parent of template\n");
|
||||
cb = GetDlgItem(p,0x470);
|
||||
ok(cb!=NULL, "Failed to get filter combobox\n");
|
||||
sel = SendMessage(cb, CB_GETCURSEL, 0, 0);
|
||||
ok (sel != -1, "Failed to get selection from filter listbox\n");
|
||||
}
|
||||
if (msg == WM_NOTIFY)
|
||||
{
|
||||
if (((LPNMHDR)lParam)->code == CDN_FOLDERCHANGE)
|
||||
PostMessage(GetParent(dlg), WM_COMMAND, IDCANCEL, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_create_view_window2(void)
|
||||
{
|
||||
OPENFILENAMEA ofn = {0};
|
||||
char filename[1024] = {0};
|
||||
DWORD ret;
|
||||
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = 1042;
|
||||
ofn.lpfnHook = create_view_window2_hook;
|
||||
ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER;
|
||||
ret = GetOpenFileNameA(&ofn);
|
||||
ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
|
||||
ret = CommDlgExtendedError();
|
||||
ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
|
||||
}
|
||||
|
||||
static void test_create_view_template(void)
|
||||
{
|
||||
OPENFILENAMEA ofn = {0};
|
||||
char filename[1024] = {0};
|
||||
DWORD ret;
|
||||
|
||||
ofn.lStructSize = sizeof(ofn);
|
||||
ofn.lpstrFile = filename;
|
||||
ofn.nMaxFile = 1042;
|
||||
ofn.lpfnHook = (LPOFNHOOKPROC)template_hook;
|
||||
ofn.Flags = OFN_ENABLEHOOK | OFN_EXPLORER| OFN_ENABLETEMPLATE;
|
||||
ofn.hInstance = GetModuleHandleA(NULL);
|
||||
ofn.lpTemplateName = "template1";
|
||||
ofn.lpstrFilter="text\0*.txt\0All\0*\0\0";
|
||||
ret = GetOpenFileNameA(&ofn);
|
||||
ok(!ret, "GetOpenFileNameA returned %#x\n", ret);
|
||||
ret = CommDlgExtendedError();
|
||||
ok(!ret, "CommDlgExtendedError returned %#x\n", ret);
|
||||
}
|
||||
|
||||
START_TEST(filedlg)
|
||||
{
|
||||
test_DialogCancel();
|
||||
|
||||
test_create_view_window2();
|
||||
test_create_view_template();
|
||||
}
|
||||
|
|
|
@ -289,6 +289,77 @@ static void test_PrintDlgExW(void)
|
|||
|
||||
}
|
||||
|
||||
static BOOL abort_proc_called = FALSE;
|
||||
static BOOL CALLBACK abort_proc(HDC hdc, int error) { return abort_proc_called = TRUE; }
|
||||
static void test_abort_proc(void)
|
||||
{
|
||||
HDC print_dc;
|
||||
RECT rect = {0, 0, 100, 100};
|
||||
DOCINFOA doc_info = {0};
|
||||
PRINTDLGA pd = {0};
|
||||
char filename[MAX_PATH];
|
||||
|
||||
if (!GetTempFileNameA(".", "prn", 0, filename))
|
||||
{
|
||||
skip("Failed to create a temporary file name\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pd.lStructSize = sizeof(pd);
|
||||
pd.Flags = PD_RETURNDEFAULT | PD_ALLPAGES | PD_RETURNDC | PD_PRINTTOFILE;
|
||||
pd.nFromPage = 1;
|
||||
pd.nToPage = 1;
|
||||
pd.nCopies = 1;
|
||||
|
||||
if (!PrintDlgA(&pd))
|
||||
{
|
||||
skip("No default printer available.\n");
|
||||
ok(DeleteFileA(filename), "Failed to delete temporary file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ok(pd.hDC != NULL, "PrintDlg didn't return a DC.\n");
|
||||
if (!(print_dc = pd.hDC))
|
||||
{
|
||||
ok(DeleteFileA(filename), "Failed to delete temporary file\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ok(SetAbortProc(print_dc, abort_proc) > 0, "SetAbortProc failed\n");
|
||||
ok(!abort_proc_called, "AbortProc got called unexpectedly by SetAbortProc.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
doc_info.cbSize = sizeof(doc_info);
|
||||
doc_info.lpszDocName = "Some document";
|
||||
doc_info.lpszOutput = filename;
|
||||
|
||||
ok(StartDocA(print_dc, &doc_info) > 0, "StartDocA failed\n");
|
||||
ok(abort_proc_called, "AbortProc didn't get called by StartDoc.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
ok(StartPage(print_dc) > 0, "StartPage failed\n");
|
||||
ok(!abort_proc_called, "AbortProc got called unexpectedly by StartPage.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
ok(FillRect(print_dc, &rect, (HBRUSH)(COLOR_BACKGROUND + 1)), "FillRect failed\n");
|
||||
ok(!abort_proc_called, "AbortProc got called unexpectedly by StretchBlt.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
ok(EndPage(print_dc) > 0, "EndPage failed\n");
|
||||
ok(!abort_proc_called, "AbortProc got called unexpectedly by EndPage.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
ok(EndDoc(print_dc) > 0, "EndDoc failed\n");
|
||||
ok(!abort_proc_called, "AbortProc got called unexpectedly by EndDoc.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
ok(DeleteDC(print_dc), "DeleteDC failed\n");
|
||||
ok(!abort_proc_called, "AbortProc got called unexpectedly by DeleteDC.\n");
|
||||
abort_proc_called = FALSE;
|
||||
|
||||
ok(DeleteFileA(filename), "Failed to delete temporary file\n");
|
||||
}
|
||||
|
||||
/* ########################### */
|
||||
|
||||
START_TEST(printdlg)
|
||||
|
@ -299,6 +370,7 @@ START_TEST(printdlg)
|
|||
|
||||
test_PageSetupDlgA();
|
||||
test_PrintDlgA();
|
||||
test_abort_proc();
|
||||
|
||||
/* PrintDlgEx not present before w2k */
|
||||
if (ptr) {
|
||||
|
|
34
rostests/winetests/comdlg32/rsrc.rc
Normal file
34
rostests/winetests/comdlg32/rsrc.rc
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* Resources for the common dialog unit test suite.
|
||||
*
|
||||
* Copyright 2008 CodeWeavers, Aric Stewart
|
||||
*
|
||||
* 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 "windef.h"
|
||||
#include "winuser.h"
|
||||
|
||||
TEMPLATE1 DIALOG LOADONCALL MOVEABLE DISCARDABLE 5, 43, 227, 215
|
||||
STYLE WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
|
||||
FONT 8, "MS Shell Dlg"
|
||||
{
|
||||
LTEXT "Path:",-1,28,4,36,8
|
||||
LTEXT "Text1",-1,4,16,20,40
|
||||
LTEXT "Selected:",-1,32,49,40,8
|
||||
EDITTEXT 55,74,47,200,12,ES_AUTOHSCROLL
|
||||
LTEXT "Text2",-1,232,20,65,8
|
||||
LTEXT "",-1,28,16,204,31
|
||||
EDITTEXT 56,65,2,200,12,ES_AUTOHSCROLL
|
||||
}
|
Loading…
Reference in a new issue