/* * Copyright 2014 (c) Anna Schumaker. */ #include #include #include #include #include #include #include void test_colmgr() { Library *library; unsigned int count; Gtk::TreePath path; Gtk::TreeModel::Row row; Glib::RefPtr list; list = lib :: get_object("o_collection_list"); test_equal((size_t)list->children().size(), (size_t)0); colmgr :: init(); test_equal((size_t)list->children().size(), (size_t)1); colmgr :: add_path("/tmp/ocarina/"); test_equal((size_t)list->children().size(), (size_t)2); while (idle :: run_task()) colmgr :: update_paths(); row = *list->children().end(); row--; row->get_value(2, count); test_equal(count, (unsigned)28); path = Gtk::TreePath(row); test_equal(colmgr :: get_path(path), Glib::ustring("/tmp/ocarina/")); library = tagdb :: lookup_library(1); test_equal(library->enabled, true); colmgr :: toggle_path_enabled(path); test_equal(library->enabled, false); colmgr :: del_path(path); test_equal((size_t)list->children().size(), (size_t)1); } int main(int argc, char **argv) { Gtk::Main ocarina(&argc, &argv); test :: cp_data_dir(); lib :: init(&argc, &argv, "ocarina6.glade"); run_test("Collection Manager Test", test_colmgr); return 0; }