8 # define sleep(x) Sleep(x)
12 #undef BUILDING_FOX16_GUI
15 #include <gwen-gui-fox16/fox16_gui.hpp>
20 #include "../testdialogs/dlg_test.h"
21 #include "../testdialogs/dlg_test2.h"
23 #include <gwenhywfar/gwenhywfar.h>
24 #include <gwenhywfar/debug.h>
25 #include <gwenhywfar/passwdstore.h>
31 int test1(
int argc,
char **argv) {
32 FXApp a(
"libtest",
"Martin Preuss");
35 const char testString[]=
38 "This is <b>a</b> test. "
39 "And this, is the second line: followed by something else."
50 "And this is after the table.<br>"
51 "and this <font color=\"red\">one</font> is red.";
53 "This is before right"
54 "<right>RIGHT</right>"
55 "and this after right.";
68 ctx.setText(testString);
82 int test2(
int argc,
char **argv) {
83 FXApp application(
"libtest",
"Martin Preuss");
91 application.init(argc,argv);
103 "<p><b>This</b> is an example <i>text</i>..</p>"
104 "<p>As you can see <font color=red>colors</font> can "
109 for (i1=1; i1<=15; i1++) {
111 "Step %d: This is a another step in the test of progress widgets",
117 "Starting 2nd progress...",
120 for (i2=1; i2<=3; i2++) {
122 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
125 fprintf(stderr,
"Aborted by user\n");
133 fprintf(stderr,
"Aborted by user\n");
146 FXApp a(
"libtest",
"Martin Preuss");
151 const char testString[]=
155 "This is <b>a</b> test. "
156 "And this, is the second line: followed by something else."
157 "<right>This should be right aligned</right>"
165 " <td>this is longer data (data2)</td>"
168 "And this is after the table.<br>"
169 "and this <font color=\"red\">one</font> is red.";
171 "This is before right"
172 "<right>Right</right>"
173 "and this after right.";
181 dbox=
new FXDialogBox(&a,
"Test", DECOR_ALL);
182 vf=
new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
183 0, 0, 0, 0, 1, 1, 1, 1);
184 label=
new FOX16_HtmlLabel(vf, FXString(testString), LAYOUT_FILL_X|LAYOUT_FILL_Y);
185 new FXSpring(vf, LAYOUT_FILL_X | LAYOUT_FILL_Y);
186 new FXLabel(vf,
"Normal Testlabel");
189 dbox->resize(300, 200);
199 FXApp application(
"libtest",
"Martin Preuss");
207 application.init(argc,argv);
209 application.create();
219 "<p><b>Test</b> f\xc3\xbcr Umlaute.</p>"
223 for (i1=1; i1<=10; i1++) {
226 snprintf(numbuf,
sizeof(numbuf)-1,
"Step %d", (
int)i1);
232 "Starting 2nd progress...",
235 for (i2=1; i2<=10; i2++) {
237 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
240 fprintf(stderr,
"Aborted by user\n");
248 fprintf(stderr,
"Aborted by user\n");
261 FXApp a(
"libtest",
"Martin Preuss");
266 const char testString[]=
270 "This is <b>a</b> test. "
271 "And this, is the second line: followed by something else."
272 "<right>This should be right aligned</right>"
280 " <td>this is longer data (data2)</td>"
283 "And this is after the table.<br>"
284 "and this <font color=\"red\">one</font> is red.";
286 "This is before right"
287 "<right>Right</right>"
288 "and this after right.";
296 dbox=
new FXDialogBox(&a,
"Test", DECOR_ALL);
297 vf=
new FXVerticalFrame(dbox, LAYOUT_FILL_X | LAYOUT_FILL_Y,
298 0, 0, 0, 0, 1, 1, 1, 1);
300 LAYOUT_FILL_X|LAYOUT_FILL_Y |
301 HSCROLLING_OFF | VSCROLLER_ALWAYS);
302 new FXSpring(vf, LAYOUT_FILL_X | LAYOUT_FILL_Y);
303 new FXLabel(vf,
"Normal Testlabel");
306 dbox->resize(300, 200);
316 FXApp application(
"libtest",
"Martin Preuss");
324 application.init(argc,argv);
326 application.create();
336 "<p><b>Test</b> f\xc3\xbcr Umlaute.</p>"
340 for (i1=1; i1<=20; i1++) {
343 snprintf(numbuf,
sizeof(numbuf)-1,
"Step %d", (
int)i1);
349 "Starting 2nd progress...",
352 for (i2=1; i2<=5; i2++) {
354 fprintf(stderr,
"Advancing %d/%d\n", (
int)i1, (
int)i2);
358 fprintf(stderr,
"Aborted by user\n");
366 fprintf(stderr,
"Aborted by user\n");
379 FXApp application(
"libtest",
"Martin Preuss");
383 application.init(argc,argv);
385 application.create();
392 "<html>This is the text.</html>This is ASCII",
405 FXApp application(
"libtest",
"Martin Preuss");
410 application.init(argc,argv);
412 application.create();
423 fprintf(stderr,
"Could not create dialog.\n");
428 fprintf(stderr,
"Result: %d\n", rv);
436 FXApp application(
"libtest",
"Martin Preuss");
441 application.init(argc,argv);
443 application.create();
454 fprintf(stderr,
"Could not create dialog.\n");
459 fprintf(stderr,
"Result: %d\n", rv);
467 FXApp application(
"libtest",
"Martin Preuss");
477 DBG_ERROR(0,
"Expected token and secret");
483 application.init(argc,argv);
485 application.create();
500 rv=
GWEN_Gui_GetPassword(0, token,
"Get Password",
"Please enter password 1", pw, 4,
sizeof(pw)-1, 0);
502 DBG_ERROR(0,
"Error getting password: %d", rv);
505 if (strcmp(epw, pw)!=0) {
506 DBG_ERROR(0,
"Bad password for token [%s], expected [%s], got [%s].", token, epw, pw);
513 fprintf(stderr,
"Could not create dialog.\n");
518 fprintf(stderr,
"Result: %d\n", rv);
527 FXApp application(
"libtest",
"Martin Preuss");
531 application.init(argc,argv);
533 application.create();
540 "<html>This is quite a long HTML text. This is the second sentence, which is a bit longer "
541 "than the first one.<br>In any case this sentence should begin on its own line</html>"
543 "This is quite a long HTML text. This is the second sentence, which is a bit longer "
544 "than the first one.\nIn any case this sentence should begin on its own line.",
557 FXApp application(
"libtest",
"Martin Preuss");
561 application.init(argc,argv);
563 application.create();
570 "<html><b>This</b> is quite a long HTML text. This is the second sentence, which is a bit longer "
571 "than the first one.<br>In any case this sentence should begin on its own line.</html>",
584 int main(
int argc,
char **argv) {
590 if (strcasecmp(argv[1],
"1")==0)
591 return test1(argc, argv);
592 else if (strcasecmp(argv[1],
"2")==0)
593 return test2(argc, argv);
594 else if (strcasecmp(argv[1],
"3")==0)
595 return test3(argc, argv);
596 else if (strcasecmp(argv[1],
"4")==0)
597 return test4(argc, argv);
598 else if (strcasecmp(argv[1],
"5")==0)
599 return test5(argc, argv);
600 else if (strcasecmp(argv[1],
"6")==0)
601 return test6(argc, argv);
602 else if (strcasecmp(argv[1],
"7")==0)
603 return test7(argc, argv);
604 else if (strcasecmp(argv[1],
"8")==0)
605 return test8(argc, argv);
606 else if (strcasecmp(argv[1],
"9")==0)
607 return test9(argc, argv);
608 else if (strcasecmp(argv[1],
"10")==0)
609 return test10(argc, argv);
610 else if (strcasecmp(argv[1],
"11")==0)
611 return test11(argc, argv);
612 else if (strcasecmp(argv[1],
"12")==0)
613 return test12(argc, argv);
616 return test7(argc, argv);