Changes in uspace/lib/ui/test/resource.c [95a9cbc:e0e612b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/ui/test/resource.c
r95a9cbc re0e612b 134 134 } 135 135 136 /** ui_resource_get_font() returns the font */ 137 PCUT_TEST(get_font) 138 { 139 errno_t rc; 140 gfx_context_t *gc = NULL; 141 test_gc_t tgc; 142 ui_resource_t *resource = NULL; 143 gfx_font_t *font; 144 145 memset(&tgc, 0, sizeof(tgc)); 146 rc = gfx_context_new(&ops, &tgc, &gc); 147 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 148 149 rc = ui_resource_create(gc, false, &resource); 150 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 151 PCUT_ASSERT_NOT_NULL(resource); 152 153 font = ui_resource_get_font(resource); 154 PCUT_ASSERT_EQUALS(resource->font, font); 155 156 ui_resource_destroy(resource); 157 158 rc = gfx_context_delete(gc); 159 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 160 } 161 162 /** ui_resource_is_textmode() returns the textmode flag */ 163 PCUT_TEST(is_textmode) 164 { 165 errno_t rc; 166 gfx_context_t *gc = NULL; 167 test_gc_t tgc; 168 ui_resource_t *resource = NULL; 169 170 memset(&tgc, 0, sizeof(tgc)); 171 rc = gfx_context_new(&ops, &tgc, &gc); 172 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 173 174 rc = ui_resource_create(gc, false, &resource); 175 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 176 PCUT_ASSERT_NOT_NULL(resource); 177 178 /* To make sure let's test both true and false case */ 179 resource->textmode = true; 180 PCUT_ASSERT_TRUE(ui_resource_is_textmode(resource)); 181 resource->textmode = false; 182 PCUT_ASSERT_FALSE(ui_resource_is_textmode(resource)); 183 184 ui_resource_destroy(resource); 185 186 rc = gfx_context_delete(gc); 187 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 188 } 189 190 /** ui_resource_get_wnd_face_color() returns window face color */ 191 PCUT_TEST(get_wnd_face_color) 192 { 193 errno_t rc; 194 gfx_context_t *gc = NULL; 195 test_gc_t tgc; 196 ui_resource_t *resource = NULL; 197 gfx_color_t *color; 198 199 memset(&tgc, 0, sizeof(tgc)); 200 rc = gfx_context_new(&ops, &tgc, &gc); 201 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 202 203 rc = ui_resource_create(gc, false, &resource); 204 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 205 PCUT_ASSERT_NOT_NULL(resource); 206 207 color = ui_resource_get_wnd_face_color(resource); 208 PCUT_ASSERT_EQUALS(resource->wnd_face_color, color); 209 210 ui_resource_destroy(resource); 211 212 rc = gfx_context_delete(gc); 213 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 214 } 215 216 /** ui_resource_get_wnd_text_color() returns window text color */ 217 PCUT_TEST(get_wnd_text_color) 218 { 219 errno_t rc; 220 gfx_context_t *gc = NULL; 221 test_gc_t tgc; 222 ui_resource_t *resource = NULL; 223 gfx_color_t *color; 224 225 memset(&tgc, 0, sizeof(tgc)); 226 rc = gfx_context_new(&ops, &tgc, &gc); 227 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 228 229 rc = ui_resource_create(gc, false, &resource); 230 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 231 PCUT_ASSERT_NOT_NULL(resource); 232 233 color = ui_resource_get_wnd_text_color(resource); 234 PCUT_ASSERT_EQUALS(resource->wnd_text_color, color); 235 236 ui_resource_destroy(resource); 237 238 rc = gfx_context_delete(gc); 239 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 240 } 241 136 242 static errno_t testgc_bitmap_create(void *arg, gfx_bitmap_params_t *params, 137 243 gfx_bitmap_alloc_t *alloc, void **rbm)
Note:
See TracChangeset
for help on using the changeset viewer.