Changeset acd7ac2 in mainline for uspace/srv/hid/display/test/window.c


Ignore:
Timestamp:
2023-08-09T11:27:03Z (17 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
24be331e
Parents:
a77c722
git-author:
Jiri Svoboda <jiri@…> (2023-08-08 17:26:15)
git-committer:
Jiri Svoboda <jiri@…> (2023-08-09 11:27:03)
Message:

Switch focus to the right window when window is closed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/display/test/window.c

    ra77c722 racd7ac2  
    11691169}
    11701170
    1171 /** ds_window_find_alt() finds alternate window by flags */
    1172 PCUT_TEST(window_find_alt)
     1171/** ds_window_find_next() finds next window by flags */
     1172PCUT_TEST(window_find_next)
    11731173{
    11741174        gfx_context_t *gc;
     
    12101210        w2->flags |= wndf_system;
    12111211
    1212         wnd = ds_window_find_alt(w0, wndf_minimized);
     1212        wnd = ds_window_find_next(w0, wndf_minimized);
    12131213        PCUT_ASSERT_EQUALS(w1, wnd);
    12141214
    1215         wnd = ds_window_find_alt(w0, wndf_system);
     1215        wnd = ds_window_find_next(w0, wndf_system);
    12161216        PCUT_ASSERT_EQUALS(w2, wnd);
    12171217
    1218         wnd = ds_window_find_alt(w0, wndf_maximized);
     1218        wnd = ds_window_find_next(w0, wndf_maximized);
     1219        PCUT_ASSERT_NULL(wnd);
     1220
     1221        ds_window_destroy(w0);
     1222        ds_window_destroy(w1);
     1223        ds_window_destroy(w2);
     1224        ds_seat_destroy(seat);
     1225        ds_client_destroy(client);
     1226        ds_display_destroy(disp);
     1227}
     1228
     1229/** ds_window_find_prev() finds previous window by flags */
     1230PCUT_TEST(window_find_prev)
     1231{
     1232        gfx_context_t *gc;
     1233        ds_display_t *disp;
     1234        ds_client_t *client;
     1235        ds_seat_t *seat;
     1236        ds_window_t *w0;
     1237        ds_window_t *w1;
     1238        ds_window_t *w2;
     1239        ds_window_t *wnd;
     1240        display_wnd_params_t params;
     1241        errno_t rc;
     1242
     1243        rc = gfx_context_new(&dummy_ops, NULL, &gc);
     1244        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1245
     1246        rc = ds_display_create(gc, df_none, &disp);
     1247        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1248
     1249        rc = ds_client_create(disp, NULL, NULL, &client);
     1250        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1251
     1252        rc = ds_seat_create(disp, "Alice", &seat);
     1253        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1254
     1255        display_wnd_params_init(&params);
     1256        params.rect.p0.x = params.rect.p0.y = 0;
     1257        params.rect.p1.x = params.rect.p1.y = 1;
     1258
     1259        rc = ds_window_create(client, &params, &w2);
     1260        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1261        w2->flags |= wndf_system;
     1262
     1263        rc = ds_window_create(client, &params, &w1);
     1264        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1265        w1->flags |= wndf_minimized;
     1266
     1267        rc = ds_window_create(client, &params, &w0);
     1268        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     1269
     1270        wnd = ds_window_find_prev(w0, wndf_minimized);
     1271        PCUT_ASSERT_EQUALS(w1, wnd);
     1272
     1273        wnd = ds_window_find_prev(w0, wndf_system);
     1274        PCUT_ASSERT_EQUALS(w2, wnd);
     1275
     1276        wnd = ds_window_find_prev(w0, wndf_maximized);
    12191277        PCUT_ASSERT_NULL(wnd);
    12201278
Note: See TracChangeset for help on using the changeset viewer.