gpointing-device-settings r241 - trunk/test



Author: hiikezoe
Date: Wed Mar 18 11:43:53 2009
New Revision: 241
URL: http://svn.gnome.org/viewvc/gpointing-device-settings?rev=241&view=rev

Log:
check xinput values.

Modified:
   trunk/test/test-ui.c

Modified: trunk/test/test-ui.c
==============================================================================
--- trunk/test/test-ui.c	(original)
+++ trunk/test/test-ui.c	Wed Mar 18 11:43:53 2009
@@ -12,6 +12,7 @@
 void test_get_icon_pixbuf (void);
 void test_create_window (void);
 void test_wheel_emulation (void);
+void test_wheel_emulation_timeout (void);
 
 static GError *error;
 static GpdsUI *ui;
@@ -175,6 +176,44 @@
     return values[0] != 0;
 }
 
+static gint
+get_int_property_of_xinput (const gchar *property_name)
+{
+    gulong n_values;
+
+    xinput = gpds_xinput_new(DEVICE_NAME);
+    gpds_xinput_get_int_properties_by_name(xinput,
+                                   property_name,
+                                   &error,
+                                   &values, &n_values);
+    gcut_assert_error(error);
+
+    return values[0];
+}
+
+static gboolean
+cb_idle (gpointer data)
+{
+    gboolean *idle_received = data;
+
+    *idle_received = TRUE;
+
+    return FALSE;
+}
+
+static void
+wait_action (void)
+{
+    guint idle_id;
+    gboolean idle_received = FALSE;
+
+    idle_id = g_idle_add_full(G_PRIORITY_LOW,
+                              cb_idle,
+                              &idle_received, NULL);
+    while (!idle_received)
+        g_main_context_iteration(NULL, FALSE);
+}
+
 void
 test_wheel_emulation (void)
 {
@@ -190,6 +229,33 @@
     current_value = get_boolean_property_of_xinput("Evdev Wheel Emulation");
     active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button));
     cut_assert_equal_int(current_value, active);
+
+    gtk_test_widget_click(button, 1, 0);
+    wait_action();
+    current_value = get_boolean_property_of_xinput("Evdev Wheel Emulation");
+    cut_assert_equal_int(current_value, !active);
+}
+
+void
+test_wheel_emulation_timeout (void)
+{
+    GtkWidget *button;
+    gint widget_value;
+    gint xinput_value;
+
+    cut_trace(test_create_window());
+
+    button = get_widget("wheel_emulation_timeout");
+    cut_assert_true(GTK_IS_SPIN_BUTTON(button));
+
+    xinput_value = get_int_property_of_xinput("Evdev Wheel Emulation Timeout");
+    widget_value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(button));
+    cut_assert_equal_int(xinput_value, widget_value);
+
+    gtk_test_spin_button_click(GTK_SPIN_BUTTON(button), 1, FALSE);
+    wait_action();
+    xinput_value = get_int_property_of_xinput("Evdev Wheel Emulation Timeout");
+    /* cut_assert_equal_int(xinput_value, widget_value + 50);*/
 }
 
 /*



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]