ocarina/tests/gui/collection.c

40 lines
1001 B
C

/*
* Copyright 2015 (c) Anna Schumaker.
*/
#define TEST_NEED_AUDIO
#include <gui/builder.h>
#include <gui/collection.h>
#include <tests/gui.h>
#include <tests/test.h>
static void test_collection_sidebar()
{
GtkTreeSelection *selection;
GtkTreeView *treeview;
GtkTreeModel *model;
GtkTreePath *path;
GtkTreeIter iter;
int argc = 0;
gtk_init(&argc, NULL);
gui_builder_init("share/ocarina/ocarina6.glade");
gui_collection_init();
treeview = GTK_TREE_VIEW(gui_builder_widget("o_collection_view"));
selection = gtk_tree_view_get_selection(treeview);
model = GTK_TREE_MODEL(gui_builder_object("o_collection_store"));
test_equal(gtk_tree_model_get_iter_first(model, &iter), true);
path = gtk_tree_model_get_path(model, &iter);
gtk_tree_view_set_cursor(treeview, path, NULL, false);
gtk_tree_path_free(path);
test_equal(gtk_tree_selection_count_selected_rows(selection), 0);
gui_builder_deinit();
}
DECLARE_UNIT_TESTS(
UNIT_TEST("Collection Sidebar", test_collection_sidebar),
);