1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
/* xscreensaver, Copyright © 1998-2021 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation. No representations are made about the suitability of this
* software for any purpose. It is provided "as is" without express or
* implied warranty.
*/
/* This is a kludgy test harness for debugging the password dialog box.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include "blurb.h"
#include "auth.h"
extern Bool test_auth_conv (void *, int, auth_message *, auth_response **);
Bool
test_auth_conv (void *closure,
int nmsgs,
auth_message *msg,
auth_response **resp)
{
int page = 1;
int i;
nmsgs = 0;
msg = (auth_message *) calloc (100, sizeof(*msg));
# define DIALOG() \
fprintf (stderr, "\n%s: page %d\n", blurb(), page++); \
xscreensaver_auth_conv (closure, nmsgs, msg, resp); \
if (*resp) \
for (i = 0; i < nmsgs; i++) \
fprintf (stderr, "%s: resp %d = \"%s\"\n", blurb(), i, \
((*resp)[i].response ? (*resp)[i].response : "")); \
nmsgs = 0
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "1/4 Page One";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "2/4 All work and no play makes Jack a dull boy. "
"All work and no play makes Jack a dull boy. ";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_ERROR;
msg[nmsgs].msg = "3/4 Red";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "4/4 Greets to Crash Override.";
nmsgs++;
DIALOG();
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "1/1 Page Two";
nmsgs++;
DIALOG();
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "1/2 Page Three";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_NOECHO;
msg[nmsgs].msg = "2/2 Greets to Crash Override and also Joey";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_NOECHO;
msg[nmsgs].msg = "1/3 Page Four";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "2/3 Hack the planet.";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "3/3 Hack the planet.";
nmsgs++;
DIALOG();
msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_ECHO;
msg[nmsgs].msg = "1/1 Page Five visible text";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_PROMPT_ECHO;
msg[nmsgs].msg = "1/3 Page six visible text";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "2/3 Poop.";
nmsgs++;
msg[nmsgs].type = AUTH_MSGTYPE_INFO;
msg[nmsgs].msg = "3/3 \xF0\x9F\x92\xA9 \xF0\x9F\x92\xA9 \xF0\x9F\x92\xA9"
" \xE2\x80\x9C"
" \xE2\xAC\xA4 \xE2\x80\xA2 \xE2\xAD\x98 "
"\xE2\x80\x9D";
nmsgs++;
DIALOG();
exit(0);
}
|