aboutsummaryrefslogtreecommitdiff
path: root/tests/test-gtk-objects.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-14 14:09:09 -0500
committerTed Gould <ted@gould.cx>2010-06-14 14:09:09 -0500
commit13fd7c6e7182b3142c6951098dcd2172c9ddf4ca (patch)
treea1d1d9c8afe3b42ed857b85a20639ca1c0682dbc /tests/test-gtk-objects.c
parentecf64a2f000ee9666a263afe23075d36bf2efe9a (diff)
downloadlibdbusmenu-13fd7c6e7182b3142c6951098dcd2172c9ddf4ca.tar.gz
libdbusmenu-13fd7c6e7182b3142c6951098dcd2172c9ddf4ca.tar.bz2
libdbusmenu-13fd7c6e7182b3142c6951098dcd2172c9ddf4ca.zip
Add a test to set the shortcut on a menuitem
Diffstat (limited to 'tests/test-gtk-objects.c')
-rw-r--r--tests/test-gtk-objects.c30
1 files changed, 30 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
#include <libdbusmenu-glib/menuitem.h>
#include <libdbusmenu-gtk/menuitem.h>
+#include <gdk/gdkkeysyms.h>
#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;
}