Changeset 4fcc2de in mainline for uspace/app/nav/test/panel.c
- Timestamp:
- 2021-10-25T00:32:45Z (3 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f783081
- Parents:
- fa792e8
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-16 20:41:33)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-10-25 00:32:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/test/panel.c
rfa792e8 r4fcc2de 143 143 144 144 event.type = KEY_PRESS; 145 event.key = KC_E NTER;145 event.key = KC_ESCAPE; 146 146 event.mods = 0; 147 147 event.c = '\0'; … … 158 158 159 159 event.type = KEY_PRESS; 160 event.key = KC_E NTER;160 event.key = KC_ESCAPE; 161 161 event.mods = 0; 162 162 event.c = '\0'; … … 277 277 278 278 PCUT_ASSERT_FALSE(panel_is_active(panel)); 279 panel_activate(panel); 279 rc = panel_activate(panel); 280 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 280 281 PCUT_ASSERT_TRUE(panel_is_active(panel)); 281 282 … … 429 430 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 430 431 431 PCUT_ASSERT_INT_EQUALS( 1, list_count(&panel->entries));432 PCUT_ASSERT_INT_EQUALS(2, list_count(&panel->entries)); 432 433 433 434 entry = panel_first(panel); 434 435 PCUT_ASSERT_NOT_NULL(entry); 436 PCUT_ASSERT_STR_EQUALS("..", entry->name); 437 438 entry = panel_next(entry); 439 PCUT_ASSERT_NOT_NULL(entry); 435 440 PCUT_ASSERT_STR_EQUALS("a", entry->name); 436 //PCUT_ASSERT_INT_EQUALS(1, entry->size);441 PCUT_ASSERT_INT_EQUALS(1, entry->size); 437 442 438 443 panel_destroy(panel); … … 1136 1141 } 1137 1142 1143 /** panel_open() opens a directory entry */ 1144 PCUT_TEST(open) 1145 { 1146 ui_t *ui; 1147 ui_window_t *window; 1148 ui_wnd_params_t params; 1149 panel_t *panel; 1150 panel_entry_t *entry; 1151 char buf[L_tmpnam]; 1152 char *sdname; 1153 char *p; 1154 errno_t rc; 1155 int rv; 1156 1157 rc = ui_create_disp(NULL, &ui); 1158 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1159 1160 ui_wnd_params_init(¶ms); 1161 params.caption = "Test"; 1162 1163 rc = ui_window_create(ui, ¶ms, &window); 1164 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1165 1166 /* Create name for temporary directory */ 1167 p = tmpnam(buf); 1168 PCUT_ASSERT_NOT_NULL(p); 1169 1170 /* Create temporary directory */ 1171 rc = vfs_link_path(p, KIND_DIRECTORY, NULL); 1172 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1173 1174 rv = asprintf(&sdname, "%s/%s", p, "a"); 1175 PCUT_ASSERT_TRUE(rv >= 0); 1176 1177 /* Create sub-directory */ 1178 rc = vfs_link_path(sdname, KIND_DIRECTORY, NULL); 1179 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1180 1181 rc = panel_create(window, true, &panel); 1182 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1183 1184 rc = panel_read_dir(panel, p); 1185 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1186 PCUT_ASSERT_STR_EQUALS(p, panel->dir); 1187 1188 PCUT_ASSERT_INT_EQUALS(2, list_count(&panel->entries)); 1189 1190 entry = panel_first(panel); 1191 PCUT_ASSERT_NOT_NULL(entry); 1192 PCUT_ASSERT_STR_EQUALS("..", entry->name); 1193 1194 entry = panel_next(entry); 1195 PCUT_ASSERT_NOT_NULL(entry); 1196 PCUT_ASSERT_STR_EQUALS("a", entry->name); 1197 PCUT_ASSERT_TRUE(entry->isdir); 1198 1199 rc = panel_open(panel, entry); 1200 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 1201 1202 PCUT_ASSERT_STR_EQUALS(sdname, panel->dir); 1203 1204 panel_destroy(panel); 1205 ui_window_destroy(window); 1206 ui_destroy(ui); 1207 1208 rv = remove(sdname); 1209 PCUT_ASSERT_INT_EQUALS(0, rv); 1210 1211 rv = remove(p); 1212 PCUT_ASSERT_INT_EQUALS(0, rv); 1213 1214 free(sdname); 1215 } 1216 1138 1217 PCUT_EXPORT(panel);
Note:
See TracChangeset
for help on using the changeset viewer.