winetest: ask for a tag
Ferenc Wagner
wferi at tba.elte.hu
Wed Mar 30 04:54:07 CST 2005
ChangeLog: Ask for a tag if one was not given on the command line.
This patch depends on sizeof(int)==sizeof(char*) for
returning the buffer address from the dialog. If it should
be done differently, please tell me how.
Feri.
Index: programs/winetest/gui.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/gui.c,v
retrieving revision 1.6
diff -u -r1.6 gui.c
--- programs/winetest/gui.c 15 Jun 2004 22:45:15 -0000 1.6
+++ programs/winetest/gui.c 30 Mar 2005 10:45:59 -0000
@@ -176,6 +176,29 @@
return 0;
}
+/* report (R_TAG, fmt, ...) */
+int
+textTag (va_list ap)
+{
+ char *str = vstrmake (NULL, ap);
+
+ fputs ("Tag: ", stderr);
+ fputs (str, stderr);
+ fputc ('\n', stderr);
+ free (str);
+ return 0;
+}
+
+int
+guiTag (va_list ap)
+{
+ char *str = vstrmake (NULL, ap);
+
+ SetDlgItemText (dialog, IDC_TAG, str);
+ free (str);
+ return 0;
+}
+
/* report (R_DIR, fmt, ...) */
int
textDir (va_list ap)
@@ -301,6 +324,40 @@
return ret;
}
+BOOL CALLBACK
+AskTagProc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ char *tag;
+ int len;
+
+ switch (msg) {
+ case WM_COMMAND:
+ switch (LOWORD (wParam)) {
+ case IDOK:
+ len = GetWindowTextLengthA (GetDlgItem (hwnd, IDC_TAG));
+ if (len <= 20) { /* keep it consistent with IDD_TAG */
+ tag = xmalloc (len+1);
+ GetDlgItemTextA (hwnd, IDC_TAG, tag, len+1);
+ if (!badtagchar (tag)) EndDialog (hwnd, (int)tag);
+ else free (tag);
+ }
+ return TRUE;
+ case IDABORT:
+ EndDialog (hwnd, 0);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+char *
+guiAskTag (void)
+{
+ return (char *)DialogBox (GetModuleHandle (NULL),
+ MAKEINTRESOURCE (IDD_TAG),
+ dialog, AskTagProc);
+}
+
/* Quiet functions */
int
qNoOp (va_list ap)
@@ -403,15 +460,15 @@
int ret = 0;
static r_fun_t * const text_funcs[] =
{textStatus, textProgress, textStep, textDelta,
- textDir, textOut,
+ textTag, textDir, textOut,
textWarning, textError, textFatal, textAsk};
static r_fun_t * const GUI_funcs[] =
{guiStatus, guiProgress, guiStep, guiDelta,
- guiDir, guiOut,
+ guiTag, guiDir, guiOut,
guiWarning, guiError, guiFatal, guiAsk};
static r_fun_t * const quiet_funcs[] =
{qNoOp, qNoOp, qNoOp, qNoOp,
- qNoOp, qNoOp,
+ qNoOp, qNoOp, qNoOp,
qNoOp, qNoOp, qFatal, qAsk};
static r_fun_t * const * funcs = NULL;
Index: programs/winetest/main.c
===================================================================
RCS file: /home/wine/wine/programs/winetest/main.c,v
retrieving revision 1.32
diff -u -r1.32 main.c
--- programs/winetest/main.c 29 Mar 2005 19:51:49 -0000 1.32
+++ programs/winetest/main.c 30 Mar 2005 10:45:59 -0000
@@ -480,7 +480,7 @@
xprintf ("Archive: ");
if (strres) xprintf ("%.*s", strsize, strres);
else xprintf ("-\n");
- xprintf ("Tag: %s\n", tag?tag:"");
+ xprintf ("Tag: %s\n", tag);
xprintf ("Build info:\n");
strres = extract_rcdata (BUILD_INFO, STRINGRES, &strsize);
while (strres) {
@@ -555,9 +555,10 @@
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
LPSTR cmdLine, int cmdShow)
{
- char *logname = NULL;
- const char *cp, *submit = NULL, *tag = NULL;
+ char *logname = NULL, *tag = NULL;
+ const char *cp, *submit = NULL;
int reset_env = 1;
+ int interactive = 1;
/* initialize the revision information first */
extract_rev_infos();
@@ -572,6 +573,7 @@
switch (cmdLine[1]) {
case 'c':
report (R_TEXTMODE);
+ interactive = 0;
break;
case 'e':
reset_env = 0;
@@ -581,6 +583,7 @@
exit (0);
case 'q':
report (R_QUIET);
+ interactive = 0;
break;
case 's':
submit = strtok (NULL, whitespace);
@@ -608,10 +611,10 @@
cmdLine = strtok (NULL, whitespace);
}
if (!submit) {
- if (!running_on_visible_desktop ()) {
- report (R_ERROR, "Tests must be run on a visible desktop");
- exit (2);
- }
+ report (R_STATUS, "Starting up");
+
+ if (!running_on_visible_desktop ())
+ report (R_FATAL, "Tests must be run on a visible desktop");
if (reset_env && (putenv ("WINETEST_PLATFORM=windows") ||
putenv ("WINETEST_DEBUG=1") ||
@@ -619,7 +622,15 @@
putenv ("WINETEST_REPORT_SUCCESS=0")))
report (R_FATAL, "Could not reset environment: %d", errno);
- report (R_STATUS, "Starting up");
+ if (!tag) {
+ if (!interactive)
+ report (R_FATAL, "Please specify a tag (-t option) if "
+ "running noninteractive!");
+ tag = guiAskTag ();
+ if (!tag) exit (1); /* user pressed Abort */
+ }
+ report (R_TAG, tag);
+
if (!logname) {
logname = run_tests (NULL, tag);
if (report (R_ASK, MB_YESNO, "Do you want to submit the "
Index: programs/winetest/resource.h
===================================================================
RCS file: /home/wine/wine/programs/winetest/resource.h,v
retrieving revision 1.1
diff -u -r1.1 resource.h
--- programs/winetest/resource.h 15 Jun 2004 22:45:15 -0000 1.1
+++ programs/winetest/resource.h 30 Mar 2005 10:45:59 -0000
@@ -22,6 +22,7 @@
#define IDD_STATUS 100
#define IDD_ABOUT 101
+#define IDD_TAG 102
#define IDC_ST0 1000
#define IDC_PB0 1001
@@ -32,6 +33,7 @@
#define IDC_DIR 2000
#define IDC_OUT 2001
+#define IDC_TAG 2002
#define IDC_SB 3000
Index: programs/winetest/winetest.h
===================================================================
RCS file: /home/wine/wine/programs/winetest/winetest.h,v
retrieving revision 1.5
diff -u -r1.5 winetest.h
--- programs/winetest/winetest.h 15 Jun 2004 22:45:15 -0000 1.5
+++ programs/winetest/winetest.h 30 Mar 2005 10:45:59 -0000
@@ -46,6 +46,7 @@
R_PROGRESS,
R_STEP,
R_DELTA,
+ R_TAG,
R_DIR,
R_OUT,
R_WARNING,
@@ -56,6 +57,7 @@
R_QUIET
};
+char *guiAskTag (void);
int report (enum report_type t, ...);
#endif /* __WINETESTS_H */
Index: programs/winetest/winetest.rc
===================================================================
RCS file: /home/wine/wine/programs/winetest/winetest.rc,v
retrieving revision 1.1
diff -u -r1.1 winetest.rc
--- programs/winetest/winetest.rc 15 Jun 2004 22:45:15 -0000 1.1
+++ programs/winetest/winetest.rc 30 Mar 2005 10:45:59 -0000
@@ -23,7 +23,18 @@
#include "resource.h"
#include "tests.rc"
-IDD_STATUS DIALOG 0, 0, 160, 140
+IDD_TAG DIALOG 0, 0, 150, 65
+STYLE WS_POPUP
+CAPTION "No tag supplied"
+BEGIN
+ CTEXT "Please supply a tag for your report. You can use letters, digits, dashes and periods."
+ IDC_STATIC, 10, 5, 130, 30
+ EDITTEXT IDC_TAG, 35, 30, 80, 10
+ DEFPUSHBUTTON "Start", IDOK, 25, 45, 40, 14
+ PUSHBUTTON "Abort", IDABORT, 85, 45, 40, 14
+END
+
+IDD_STATUS DIALOG 0, 0, 160, 150
STYLE WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX
CAPTION "Wine Test Shell"
BEGIN
@@ -34,17 +45,20 @@
LTEXT "Network transfer:", IDC_ST2, 10, 60, 140, 10
CONTROL "PB2", IDC_PB2, PROGRESS_CLASS, 0, 5, 70, 150, 10
- LTEXT "Working directory:", IDC_STATIC, 10, 89, 100, 10
- EDITTEXT IDC_DIR, 71, 88, 79, 10,
+ LTEXT "Tag:", IDC_STATIC, 10, 89, 100, 10
+ EDITTEXT IDC_TAG, 25, 88, 125, 10,
+ ES_READONLY
+ LTEXT "Working directory:", IDC_STATIC, 10, 100, 100, 10
+ EDITTEXT IDC_DIR, 71, 99, 79, 10,
ES_READONLY | ES_AUTOHSCROLL
- LTEXT "Output file:", IDC_STATIC, 10, 100, 100, 10
- EDITTEXT IDC_OUT, 46, 99, 104, 10,
+ LTEXT "Output file:", IDC_STATIC, 10, 111, 100, 10
+ EDITTEXT IDC_OUT, 46, 110, 104, 10,
ES_READONLY | ES_AUTOHSCROLL
- DEFPUSHBUTTON "About", IDHELP, 20, 113, 30, 14
- PUSHBUTTON "Edit", IDCANCEL, 65, 113, 30, 14,
+ DEFPUSHBUTTON "About", IDHELP, 20, 123, 30, 14
+ PUSHBUTTON "Edit", IDCANCEL, 65, 123, 30, 14,
WS_DISABLED
- PUSHBUTTON "Stop", IDABORT, 110, 113, 30, 14
+ PUSHBUTTON "Stop", IDABORT, 110, 123, 30, 14
CONTROL "Created", IDC_SB, STATUSCLASSNAME, 0, 0,0,0,0
END
More information about the wine-patches
mailing list