diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-12 21:13:45 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-12 21:13:45 +0300 |
| commit | 89727590e718d3628a0847689182e896df646b8a (patch) | |
| tree | 3106397d1b041d95ecfc04762548261f9d660d62 /tests/test_window.c | |
| parent | 198b0e8112905bc003f954fc9159cc3da2dfce09 (diff) | |
walkdir: navigator, shortcuts, window wiring, drop target, tests (ht0)
M2 (task ht0): walk the directory.
- src/navigator.{c,h}: GObject (no GtkWidget) holding the folder listing —
image-MIME filter + extension fallback, hide-RAW-sidecars (decision #33),
sort name/time/size, cursor + prev/next/wrap, path-based marks (survive
re-sort, pruned on rescan/monitor, cleared on remove), nearest-fallback,
GFileMonitor debounced 250ms (decision #28), 'changed' signal. 92% gcov.
- src/shortcuts.{c,h}: GtkShortcutController (MANAGED) binding h/l/Left/Right/
g/G/o/q to win.* actions; one table all milestones add to.
- src/window.{c,h}: open file->parent+current / folder->first; h/l/g/G actions
-> nav -> load -> viewer; single GCancellable last-write-wins (g_file_equal
guard for M3 async); header title 'filename · n/total'; GtkDropTarget
(GDK_TYPE_FILE_LIST, many->first, decision Z); GtkFileDialog open.
- data/gschema: add hide-raw-sidecars key.
- tests: unit test_navigator (12 subtests), integration test_walk_folder
(temp fixtures walk + ./sample-images skip-if-absent). 8/8 green; ASan clean
(GIO_USE_VFS=local in fixtures_env).
Fixed during this milestone: a UAF (borrowed c_name used after unref), a
cancellable double-ref leak, time::modified UINT64 vs INT64, and several
test-harness leaks. Sub-agent review issues addressed (mark pruning on
rescan/monitor, remove-before-cursor test, recursive temp-dir cleanup,
callback _cb naming, connect-before-mutate).
Diffstat (limited to 'tests/test_window.c')
| -rw-r--r-- | tests/test_window.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/test_window.c b/tests/test_window.c index 0f3fa74..63e54bb 100644 --- a/tests/test_window.c +++ b/tests/test_window.c @@ -50,15 +50,21 @@ test_stack_has_two_views(void) { static void test_open_titles_window(void) { - GgazeWindow *p_win = new_window(); - - GFile *p_file = g_file_new_for_path("/tmp/IMG_0001.jpg"); + const gchar *c_dir = g_getenv("GGAZE_FIXTURES_DIR"); + g_assert_nonnull(c_dir); + gchar *c_path = g_build_filename(c_dir, "plain.jpg", NULL); + GgazeWindow *p_win = new_window(); + GFile *p_file = g_file_new_for_path(c_path); ggaze_window_open(p_win, p_file); - - g_assert_cmpstr(gtk_window_get_title(GTK_WINDOW(p_win)), ==, "IMG_0001.jpg"); - + /* M2: opening a file lists its parent folder; the header title carries + * the current filename + "n/total". */ + const gchar *c_title = gtk_window_get_title(GTK_WINDOW(p_win)); + g_assert_nonnull(c_title); + g_assert_nonnull(g_strstr_len(c_title, -1, "plain.jpg")); + g_assert_nonnull(g_strstr_len(c_title, -1, "/")); g_object_unref(p_file); g_object_unref(p_win); + g_free(c_path); } int |
