55 lines
1.3 KiB
C
55 lines
1.3 KiB
C
/*
|
|
* Copyright 2015 (c) Anna Schumaker.
|
|
*/
|
|
#include <core/settings.h>
|
|
#include <gui/sidebar.h>
|
|
#include <tests/test.h>
|
|
|
|
static void test_sidebar()
|
|
{
|
|
g_assert_nonnull(gui_sidebar_store());
|
|
g_assert_true(GTK_IS_TREE_STORE(gui_sidebar_store()));
|
|
|
|
g_assert_nonnull(gui_sidebar_model());
|
|
g_assert_true(GTK_IS_TREE_MODEL(gui_sidebar_model()));
|
|
|
|
g_assert_nonnull(gui_sidebar_filter());
|
|
g_assert_true(GTK_IS_TREE_MODEL_FILTER(gui_sidebar_filter()));
|
|
|
|
g_assert_nonnull(gui_sidebar_treeview());
|
|
g_assert_true(GTK_IS_TREE_VIEW(gui_sidebar_treeview()));
|
|
}
|
|
|
|
static void test_sidebar_pos()
|
|
{
|
|
g_assert_false(settings_has("gui.sidebar.pos"));
|
|
|
|
gtk_paned_set_position(gui_sidebar(), 300);
|
|
g_assert_true(settings_has("gui.sidebar.pos"));
|
|
g_assert_cmpuint(settings_get("gui.sidebar.pos"), ==, 300);
|
|
|
|
settings_set("gui.sidebar.pos", 250);
|
|
gui_sidebar_init();
|
|
g_assert_cmpuint(settings_get("gui.sidebar.pos"), ==, 250);
|
|
g_assert_cmpuint(gtk_paned_get_position(gui_sidebar()), ==, 250);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
int ret;
|
|
|
|
gtk_init(&argc, NULL);
|
|
settings_init();
|
|
gui_builder_init("share/ocarina/ocarina.ui");
|
|
gui_sidebar_init();
|
|
|
|
g_test_init(&argc, &argv, NULL);
|
|
g_test_add_func("/Gui/Sidebar", test_sidebar);
|
|
g_test_add_func("/Gui/Sidebar/Pos", test_sidebar_pos);
|
|
ret = g_test_run();
|
|
|
|
gui_builder_deinit();
|
|
settings_deinit();
|
|
return ret;
|
|
}
|