diff --git a/Tests/SdkIntegration/main/Source/main.c b/Tests/SdkIntegration/main/Source/main.c index d4a9c3339..60dabf7d9 100644 --- a/Tests/SdkIntegration/main/Source/main.c +++ b/Tests/SdkIntegration/main/Source/main.c @@ -1,28 +1,15 @@ -#include +#include +#include +#include + +#include + +#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include -static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) { +static void create_widgets(lv_obj_t* parent, void* userData) { lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Title"); lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0); @@ -32,8 +19,27 @@ static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) { } int main(int argc, char* argv[]) { - tt_app_register((AppRegistration) { - .onShow = onShowApp - }); + AppInstanceId app_instance_id = app_scheduler_current_app_id(); + + struct AppEventSubscription sub = { .app_instance_id = app_instance_id }; + app_event_subscribe(&sub); + + WindowId window = window_manager_create(app_instance_id, create_widgets, NULL); + + bool should_close = false; + while (!should_close) { + struct AppEvent event; + if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) { + break; + } + if (event.type == APP_EVENT_CLOSE) { + app_manager_finish(app_instance_id); + should_close = true; + } + } + + window_manager_remove(window); + app_event_unsubscribe(&sub); + return 0; }