summaryrefslogtreecommitdiff
path: root/test/display/test-sidebar.c
blob: ec436d3768c06bcd6ad88dedb202b1898df39c5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define G_LOG_DOMAIN "test-sidebar"

#include <nautilus-application.h>
#include <nautilus-file-utilities.h>
#include <nautilus-global-preferences.h>
#include <nautilus-resources.h>
#include <nautilus-sidebar.h>
#include <nautilus-tag-manager.h>

#include <test-utilities.h>

#include <glib.h>
#include <gtk/gtk.h>

static void
test_sidebar_set_location (void)
{
    g_autoptr (NautilusSidebar) sidebar = NAUTILUS_PLACES_SIDEBAR (nautilus_sidebar_new ());
    g_autoptr (GFile) home_location = g_file_new_for_path (g_get_home_dir ());

    /* Need to sink the object */
    g_object_ref_sink (sidebar);

    nautilus_sidebar_set_location (sidebar, home_location);

    g_autoptr (GFile) view_location = nautilus_sidebar_get_location (sidebar);

    /* Only locations on the sidebar will return non-null */
    g_assert_true (g_file_equal (view_location, home_location));
}

int
main (int   argc,
      char *argv[])
{
    g_autoptr (NautilusTagManager) tag_manager = NULL;

    gtk_test_init (&argc, &argv, G_TEST_OPTION_ISOLATE_DIRS, NULL);

    nautilus_register_resource ();
    nautilus_ensure_extension_points ();
    nautilus_global_preferences_init ();
    tag_manager = nautilus_tag_manager_new_dummy ();
    test_init_config_dir ();

    g_autoptr (NautilusApplication) app = nautilus_application_new ();

    g_test_add_func ("/sidebar/set_location",
                     test_sidebar_set_location);

    return g_test_run ();
}