10 #define iprint(lev, args...) ;
14 "icon dummy.png 100 23 svc_start dummysvc",
15 "icon dummy.png 340 40 crop <0,0,0,0> <30,30,10,10>",
16 "icon dummy.png 45 65 crop <1,1,1,1> <23,4,5,6> svc_stop dummysvc ",
17 "icon dummy.png 67 40 svc_start dummysvc blendout(45)",
24 "icon dummy.png svc_start dummysvc",
25 "icon dummy.png 0 svc_start dummysvc",
26 "icon dummy.png 10 100 crop <0,0,0,0>",
27 "icon dummy.png 34 34 svc_stop",
32 "anim once dummy.mng 0 0",
33 "anim loop dummy.mng 30 40 svc_started dummysvc",
34 "anim proportional dummy.mng 30 40 svc_start_failed dummysvc",
35 "anim once dummy.mng 0 0 svc_started dummysvc blendin(450)",
40 "anim once dummy.png svc_start dummysvc",
42 "anim loop dummy.png 0",
43 "anim loop dummy.png 0 3 svc_start ",
47 "text dummy.ttf 12 0 0 #000000 \"foobar\"",
48 "text silent verbose dummy.ttf 12 0 0 #fe09ae \"dummy\"",
49 "text silent dummy.ttf biu 12 5 left 5 top #deadbeef exec eval \"$progress test\"",
50 "text verbose dummy.ttf ubi 3 100 middle 347 middle #ffffff exec \"dummy\"",
51 "text verbose dummy.ttf b 1 100 right 100 bottom #123456 eval \"just a test\"",
52 "text dummy.ttf 12 0 0 #000000 \"foo\" blendin(24345)",
57 "text dummy.ttf biu 3 4",
58 "text dummy.ttf 3 top 4 middle",
59 "text dummy.ttf 4 5 \"test\"",
60 "text dummy.ttf 4 4 5 \"test\"",
61 "text dummy.ttf 12 0 0 #fff00 \"test\"",
62 "text dummy.ttf 12 0 0 #ff00ff00f \"test\"",
63 "text dummy.ttf 12 0 0 #ffffff test",
67 "box silent 0 0 1 1 #001122",
68 "box 0 0 0 0 #12345678",
69 "box silent 0 1 2 3 #000000 #111111 #222222 #333333",
70 "box silent 0 1 2 3 #000000 blendin(134)",
75 "box 1 2 3 4 #0012gf",
78 "box 5 5 1 1 #f0f0f0",
79 "box 1 1 4 4 #f0f0f0 #f0f0f0",
80 "box 2 5 6 7 #f0f0f0 #f0f0f0 #deadbeef",
81 "box 7 7 8 8 #708090 #909090 #deadbeef #beefdeade",
82 "box silent 0 349 1279 450 #22222c #22222c #383849 #040454498",
83 "box silent 0 1 2 3 #000000 blendout(34",
84 "box silent 0 1 2 3 #134342 blendout(45) blendin(345",
87 #define ARRAY_SIZE(a) (sizeof(a)/sizeof(*a))
92 bool parse_box_wrapper(char *t
)
94 void *p
= parse_box(t
);
95 return (p
== NULL
) ? false : true;
98 void test_parse(bool (*parsef
)(char*), bool expect
, char *stuff
, int offset
)
100 char *p
= strdup(stuff
);
101 bool out
= parsef(p
+ offset
);
106 printf("* Failed: %s\n", stuff
);
109 printf("* OK: %s\n", stuff
);
116 int main(int argc
, char **argv
)
122 config
= fbsplash_lib_init(fbspl_bootup
);
123 fbsplash_acc_theme_set("test");
124 fbsplashr_init(false);
126 config
->verbosity
= FBSPL_VERB_QUIET
;
128 tmptheme
.xres
= 1000;
129 tmptheme
.yres
= 1000;
131 for (i
= 0; i
< ARRAY_SIZE(icons_ok
); i
++) {
132 test_parse(parse_icon
, true, icons_ok
[i
], 4);
135 for (i
= 0; i
< ARRAY_SIZE(icons_err
); i
++) {
136 test_parse(parse_icon
, false, icons_err
[i
], 4);
140 for (i
= 0; i
< ARRAY_SIZE(anims_ok
); i
++) {
141 test_parse(parse_anim
, true, anims_ok
[i
], 4);
144 for (i
= 0; i
< ARRAY_SIZE(anims_err
); i
++) {
145 test_parse(parse_anim
, false, anims_err
[i
], 4);
150 for (i
= 0; i
< ARRAY_SIZE(text_ok
); i
++) {
151 test_parse(parse_text
, true, text_ok
[i
], 4);
154 for (i
= 0; i
< ARRAY_SIZE(text_err
); i
++) {
155 test_parse(parse_text
, false, text_err
[i
], 4);
159 for (i
= 0; i
< ARRAY_SIZE(box_ok
); i
++) {
160 test_parse(parse_box_wrapper
, true, box_ok
[i
], 3);
163 for (i
= 0; i
< ARRAY_SIZE(box_err
); i
++) {
164 test_parse(parse_box_wrapper
, false, box_err
[i
], 3);
167 printf("Ran %d tests, %d failed.\n", tests_run
, tests_failed
);
170 fbsplash_lib_cleanup();