improve typecheck

This commit is contained in:
xianjimli 2019-02-26 15:25:10 +08:00
parent 4271ad17ed
commit a62c9303b2
2 changed files with 5 additions and 6 deletions

View File

@ -2002,6 +2002,10 @@ bool_t widget_is_instance_of(widget_t* widget, const widget_vtable_t* vt) {
iter = iter->parent;
}
#ifdef WITH_WIDGET_TYPE_CHECK
return FALSE;
#else
log_warn("%s is not instance of %s\n", widget->vt->type, vt->type);
return TRUE;
#endif/*WITH_WIDGET_TYPE_CHECK*/
}

View File

@ -39,8 +39,3 @@ TEST(Dialog, cast) {
widget_destroy(w);
}
TEST(Dialog, invalid_modal) {
widget_t* w = window_create(NULL, 10, 20, 30, 40);
ASSERT_EQ(dialog_modal(w), RET_BAD_PARAMS);
widget_destroy(w);
}