Changeset c4a53280 in mainline for uspace/app/taskbar/test/wndlist.c


Ignore:
Timestamp:
2022-12-01T14:39:56Z (18 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
795c6f7
Parents:
68d68e9
git-author:
Jiri Svoboda <jiri@…> (2022-11-30 18:39:42)
git-committer:
Jiri Svoboda <jiri@…> (2022-12-01 14:39:56)
Message:

Optimize redrawing of window buttons

We cache the button pich inside wndlist_t. We only repaint the entire
window list if the pitch changes. Otherwise we just (un)paint the
affected buttons.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/taskbar/test/wndlist.c

    r68d68e9 rc4a53280  
    407407}
    408408
     409/** Test wndlist_last() */
     410PCUT_TEST(last)
     411{
     412        errno_t rc;
     413        ui_t *ui = NULL;
     414        ui_wnd_params_t params;
     415        ui_window_t *window = NULL;
     416        ui_fixed_t *fixed = NULL;
     417        wndlist_t *wndlist;
     418        wndlist_entry_t *entry;
     419
     420        rc = ui_create_disp(NULL, &ui);
     421        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     422
     423        ui_wnd_params_init(&params);
     424        params.caption = "Hello";
     425
     426        rc = ui_window_create(ui, &params, &window);
     427        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     428        PCUT_ASSERT_NOT_NULL(window);
     429
     430        rc = ui_fixed_create(&fixed);
     431        ui_window_add(window, ui_fixed_ctl(fixed));
     432
     433        rc = wndlist_create(window, fixed, &wndlist);
     434        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     435
     436        rc = wndlist_append(wndlist, 1, "Foo", true);
     437        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     438
     439        rc = wndlist_append(wndlist, 2, "Bar", true);
     440        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     441
     442        entry = wndlist_last(wndlist);
     443        PCUT_ASSERT_NOT_NULL(entry);
     444        PCUT_ASSERT_INT_EQUALS(2, entry->wnd_id);
     445
     446        wndlist_destroy(wndlist);
     447
     448        ui_window_destroy(window);
     449        ui_destroy(ui);
     450}
     451
    409452/** Test wndlist_count() */
    410453PCUT_TEST(count)
Note: See TracChangeset for help on using the changeset viewer.