aboutsummaryrefslogtreecommitdiffstats
path: root/tests/interactive
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-10-27 23:22:55 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-10-29 17:38:31 +0800
commit4c2eb652ef61dd0f5ccac27e47f261417793aa73 (patch)
tree1883254e26335fdd02a70f3e18c120db4ea7fc5b /tests/interactive
parentfb12577193262ad17ef2fc49d2324a7b23458610 (diff)
downloadgsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.tar
gsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.tar.gz
gsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.tar.bz2
gsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.tar.lz
gsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.tar.xz
gsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.tar.zst
gsoc2013-empathy-4c2eb652ef61dd0f5ccac27e47f261417793aa73.zip
move test app needing user interaction to interactive/
tests/ should be used only for automatic unit tests.
Diffstat (limited to 'tests/interactive')
-rw-r--r--tests/interactive/.gitignore8
-rw-r--r--tests/interactive/Makefile.am35
-rw-r--r--tests/interactive/contact-manager.c44
-rw-r--r--tests/interactive/empetit.c88
-rw-r--r--tests/interactive/test-empathy-account-assistant.c25
-rw-r--r--tests/interactive/test-empathy-presence-chooser.c56
-rw-r--r--tests/interactive/test-empathy-protocol-chooser.c31
-rw-r--r--tests/interactive/test-empathy-status-preset-dialog.c49
8 files changed, 336 insertions, 0 deletions
diff --git a/tests/interactive/.gitignore b/tests/interactive/.gitignore
new file mode 100644
index 000000000..f5c45764e
--- /dev/null
+++ b/tests/interactive/.gitignore
@@ -0,0 +1,8 @@
+contact-manager
+contact-run-until-ready
+contact-run-until-ready-2
+empetit
+test-empathy-account-assistant
+test-empathy-presence-chooser
+test-empathy-status-preset-dialog
+test-empathy-protocol-chooser
diff --git a/tests/interactive/Makefile.am b/tests/interactive/Makefile.am
new file mode 100644
index 000000000..a66f518e9
--- /dev/null
+++ b/tests/interactive/Makefile.am
@@ -0,0 +1,35 @@
+AM_CPPFLAGS = \
+ $(ERROR_CFLAGS) \
+ -I$(top_srcdir) \
+ -DPKGDATADIR=\""$(pkgdatadir)"\" \
+ $(EMPATHY_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(DISABLE_DEPRECATED)
+
+LDADD = \
+ $(top_builddir)/libempathy-gtk/libempathy-gtk.la \
+ $(top_builddir)/libempathy/libempathy.la \
+ $(EMPATHY_LIBS)
+
+noinst_PROGRAMS = \
+ contact-manager \
+ empetit \
+ test-empathy-account-assistant \
+ test-empathy-presence-chooser \
+ test-empathy-status-preset-dialog \
+ test-empathy-protocol-chooser
+
+contact_manager_SOURCES = contact-manager.c
+empetit_SOURCES = empetit.c
+test_empathy_presence_chooser_SOURCES = test-empathy-presence-chooser.c
+test_empathy_status_preset_dialog_SOURCES = test-empathy-status-preset-dialog.c
+test_empathy_protocol_chooser_SOURCES = test-empathy-protocol-chooser.c
+test_empathy_account_assistant_SOURCES = test-empathy-account-assistant.c
+
+test_empathy_account_assistant_CFLAGS = -I$(top_srcdir)/src
+test_empathy_account_assistant_LDADD = \
+ $(top_builddir)/src/empathy-account-assistant.o \
+ $(top_builddir)/src/empathy-import-utils.o \
+ $(top_builddir)/src/empathy-import-pidgin.o \
+ $(top_builddir)/src/empathy-import-widget.o \
+ $(LDADD)
diff --git a/tests/interactive/contact-manager.c b/tests/interactive/contact-manager.c
new file mode 100644
index 000000000..7793b44d9
--- /dev/null
+++ b/tests/interactive/contact-manager.c
@@ -0,0 +1,44 @@
+#include <stdlib.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-debug.h>
+
+#include <libempathy-gtk/empathy-contact-list-store.h>
+#include <libempathy-gtk/empathy-ui-utils.h>
+
+int
+main (int argc, char **argv)
+{
+ EmpathyContactManager *manager;
+ GMainLoop *main_loop;
+ EmpathyContactListStore *store;
+ GtkWidget *combo;
+ GtkWidget *window;
+ GtkCellRenderer *renderer;
+
+ gtk_init (&argc, &argv);
+ empathy_gtk_init ();
+
+ empathy_debug_set_flags (g_getenv ("EMPATHY_DEBUG"));
+ main_loop = g_main_loop_new (NULL, FALSE);
+ manager = empathy_contact_manager_dup_singleton ();
+ store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (manager));
+ empathy_contact_list_store_set_is_compact (store, TRUE);
+ empathy_contact_list_store_set_show_groups (store, FALSE);
+ combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (store));
+ renderer = gtk_cell_renderer_text_new ();
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE);
+ gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combo), renderer, "text", EMPATHY_CONTACT_LIST_STORE_COL_NAME);
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_container_add (GTK_CONTAINER (window), combo);
+ gtk_widget_show (combo);
+ gtk_widget_show (window);
+ g_object_unref (manager);
+
+ gtk_main ();
+
+ return EXIT_SUCCESS;
+}
+
diff --git a/tests/interactive/empetit.c b/tests/interactive/empetit.c
new file mode 100644
index 000000000..e2eb61f66
--- /dev/null
+++ b/tests/interactive/empetit.c
@@ -0,0 +1,88 @@
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-contact-manager.h>
+#include <libempathy/empathy-dispatcher.h>
+
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-contact-list-store.h>
+#include <libempathy-gtk/empathy-contact-selector.h>
+
+static GtkWidget *window = NULL;
+
+static void
+chat_cb (EmpathyDispatchOperation *dispatch,
+ const GError *error,
+ gpointer user_data)
+{
+ GtkWidget *dialog;
+
+ if (error != NULL)
+ {
+ dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s",
+ error->message ? error->message : "No error message");
+
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ }
+
+ gtk_widget_destroy (window);
+}
+
+static void
+clicked_cb (GtkButton *button,
+ gpointer data)
+{
+ EmpathyContactSelector *selector = EMPATHY_CONTACT_SELECTOR (data);
+ EmpathyContact *contact;
+
+ contact = empathy_contact_selector_dup_selected (selector);
+
+ if (!contact)
+ return;
+
+ empathy_dispatcher_chat_with_contact (contact, chat_cb, NULL);
+
+ g_object_unref (contact);
+}
+
+int main (int argc,
+ char *argv[])
+{
+ EmpathyContactManager *manager;
+ GtkWidget *vbox, *button, *selector;
+
+ gtk_init (&argc, &argv);
+
+ empathy_gtk_init ();
+
+ manager = empathy_contact_manager_dup_singleton ();
+ selector = empathy_contact_selector_new (EMPATHY_CONTACT_LIST (manager));
+
+ empathy_contact_selector_set_visible (EMPATHY_CONTACT_SELECTOR (selector),
+ (EmpathyContactSelectorFilterFunc) empathy_contact_can_send_files, NULL);
+
+ vbox = gtk_vbox_new (FALSE, 2);
+
+ gtk_box_pack_start (GTK_BOX (vbox), selector, FALSE, FALSE, 5);
+
+ button = gtk_button_new_with_label ("Chat");
+ g_signal_connect (G_OBJECT (button), "clicked",
+ G_CALLBACK (clicked_cb), (gpointer) selector);
+ gtk_box_pack_start(GTK_BOX (vbox), button, FALSE, FALSE, 5);
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ g_signal_connect (G_OBJECT (window), "destroy",
+ gtk_main_quit, NULL);
+ gtk_window_set_title (GTK_WINDOW (window),"Empetit");
+ gtk_container_set_border_width (GTK_CONTAINER (window), 5);
+ gtk_container_add (GTK_CONTAINER (window), vbox);
+ gtk_widget_show_all (window);
+
+ gtk_main ();
+
+ g_object_unref (manager);
+
+ return 0;
+}
diff --git a/tests/interactive/test-empathy-account-assistant.c b/tests/interactive/test-empathy-account-assistant.c
new file mode 100644
index 000000000..4f1c9a49b
--- /dev/null
+++ b/tests/interactive/test-empathy-account-assistant.c
@@ -0,0 +1,25 @@
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include "empathy-account-assistant.h"
+
+int main (int argc, char **argv)
+{
+ GtkWidget *assistant;
+
+ gtk_init (&argc, &argv);
+ empathy_gtk_init ();
+
+ assistant = empathy_account_assistant_show (NULL);
+
+ gtk_widget_show_all (assistant);
+
+ g_signal_connect_swapped (assistant, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/tests/interactive/test-empathy-presence-chooser.c b/tests/interactive/test-empathy-presence-chooser.c
new file mode 100644
index 000000000..12d35b4c6
--- /dev/null
+++ b/tests/interactive/test-empathy-presence-chooser.c
@@ -0,0 +1,56 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Davyd Madeley <davyd.madeley@collabora.co.uk>
+ */
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-status-presets.h>
+
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-presence-chooser.h>
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *window;
+ GtkWidget *chooser;
+
+ gtk_init (&argc, &argv);
+ empathy_gtk_init ();
+
+ empathy_status_presets_get_all ();
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ chooser = empathy_presence_chooser_new ();
+ gtk_container_add (GTK_CONTAINER (window), chooser);
+
+ gtk_window_set_default_size (GTK_WINDOW (window), 150, -1);
+ gtk_widget_show_all (window);
+
+ g_signal_connect_swapped (window, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/tests/interactive/test-empathy-protocol-chooser.c b/tests/interactive/test-empathy-protocol-chooser.c
new file mode 100644
index 000000000..90b1797a3
--- /dev/null
+++ b/tests/interactive/test-empathy-protocol-chooser.c
@@ -0,0 +1,31 @@
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-protocol-chooser.h>
+
+int
+main (int argc,
+ char **argv)
+{
+ GtkWidget *window, *c;
+
+ gtk_init (&argc, &argv);
+ empathy_gtk_init ();
+
+ window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ c = empathy_protocol_chooser_new ();
+
+ gtk_container_add (GTK_CONTAINER (window), c);
+
+ /* gtk_window_set_default_size (GTK_WINDOW (window), 150, -1);*/
+ gtk_widget_show_all (window);
+
+ g_signal_connect_swapped (window, "destroy",
+ G_CALLBACK (gtk_main_quit), NULL);
+
+ gtk_main ();
+
+ return 0;
+}
diff --git a/tests/interactive/test-empathy-status-preset-dialog.c b/tests/interactive/test-empathy-status-preset-dialog.c
new file mode 100644
index 000000000..6602e4f28
--- /dev/null
+++ b/tests/interactive/test-empathy-status-preset-dialog.c
@@ -0,0 +1,49 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2009 Collabora Ltd.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Authors: Davyd Madeley <davyd.madeley@collabora.co.uk>
+ */
+
+#include <config.h>
+
+#include <gtk/gtk.h>
+
+#include <libempathy/empathy-status-presets.h>
+
+#include <libempathy-gtk/empathy-ui-utils.h>
+#include <libempathy-gtk/empathy-status-preset-dialog.h>
+
+int
+main (int argc, char **argv)
+{
+ GtkWidget *dialog;
+
+ gtk_init (&argc, &argv);
+ empathy_gtk_init ();
+
+ empathy_status_presets_get_all ();
+
+ dialog = empathy_status_preset_dialog_new (NULL);
+
+ gtk_widget_show (dialog);
+
+ gtk_main ();
+
+ return 0;
+}