From 13fd7c6e7182b3142c6951098dcd2172c9ddf4ca Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 14 Jun 2010 14:09:09 -0500 Subject: Add a test to set the shortcut on a menuitem --- tests/test-gtk-objects.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'tests/test-gtk-objects.c') diff --git a/tests/test-gtk-objects.c b/tests/test-gtk-objects.c index c9f9c4c..92f2469 100644 --- a/tests/test-gtk-objects.c +++ b/tests/test-gtk-objects.c @@ -21,6 +21,7 @@ with this program. If not, see . #include #include +#include #define TEST_IMAGE SRCDIR "/" "test-gtk-objects.jpg" @@ -84,12 +85,41 @@ test_object_prop_pixbuf (void) return; } +/* Setting and getting a shortcut */ +static void +test_object_prop_shortcut (void) +{ + /* Build a menu item */ + DbusmenuMenuitem * item = dbusmenu_menuitem_new(); + + /* Test to make sure it's a happy object */ + g_assert(item != NULL); + g_assert(G_IS_OBJECT(item)); + g_assert(DBUSMENU_IS_MENUITEM(item)); + + guint key = GDK_c; + GdkModifierType modifier = GDK_CONTROL_MASK; + + /* Set a shortcut */ + gboolean success = dbusmenu_menuitem_property_set_shortcut(item, key, modifier); + g_assert(success); + + /* Check for value */ + const GValue * val = dbusmenu_menuitem_property_get_value(item, DBUSMENU_MENUITEM_PROP_SHORTCUT); + g_assert(val != NULL); + + g_object_unref(item); + + return; +} + /* Build the test suite */ static void test_gtk_objects_suite (void) { g_test_add_func ("/dbusmenu/gtk/objects/menuitem/base", test_object_menuitem); g_test_add_func ("/dbusmenu/gtk/objects/menuitem/prop_pixbuf", test_object_prop_pixbuf); + g_test_add_func ("/dbusmenu/gtk/objects/menuitem/prop_shortcut", test_object_prop_shortcut); return; } -- cgit v1.2.3