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


Ignore:
Timestamp:
2023-01-04T20:24:44Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5d86797
Parents:
cdd6fc9
Message:

Highlight active window in task bar

File:
1 edited

Legend:

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

    rcdd6fc9 r3c54869  
    11/*
    2  * Copyright (c) 2022 Jiri Svoboda
     2 * Copyright (c) 2023 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    208208        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    209209
    210         rc = wndlist_append(wndlist, 123, "Foo", true);
     210        rc = wndlist_append(wndlist, 123, "Foo", true, true);
    211211        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    212212
     
    214214        PCUT_ASSERT_INT_EQUALS(123, entry->wnd_id);
    215215        PCUT_ASSERT_NOT_NULL(entry->button);
     216        PCUT_ASSERT_TRUE(ui_pbutton_get_light(entry->button));
    216217
    217218        wndlist_destroy(wndlist);
     
    248249        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    249250
    250         rc = wndlist_append(wndlist, 1, "Foo", true);
    251         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    252 
    253         rc = wndlist_append(wndlist, 2, "Bar", true);
     251        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     252        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     253
     254        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    254255        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    255256
     
    269270}
    270271
     272/** Test updating entry */
     273PCUT_TEST(update)
     274{
     275        errno_t rc;
     276        ui_t *ui = NULL;
     277        ui_wnd_params_t params;
     278        ui_window_t *window = NULL;
     279        ui_fixed_t *fixed = NULL;
     280        wndlist_t *wndlist;
     281        wndlist_entry_t *entry;
     282
     283        rc = ui_create_disp(NULL, &ui);
     284        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     285
     286        ui_wnd_params_init(&params);
     287        params.caption = "Hello";
     288
     289        rc = ui_window_create(ui, &params, &window);
     290        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     291        PCUT_ASSERT_NOT_NULL(window);
     292
     293        rc = ui_fixed_create(&fixed);
     294        ui_window_add(window, ui_fixed_ctl(fixed));
     295
     296        rc = wndlist_create(window, fixed, &wndlist);
     297        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     298
     299        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     300        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     301
     302        entry = wndlist_first(wndlist);
     303        PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
     304        PCUT_ASSERT_NOT_NULL(entry->button);
     305        PCUT_ASSERT_TRUE(ui_pbutton_get_light(entry->button));
     306
     307        rc = wndlist_update(wndlist, entry, "Bar", false);
     308        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     309
     310        PCUT_ASSERT_INT_EQUALS(1, entry->wnd_id);
     311        PCUT_ASSERT_NOT_NULL(entry->button);
     312        PCUT_ASSERT_FALSE(ui_pbutton_get_light(entry->button));
     313
     314        wndlist_destroy(wndlist);
     315
     316        ui_window_destroy(window);
     317        ui_destroy(ui);
     318}
     319
    271320/** Test setting entry rectangle */
    272321PCUT_TEST(set_entry_rect)
     
    296345        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    297346
    298         rc = wndlist_append(wndlist, 123, "Foo", true);
     347        rc = wndlist_append(wndlist, 123, "Foo", true, true);
    299348        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    300349
     
    337386        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    338387
    339         rc = wndlist_append(wndlist, 1, "Foo", true);
    340         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    341 
    342         rc = wndlist_append(wndlist, 2, "Bar", true);
     388        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     389        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     390
     391        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    343392        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    344393
     
    384433        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    385434
    386         rc = wndlist_append(wndlist, 1, "Foo", true);
    387         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    388 
    389         rc = wndlist_append(wndlist, 2, "Bar", true);
     435        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     436        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     437
     438        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    390439        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    391440
     
    434483        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    435484
    436         rc = wndlist_append(wndlist, 1, "Foo", true);
    437         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    438 
    439         rc = wndlist_append(wndlist, 2, "Bar", true);
     485        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     486        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     487
     488        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    440489        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    441490
     
    480529        PCUT_ASSERT_INT_EQUALS(0, count);
    481530
    482         rc = wndlist_append(wndlist, 1, "Foo", true);
     531        rc = wndlist_append(wndlist, 1, "Foo", true, true);
    483532        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    484533
     
    486535        PCUT_ASSERT_INT_EQUALS(1, count);
    487536
    488         rc = wndlist_append(wndlist, 2, "Bar", true);
     537        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    489538        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    490539
     
    524573        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    525574
    526         rc = wndlist_append(wndlist, 1, "Foo", true);
    527         PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    528 
    529         rc = wndlist_append(wndlist, 2, "Bar", true);
     575        rc = wndlist_append(wndlist, 1, "Foo", true, true);
     576        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     577
     578        rc = wndlist_append(wndlist, 2, "Bar", false, true);
    530579        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
    531580
Note: See TracChangeset for help on using the changeset viewer.