Ignore:
Timestamp:
2022-10-31T10:53:53Z (2 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b92d4b
Parents:
7cc30e9
git-author:
Jiri Svoboda <jiri@…> (2022-10-30 10:53:48)
git-committer:
Jiri Svoboda <jiri@…> (2022-10-31 10:53:53)
Message:

Deliver WM events for windows being added and removed

File:
1 edited

Legend:

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

    r7cc30e9 r913add60  
    11/*
    2  * Copyright (c) 2019 Jiri Svoboda
     2 * Copyright (c) 2022 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636#include "../seat.h"
    3737#include "../window.h"
     38#include "../wmclient.h"
    3839
    3940PCUT_INIT;
     
    4748};
    4849
     50static void test_ds_wmev_pending(void *);
     51
     52static ds_wmclient_cb_t test_ds_wmclient_cb = {
     53        .ev_pending = test_ds_wmev_pending
     54};
     55
    4956static void test_ds_ev_pending(void *arg)
    5057{
     
    5360}
    5461
     62static void test_ds_wmev_pending(void *arg)
     63{
     64        bool *called_cb = (bool *) arg;
     65        *called_cb = true;
     66}
     67
    5568/** Display creation and destruction. */
    5669PCUT_TEST(display_create_destroy)
     
    8699
    87100        ds_client_destroy(client);
     101        ds_display_destroy(disp);
     102}
     103
     104/** Basic WM client operation. */
     105PCUT_TEST(display_wmclient)
     106{
     107        ds_display_t *disp;
     108        ds_wmclient_t *wmclient;
     109        ds_wmclient_t *c0, *c1;
     110        errno_t rc;
     111
     112        rc = ds_display_create(NULL, df_none, &disp);
     113        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     114
     115        rc = ds_wmclient_create(disp, &test_ds_wmclient_cb, NULL, &wmclient);
     116        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     117
     118        c0 = ds_display_first_wmclient(disp);
     119        PCUT_ASSERT_EQUALS(c0, wmclient);
     120
     121        c1 = ds_display_next_wmclient(c0);
     122        PCUT_ASSERT_NULL(c1);
     123
     124        ds_wmclient_destroy(wmclient);
    88125        ds_display_destroy(disp);
    89126}
     
    150187        wnd = ds_display_find_window(disp, w0->id + 1);
    151188        PCUT_ASSERT_NULL(wnd);
     189
     190        ds_window_destroy(w0);
     191        ds_window_destroy(w1);
     192        ds_seat_destroy(seat);
     193        ds_client_destroy(client);
     194        ds_display_destroy(disp);
     195}
     196
     197/** Test ds_display_window_to_top() */
     198PCUT_TEST(display_window_to_top)
     199{
     200        ds_display_t *disp;
     201        ds_client_t *client;
     202        ds_seat_t *seat;
     203        ds_window_t *w0;
     204        ds_window_t *w1;
     205        display_wnd_params_t params;
     206        bool called_cb = false;
     207        errno_t rc;
     208
     209        rc = ds_display_create(NULL, df_none, &disp);
     210        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     211
     212        rc = ds_client_create(disp, &test_ds_client_cb, &called_cb, &client);
     213        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     214
     215        rc = ds_seat_create(disp, &seat);
     216        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     217
     218        display_wnd_params_init(&params);
     219        params.rect.p0.x = params.rect.p0.y = 0;
     220        params.rect.p1.x = params.rect.p1.y = 100;
     221
     222        rc = ds_window_create(client, &params, &w0);
     223        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     224
     225        rc = ds_window_create(client, &params, &w1);
     226        PCUT_ASSERT_ERRNO_VAL(EOK, rc);
     227
     228        PCUT_ASSERT_EQUALS(w1, ds_display_first_window(disp));
     229        ds_display_window_to_top(w0);
     230        PCUT_ASSERT_EQUALS(w0, ds_display_first_window(disp));
    152231
    153232        ds_window_destroy(w0);
Note: See TracChangeset for help on using the changeset viewer.