Changeset 3d10a2f in mainline for uspace/lib/ui/src/ui.c


Ignore:
Timestamp:
2021-10-04T12:25:43Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
cd981f2a, e0e1b3d
Parents:
6d172f6
git-author:
Jiri Svoboda <jiri@…> (2021-10-03 17:25:36)
git-committer:
Jiri Svoboda <jiri@…> (2021-10-04 12:25:43)
Message:

Null display spec for the benefit of unit testing

When testing something that takes a display specification as argument,
it is useful to be able to be able to specify dummy output (so far,
only ui_create_disp() could create a UI with dummy output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/ui/src/ui.c

    r6d172f6 r3d10a2f  
    5555 *
    5656 * Output specification has the form <proto>@<service> where proto is
    57  * eiher 'disp' for display service or 'cons' for console. Service
    58  * is a location ID service name (e.g. hid/display).
     57 * eiher 'disp' for display service, 'cons' for console, 'null'
     58 * for dummy output. Service is a location ID service name (e.g. hid/display).
    5959 *
    6060 * @param ospec Output specification
     
    8282                } else if (str_lcmp(ospec, "cons@", str_length("cons@")) == 0) {
    8383                        *ws = ui_ws_console;
     84                } else if (str_lcmp(ospec, "null@", str_length("null@")) == 0) {
     85                        *ws = ui_ws_null;
    8486                } else {
    8587                        *ws = ui_ws_unknown;
     
    99101 *
    100102 * @param ospec Output specification or @c UI_DISPLAY_DEFAULT to use
    101  *              the default output
     103 *              the default display service, UI_CONSOLE_DEFAULT to use
     104 *              the default console service, UI_DISPLAY_NULL to use
     105 *              dummy output.
    102106 * @param rui Place to store pointer to new UI
    103107 * @return EOK on success or an error code
     
    161165
    162166                (void) ui_paint(ui);
     167        } else if (ws == ui_ws_null) {
     168                rc = ui_create_disp(NULL, &ui);
     169                if (rc != EOK)
     170                        return rc;
    163171        } else {
    164172                return EINVAL;
Note: See TracChangeset for help on using the changeset viewer.