The start of a GUI to make running the Wine API tests a pleasure rather than a pain.

This will plug into the new testing framework for the Wine tests, which will also publish it's results on a live website (if I can get Colin to help me with the web stuff ;) )
This is the time to pester me with requests / ideas anyone may have.

svn path=/trunk/; revision=34016
This commit is contained in:
Ged Murphy 2008-06-18 19:10:39 +00:00
parent d73e9e4231
commit cda095c0fe
9 changed files with 773 additions and 0 deletions

View file

@ -0,0 +1,11 @@
#include <windows.h>
#include <commctrl.h>
#include "resource.h"
#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Character Map\0"
#define REACTOS_STR_INTERNAL_NAME "charmap\0"
#define REACTOS_STR_ORIGINAL_FILENAME "charmap.exe\0"
//#include <reactos/version.rc>
#include "rsrc.rc"

View file

@ -0,0 +1,224 @@
/*
* PROJECT: ReactOS Character Map
* LICENSE: GPL - See COPYING in the top level directory
* FILE:
* PURPOSE: browse dialog implementation
* COPYRIGHT: Copyright 2008 Ged Murphy <gedmurphy@reactos.org>
*
*/
#include <precomp.h>
#define DLL_SEARCH_DIR L"\\Debug\\testlibs\\*"
static INT
GetNumberOfDllsInFolder(LPWSTR lpFolder)
{
HANDLE hFind;
WIN32_FIND_DATAW findFileData;
INT numFiles = 0;
hFind = FindFirstFileW(lpFolder,
&findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
DisplayError(GetLastError());
return 0;
}
do
{
if (!(findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
numFiles++;
}
} while (FindNextFile(hFind, &findFileData) != 0);
return numFiles;
}
static INT
GetListOfTestDlls(PMAIN_WND_INFO pInfo)
{
HANDLE hFind;
WIN32_FIND_DATAW findFileData;
WCHAR szDllPath[MAX_PATH];
LPWSTR ptr;
INT numFiles = 0;
INT len;
len = GetCurrentDirectory(MAX_PATH, szDllPath);
if (!len) return 0;
wcsncat(szDllPath, DLL_SEARCH_DIR, MAX_PATH - (len + 1));
numFiles = GetNumberOfDllsInFolder(szDllPath);
if (!numFiles) return 0;
pInfo->lpDllList = HeapAlloc(GetProcessHeap(), 0, numFiles * (MAX_PATH * sizeof(WCHAR)));
if (!pInfo->lpDllList)
return 0;
hFind = FindFirstFileW(szDllPath,
&findFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
DisplayError(GetLastError());
HeapFree(GetProcessHeap(), 0, pInfo->lpDllList);
return 0;
}
/* remove the glob */
ptr = wcschr(szDllPath, L'*');
if (ptr)
*ptr = L'\0';
/* don't mod our base pointer */
ptr = pInfo->lpDllList;
do
{
if (!(findFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
//MessageBoxW(NULL, findFileData.cFileName, NULL, 0);
/* set the path */
wcscpy(ptr, szDllPath);
/* tag the file onto the path */
len = MAX_PATH - (wcslen(ptr) + 1);
wcsncat(ptr, findFileData.cFileName, len);
/* move the pointer along by MAX_PATH */
ptr += MAX_PATH;
}
} while (FindNextFile(hFind, &findFileData) != 0);
return numFiles;
}
static HTREEITEM
InsertIntoTreeView(HWND hTreeView,
HTREEITEM hRoot,
LPWSTR lpLabel,
LPWSTR lpDllPath,
INT Image)
{
TV_ITEM tvi;
TV_INSERTSTRUCT tvins;
ZeroMemory(&tvi, sizeof(tvi));
ZeroMemory(&tvins, sizeof(tvins));
tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.pszText = lpLabel;
tvi.cchTextMax = lstrlen(lpLabel);
tvi.lParam = (LPARAM)lpDllPath;
tvi.iImage = Image;
tvi.iSelectedImage = Image;
//tvi.stateMask = TVIS_OVERLAYMASK;
tvins.item = tvi;
tvins.hParent = hRoot;
return TreeView_InsertItem(hTreeView, &tvins);
}
static VOID
PopulateTreeView(PMAIN_WND_INFO pInfo)
{
HWND hTreeView;
HTREEITEM hRoot;
HBITMAP hComp;
TCHAR ComputerName[MAX_PATH];
DWORD dwSize = MAX_PATH;
INT RootImage;
hTreeView = GetDlgItem(pInfo->hBrowseDlg, IDC_TREEVIEW);
(void)TreeView_DeleteAllItems(hTreeView);
/* insert the root item into the tree */
hRoot = InsertIntoTreeView(hTreeView,
NULL,
ComputerName,
NULL,
0);//RootImage);
}
static VOID
PopulateTestList(PMAIN_WND_INFO pInfo)
{
INT numFiles;
if ((numFiles = GetListOfTestDlls(pInfo)))
{
PopulateTreeView(pInfo);
}
}
static BOOL
OnInitBrowseDialog(HWND hDlg,
LPARAM lParam)
{
PMAIN_WND_INFO pInfo;
pInfo = (PMAIN_WND_INFO)lParam;
pInfo->hBrowseDlg = hDlg;
SetWindowLongPtr(hDlg,
GWLP_USERDATA,
(LONG_PTR)pInfo);
PopulateTestList(pInfo);
return TRUE;
}
BOOL CALLBACK
BrowseDlgProc(HWND hDlg,
UINT Message,
WPARAM wParam,
LPARAM lParam)
{
PMAIN_WND_INFO pInfo;
/* Get the window context */
pInfo = (PMAIN_WND_INFO)GetWindowLongPtr(hDlg,
GWLP_USERDATA);
if (pInfo == NULL && Message != WM_INITDIALOG)
{
goto HandleDefaultMessage;
}
switch(Message)
{
case WM_INITDIALOG:
return OnInitBrowseDialog(hDlg, lParam);
case WM_COMMAND:
{
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
{
HeapFree(GetProcessHeap(), 0, pInfo->lpDllList);
pInfo->lpDllList = NULL;
EndDialog(hDlg,
LOWORD(wParam));
return TRUE;
}
break;
}
HandleDefaultMessage:
default:
return FALSE;
}
return FALSE;
}

View file

@ -0,0 +1,35 @@
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
IDD_WINETESTGUI DIALOGEX 0, 0, 293, 262
STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
CAPTION "Winetest GUI"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
DEFPUSHBUTTON "OK",IDOK,236,241,50,14,WS_GROUP
CONTROL "",IDC_LIST,"SysListView32",LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,69,279,103
EDITTEXT IDC_OUTPUT,7,175,279,62,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY
COMBOBOX IDC_TESTSELECTION,27,12,205,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "Test:",IDC_STATIC,6,14,18,8
PUSHBUTTON "Browse...",IDC_BROWSE,236,11,50,14
PUSHBUTTON "Run",IDC_RUN,236,30,50,14
CONTROL "",IDC_PROGRESS,"msctls_progress32",PBS_SMOOTH | WS_BORDER,28,30,204,14
LTEXT "Runs:",IDC_STATIC,8,53,20,8
LTEXT "?",IDC_NUMRUNS,33,53,8,8
LTEXT "Errors:",IDC_STATIC,55,53,23,8
LTEXT "?",IDC_NUMERRORS,85,53,8,8
LTEXT "Failures:",IDC_STATIC,107,53,28,8
LTEXT "?",IDC_NUMFAILURES,141,53,8,8
PUSHBUTTON "Stop",IDC_STOP,236,49,50,14
CONTROL "Run on start",IDC_RUNONSTART,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,52,56,10
LTEXT "status bar",IDC_STATUS,7,244,210,8
END
IDD_TESTBROWSER DIALOGEX 0, 0, 259, 250
STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME
CAPTION "Test hierarchy"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
PUSHBUTTON "Select", IDC_SELECT, 202, 7, 50, 14
CONTROL "", IDC_TREEVIEW, "SysTreeView32", WS_BORDER | TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT, 7, 7, 189, 236
PUSHBUTTON "Close", IDOK, 202, 34, 50, 14
END

View file

@ -0,0 +1,155 @@
/*
* PROJECT: ReactOS Character Map
* LICENSE: GPL - See COPYING in the top level directory
* FILE:
* PURPOSE: main dialog implementation
* COPYRIGHT: Copyright 2008 Ged Murphy <gedmurphy@reactos.org>
*
*/
#include <precomp.h>
HINSTANCE hInstance;
static BOOL
OnInitMainDialog(HWND hDlg,
LPARAM lParam)
{
PMAIN_WND_INFO pInfo;
//HMENU hSysMenu;
LPWSTR lpAboutText;
pInfo = (PMAIN_WND_INFO)lParam;
/* Initialize the main window context */
pInfo->hMainWnd = hDlg;
SetWindowLongPtr(hDlg,
GWLP_USERDATA,
(LONG_PTR)pInfo);
pInfo->hSmIcon = LoadImageW(hInstance,
MAKEINTRESOURCEW(IDI_ICON),
IMAGE_ICON,
16,
16,
0);
if (pInfo->hSmIcon)
{
SendMessageW(hDlg,
WM_SETICON,
ICON_SMALL,
(LPARAM)pInfo->hSmIcon);
}
pInfo->hBgIcon = LoadImageW(hInstance,
MAKEINTRESOURCEW(IDI_ICON),
IMAGE_ICON,
32,
32,
0);
if (pInfo->hBgIcon)
{
SendMessageW(hDlg,
WM_SETICON,
ICON_BIG,
(LPARAM)pInfo->hBgIcon);
}
return TRUE;
}
static BOOL CALLBACK
MainDlgProc(HWND hDlg,
UINT Message,
WPARAM wParam,
LPARAM lParam)
{
PMAIN_WND_INFO pInfo;
/* Get the window context */
pInfo = (PMAIN_WND_INFO)GetWindowLongPtr(hDlg,
GWLP_USERDATA);
if (pInfo == NULL && Message != WM_INITDIALOG)
{
goto HandleDefaultMessage;
}
switch(Message)
{
case WM_INITDIALOG:
return OnInitMainDialog(hDlg, lParam);
case WM_COMMAND:
{
switch(LOWORD(wParam))
{
case IDC_BROWSE:
DialogBoxParamW(hInstance,
MAKEINTRESOURCEW(IDD_TESTBROWSER),
hDlg,
(DLGPROC)BrowseDlgProc,
(LPARAM)pInfo);
break;
case IDOK:
EndDialog(hDlg, 0);
break;
}
}
break;
case WM_CLOSE:
if (pInfo->hSmIcon)
DestroyIcon(pInfo->hSmIcon);
if (pInfo->hBgIcon)
DestroyIcon(pInfo->hBgIcon);
EndDialog(hDlg, 0);
break;
HandleDefaultMessage:
default:
return FALSE;
}
return FALSE;
}
INT WINAPI
wWinMain(HINSTANCE hInst,
HINSTANCE hPrev,
LPWSTR Cmd,
int iCmd)
{
INITCOMMONCONTROLSEX iccx;
PMAIN_WND_INFO pInfo;
INT Ret = 1;
hInstance = hInst;
ZeroMemory(&iccx, sizeof(INITCOMMONCONTROLSEX));
iccx.dwSize = sizeof(INITCOMMONCONTROLSEX);
iccx.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&iccx);
pInfo = HeapAlloc(GetProcessHeap(), 0, sizeof(MAIN_WND_INFO));
if (pInfo)
{
Ret = (DialogBoxParamW(hInstance,
MAKEINTRESOURCEW(IDD_WINETESTGUI),
NULL,
(DLGPROC)MainDlgProc,
(LPARAM)pInfo) == IDOK);
HeapFree(GetProcessHeap(), 0, pInfo);
}
return Ret;
}

View file

@ -0,0 +1,260 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE:
* PURPOSE: miscallanous functions
* COPYRIGHT: Copyright 2005 Thomas Weidenmueller <w3seek@reactos.org>
* Copyright 2006 - 2008 Ged Murphy <gedmurphy@gmail.com>
*
*/
#include <precomp.h>
static INT
LengthOfStrResource(IN HINSTANCE hInst,
IN UINT uID)
{
HRSRC hrSrc;
HGLOBAL hRes;
LPWSTR lpName, lpStr;
if (hInst == NULL)
{
return -1;
}
/* There are always blocks of 16 strings */
lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
/* Find the string table block */
if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
(hRes = LoadResource(hInst, hrSrc)) &&
(lpStr = (WCHAR*) LockResource(hRes)))
{
UINT x;
/* Find the string we're looking for */
uID &= 0xF; /* position in the block, same as % 16 */
for (x = 0; x < uID; x++)
{
lpStr += (*lpStr) + 1;
}
/* Found the string */
return (int)(*lpStr);
}
return -1;
}
INT
AllocAndLoadString(OUT LPWSTR *lpTarget,
IN HINSTANCE hInst,
IN UINT uID)
{
INT ln;
ln = LengthOfStrResource(hInst,
uID);
if (ln++ > 0)
{
(*lpTarget) = (LPTSTR)LocalAlloc(LMEM_FIXED,
ln * sizeof(TCHAR));
if ((*lpTarget) != NULL)
{
INT Ret;
if (!(Ret = LoadStringW(hInst, uID, *lpTarget, ln)))
{
LocalFree((HLOCAL)(*lpTarget));
}
return Ret;
}
}
return 0;
}
DWORD
LoadAndFormatString(IN HINSTANCE hInstance,
IN UINT uID,
OUT LPWSTR *lpTarget,
...)
{
DWORD Ret = 0;
LPTSTR lpFormat;
va_list lArgs;
if (AllocAndLoadString(&lpFormat,
hInstance,
uID) > 0)
{
va_start(lArgs, lpTarget);
/* let's use Format to format it because it has the ability to allocate
memory automatically */
Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
lpFormat,
0,
0,
(LPTSTR)lpTarget,
0,
&lArgs);
va_end(lArgs);
LocalFree((HLOCAL)lpFormat);
}
return Ret;
}
BOOL
StatusBarLoadAndFormatString(IN HWND hStatusBar,
IN INT PartId,
IN HINSTANCE hInstance,
IN UINT uID,
...)
{
BOOL Ret = FALSE;
LPWSTR lpFormat, lpStr;
va_list lArgs;
if (AllocAndLoadString(&lpFormat,
hInstance,
uID) > 0)
{
va_start(lArgs, uID);
/* let's use FormatMessage to format it because it has the ability to allocate
memory automatically */
Ret = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING,
lpFormat,
0,
0,
(VOID*)&lpStr,
0,
&lArgs);
va_end(lArgs);
if (lpStr != NULL)
{
Ret = (BOOL)SendMessageW(hStatusBar,
SB_SETTEXT,
(WPARAM)PartId,
(LPARAM)lpStr);
LocalFree((HLOCAL)lpStr);
}
LocalFree((HLOCAL)lpFormat);
}
return Ret;
}
BOOL
StatusBarLoadString(IN HWND hStatusBar,
IN INT PartId,
IN HINSTANCE hInstance,
IN UINT uID)
{
BOOL Ret = FALSE;
LPWSTR lpStr;
if (AllocAndLoadString(&lpStr,
hInstance,
uID) > 0)
{
Ret = (BOOL)SendMessageW(hStatusBar,
SB_SETTEXT,
(WPARAM)PartId,
(LPARAM)lpStr);
LocalFree((HLOCAL)lpStr);
}
return Ret;
}
INT
GetTextFromEdit(OUT LPWSTR lpString,
IN HWND hDlg,
IN UINT Res)
{
INT len = GetWindowTextLengthW(GetDlgItem(hDlg, Res));
if(len > 0)
{
GetDlgItemTextW(hDlg,
Res,
lpString,
len + 1);
}
else
lpString = NULL;
return len;
}
VOID DisplayError(INT err)
{
LPWSTR lpMsgBuf = NULL;
FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
err,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(VOID*)&lpMsgBuf,
0,
NULL );
MessageBoxW(NULL, lpMsgBuf, L"Error!", MB_OK | MB_ICONERROR);
LocalFree(lpMsgBuf);
}
VOID DisplayString(LPWSTR lpMsg)
{
MessageBoxW(NULL, lpMsg, L"Note!", MB_ICONEXCLAMATION|MB_OK);
}
HIMAGELIST
InitImageList(UINT StartResource,
UINT EndResource,
UINT Width,
UINT Height)
{
HBITMAP hBitmap;
HIMAGELIST hImageList;
UINT i;
INT Ret;
/* Create the toolbar icon image list */
hImageList = ImageList_Create(Width,
Height,
ILC_MASK | ILC_COLOR24,
EndResource - StartResource,
0);
if (hImageList == NULL)
return NULL;
/* Add all icons to the image list */
for (i = StartResource; i <= EndResource; i++)
{
hBitmap = (HBITMAP)LoadImage(hInstance,
MAKEINTRESOURCE(i),
IMAGE_BITMAP,
Width,
Height,
LR_LOADTRANSPARENT);
if (hBitmap == NULL)
return NULL;
Ret = ImageList_AddMasked(hImageList,
hBitmap,
RGB(255, 0, 128));
if (Ret == -1)
return NULL;
DeleteObject(hBitmap);
}
return hImageList;
}

View file

@ -0,0 +1,39 @@
#ifndef __WINETESTGUI_PRECOMP_H
#define __WINETESTGUI_PRECOMP_H
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <commctrl.h>
#include "resource.h"
extern HINSTANCE hInstance;
typedef struct _MAIN_WND_INFO
{
HWND hMainWnd;
HWND hBrowseDlg;
HWND hStatus;
int nCmdShow;
HICON hSmIcon;
HICON hBgIcon;
INT SelectedItem;/* selection number in the list view */
BOOL bDlgOpen;
BOOL bInMenuLoop;
BOOL bIsUserAnAdmin;
LPWSTR lpDllList;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
/* browsewnd.c */
BOOL CALLBACK BrowseDlgProc(HWND hDlg, UINT Message, WPARAM wParam, LPARAM lParam);
/* misc.c */
VOID DisplayString(LPWSTR lpMsg);
VOID DisplayError(INT err);
#endif /* __WINETESTGUI_PRECOMP_H */

0
rostests/winetests/GUI/res/.gitignore vendored Normal file
View file

View file

@ -0,0 +1,24 @@
#define IDD_WINETESTGUI 102
#define IDD_TESTBROWSER 103
#define IDM_ABOUT 104
#define IDM_EXIT 105
#define IDI_ICON 107
#define IDI_SMALL 108
#define IDC_DELETE 109
#define IDR_MAINFRAME 128
#define IDC_LIST 1000
#define IDC_OUTPUT 1001
#define IDC_TESTSELECTION 1002
#define IDC_BROWSE 1003
#define IDC_RUN 1004
#define IDC_PROGRESS 1005
#define IDC_NUMRUNS 1006
#define IDC_NUMERRORS 1007
#define IDC_NUMFAILURES 1008
#define IDC_STOP 1010
#define IDC_CHECK2 1011
#define IDC_RUNONSTART 1011
#define IDC_STATUS 1012
#define IDC_SELECT 1020
#define IDC_TREEVIEW 1021
#define IDC_STATIC -1

View file

@ -0,0 +1,25 @@
#include <windows.h>
#include "resource.h"
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
IDI_ICON ICON "res/charmap.ico"
//#include "lang/bg-BG.rc"
//#include "lang/ca-ES.rc"
//#include "lang/cs-CZ.rc"
#include "lang/en-US.rc"
//#include "lang/de-DE.rc"
//#include "lang/es-ES.rc"
//#include "lang/fr-FR.rc"
//#include "lang/id-ID.rc"
//#include "lang/it-IT.rc"
//#include "lang/ko-KO.rc"
//#include "lang/lt-LT.rc"
//#include "lang/nl-NL.rc"
//#include "lang/pl-PL.rc"
//#include "lang/pt-BR.rc"
//#include "lang/sk-SK.rc"
//#include "lang/uk-UA.rc"
//#include "lang/ru-RU.rc"
//#include "lang/el-GR.rc"