Changeset 0e5ed803 in mainline for uspace/app/nav/test/panel.c
- Timestamp:
- 2021-10-04T20:39:24Z (4 years ago)
- Children:
- 3b67e95
- Parents:
- 68b9e540
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/test/panel.c
r68b9e540 r0e5ed803 41 41 errno_t rc; 42 42 43 rc = panel_create( &panel);43 rc = panel_create(NULL, &panel); 44 44 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 45 45 … … 47 47 } 48 48 49 50 /** Test panel_paint() */ 51 PCUT_TEST(paint) 52 { 53 ui_t *ui; 54 ui_window_t *window; 55 ui_wnd_params_t params; 56 panel_t *panel; 57 errno_t rc; 58 59 rc = ui_create_disp(NULL, &ui); 60 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 61 62 ui_wnd_params_init(¶ms); 63 params.caption = "Test"; 64 65 rc = ui_window_create(ui, ¶ms, &window); 66 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 67 68 rc = panel_create(window, &panel); 69 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 70 71 rc = panel_paint(panel); 72 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 73 74 panel_destroy(panel); 75 ui_window_destroy(window); 76 ui_destroy(ui); 77 } 78 79 /** panel_ctl() returns a valid UI control */ 80 PCUT_TEST(ctl) 81 { 82 panel_t *panel; 83 ui_control_t *control; 84 errno_t rc; 85 86 rc = panel_create(NULL, &panel); 87 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 88 89 control = panel_ctl(panel); 90 PCUT_ASSERT_NOT_NULL(control); 91 92 panel_destroy(panel); 93 } 94 95 /** Test panel_pos_event() */ 96 PCUT_TEST(pos_event) 97 { 98 panel_t *panel; 99 ui_control_t *control; 100 ui_evclaim_t claimed; 101 pos_event_t event; 102 errno_t rc; 103 104 rc = panel_create(NULL, &panel); 105 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 106 107 control = panel_ctl(panel); 108 PCUT_ASSERT_NOT_NULL(control); 109 110 claimed = panel_pos_event(panel, &event); 111 PCUT_ASSERT_EQUALS(ui_unclaimed, claimed); 112 113 panel_destroy(panel); 114 } 115 116 /** panel_set_rect() sets internal field */ 117 PCUT_TEST(set_rect) 118 { 119 panel_t *panel; 120 ui_control_t *control; 121 gfx_rect_t rect; 122 errno_t rc; 123 124 rc = panel_create(NULL, &panel); 125 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 126 127 control = panel_ctl(panel); 128 PCUT_ASSERT_NOT_NULL(control); 129 130 rect.p0.x = 1; 131 rect.p0.y = 2; 132 rect.p1.x = 3; 133 rect.p1.y = 4; 134 135 panel_set_rect(panel, &rect); 136 PCUT_ASSERT_INT_EQUALS(rect.p0.x, panel->rect.p0.x); 137 PCUT_ASSERT_INT_EQUALS(rect.p0.y, panel->rect.p0.y); 138 PCUT_ASSERT_INT_EQUALS(rect.p1.x, panel->rect.p1.x); 139 PCUT_ASSERT_INT_EQUALS(rect.p1.y, panel->rect.p1.y); 140 141 panel_destroy(panel); 142 } 143 49 144 PCUT_EXPORT(panel);
Note:
See TracChangeset
for help on using the changeset viewer.