Changeset 5ef85c0 in mainline


Ignore:
Timestamp:
2022-03-17T12:16:03Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1026cc4
Parents:
71edd430
git-author:
Jiri Svoboda <jiri@…> (2022-03-16 19:15:43)
git-committer:
Jiri Svoboda <jiri@…> (2022-03-17 12:16:03)
Message:

Scrollbar unit tests

Location:
uspace/lib/ui
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/meson.build

    r71edd430 r5ef85c0  
    7575        'test/rbutton.c',
    7676        'test/resource.c',
     77        'test/scrollbar.c',
    7778        'test/slider.c',
    7879        'test/ui.c',
  • uspace/lib/ui/src/scrollbar.c

    r71edd430 r5ef85c0  
    4949#include "../private/scrollbar.h"
    5050
    51 /*
    52  * The kind reader will appreciate that scrollbar thumb dimensions 23:15
    53  * are chosen such that, after subtracting the frame width (2 times 1),
    54  * we get 21:13, which is a good approximation of the golden ratio.
    55  */
    5651enum {
    5752        /** Scrollbar button width */
     
    471466        w = scrollbar->rect.p1.x - scrollbar->rect.p0.x -
    472467            2 * ui_scrollbar_btn_len_text;
     468        assert(w >= 0);
     469        if (w < 0)
     470                return EINVAL;
     471
    473472        gchar = "\u2592";
    474473        gcharsz = str_size(gchar);
  • uspace/lib/ui/test/main.c

    r71edd430 r5ef85c0  
    4848PCUT_IMPORT(rbutton);
    4949PCUT_IMPORT(resource);
     50PCUT_IMPORT(scrollbar);
    5051PCUT_IMPORT(slider);
    5152PCUT_IMPORT(ui);
  • uspace/lib/ui/test/slider.c

    r71edd430 r5ef85c0  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    225225        ui_slider_moved(slider, 42);
    226226
    227         /* Moved with callback not implementing clicked */
     227        /* Moved with callback not implementing moved */
    228228        ui_slider_set_cb(slider, &dummy_slider_cb, NULL);
    229229        ui_slider_moved(slider, 42);
Note: See TracChangeset for help on using the changeset viewer.