forked from Lephenixnoir/FxLibcTest
allow browsing both visualization and logs
This commit is contained in:
parent
f852d9f7f3
commit
95d4af238b
48
src/main.c
48
src/main.c
|
@ -112,6 +112,20 @@ int main(void)
|
|||
selected_set = 1;
|
||||
}
|
||||
|
||||
// Update F-keys when tests are selected
|
||||
if((e.type == FLIST_SELECTED || e.type == JWIDGET_FOCUS_IN ||
|
||||
e.type == JWIDGET_FOCUS_OUT) && e.source == browser->tests) {
|
||||
|
||||
ft_test *test = NULL;
|
||||
if(jscene_focused_widget(scr->scene) == browser->tests)
|
||||
test = fbrowser_current_test(browser);
|
||||
|
||||
jfkeys_set_override(scr->fkeys, 4,
|
||||
(test && test->run && test->log) ? "@LOG" : NULL);
|
||||
jfkeys_set_override(scr->fkeys, 5,
|
||||
(test && test->run && test->widget) ? "@VISUAL" : NULL);
|
||||
}
|
||||
|
||||
// Run tests
|
||||
if(tab == 0 && key == KEY_F6) {
|
||||
ft_list *header = fbrowser_current_header(browser);
|
||||
|
@ -136,21 +150,33 @@ int main(void)
|
|||
}
|
||||
|
||||
// Browse test results
|
||||
ft_test *test_visual = NULL;
|
||||
ft_test *test_log = NULL;
|
||||
|
||||
if(tab == 0 && e.type == FBROWSER_VALIDATED && e.source == browser) {
|
||||
ft_test *test = fbrowser_current_test(browser);
|
||||
if(test->run && test->widget) {
|
||||
jwidget *w = test->widget(test);
|
||||
if(w) {
|
||||
jwidget_add_child(results, w);
|
||||
gscreen_show_tab(scr, 1);
|
||||
jscene_set_focused_widget(scr->scene, w);
|
||||
}
|
||||
}
|
||||
else if(test->run && test->log) {
|
||||
flog_set_log(testlog, test->log, test->log_size);
|
||||
gscreen_show_tab(scr, 2);
|
||||
test_visual = test;
|
||||
test_log = test;
|
||||
}
|
||||
if(key == KEY_F4) {
|
||||
test_log = fbrowser_current_test(browser);
|
||||
}
|
||||
if(key == KEY_F5) {
|
||||
test_visual = fbrowser_current_test(browser);
|
||||
}
|
||||
|
||||
if(test_visual && test_visual->run && test_visual->widget) {
|
||||
jwidget *w = test_visual->widget(test_visual);
|
||||
if(w) {
|
||||
jwidget_add_child(results, w);
|
||||
gscreen_show_tab(scr, 1);
|
||||
jscene_set_focused_widget(scr->scene, w);
|
||||
}
|
||||
}
|
||||
else if(test_log && test_log->run && test_log->log) {
|
||||
flog_set_log(testlog, test_log->log, test_log->log_size);
|
||||
gscreen_show_tab(scr, 2);
|
||||
}
|
||||
|
||||
// Close test results
|
||||
if(tab == 1 && key == KEY_EXIT) {
|
||||
|
|
Loading…
Reference in New Issue