Back to index

dbus-test-runner  12.10.0
task.h
Go to the documentation of this file.
00001 /*
00002 Copyright 2012 Canonical Ltd.
00003 
00004 Authors:
00005     Ted Gould <ted@canonical.com>
00006 
00007 This program is free software: you can redistribute it and/or modify it 
00008 under the terms of the GNU General Public License version 3, as published 
00009 by the Free Software Foundation.
00010 
00011 This program is distributed in the hope that it will be useful, but 
00012 WITHOUT ANY WARRANTY; without even the implied warranties of 
00013 MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
00014 PURPOSE.  See the GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License along 
00017 with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 */
00019 
00020 #ifndef __DBUS_TEST_TASK_H__
00021 #define __DBUS_TEST_TASK_H__
00022 
00023 #ifndef __DBUS_TEST_TOP_LEVEL__
00024 #error "Please include #include <libdbustest/dbus-test.h> only"
00025 #endif
00026 
00027 #include <glib.h>
00028 #include <glib-object.h>
00029 
00030 G_BEGIN_DECLS
00031 
00032 #define DBUS_TEST_TASK_SIGNAL_STATE_CHANGED  "state-changed"
00033 
00034 #define DBUS_TEST_TYPE_TASK            (dbus_test_task_get_type ())
00035 #define DBUS_TEST_TASK(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), DBUS_TEST_TYPE_TASK, DbusTestTask))
00036 #define DBUS_TEST_TASK_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), DBUS_TEST_TYPE_TASK, DbusTestTaskClass))
00037 #define DBUS_TEST_IS_TASK(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DBUS_TEST_TYPE_TASK))
00038 #define DBUS_TEST_IS_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DBUS_TEST_TYPE_TASK))
00039 #define DBUS_TEST_TASK_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), DBUS_TEST_TYPE_TASK, DbusTestTaskClass))
00040 
00041 typedef struct _DbusTestTask        DbusTestTask;
00042 typedef struct _DbusTestTaskClass   DbusTestTaskClass;
00043 typedef struct _DbusTestTaskPrivate DbusTestTaskPrivate;
00044 
00045 typedef enum
00046 {
00047        DBUS_TEST_TASK_STATE_INIT,
00048        DBUS_TEST_TASK_STATE_WAITING,
00049        DBUS_TEST_TASK_STATE_RUNNING,
00050        DBUS_TEST_TASK_STATE_FINISHED
00051 } DbusTestTaskState;
00052 
00053 typedef enum
00054 {
00055        DBUS_TEST_TASK_RETURN_NORMAL,
00056        DBUS_TEST_TASK_RETURN_IGNORE,
00057        DBUS_TEST_TASK_RETURN_INVERT
00058 } DbusTestTaskReturn;
00059 
00060 struct _DbusTestTaskClass {
00061        GObjectClass parent_class;
00062 
00063        /* Subclassable functions */
00064        void               (*run)         (DbusTestTask * task);
00065        DbusTestTaskState  (*get_state)   (DbusTestTask * task);
00066        gboolean           (*get_passed)  (DbusTestTask * task);
00067 
00068        /* Signals */
00069        void               (*state_changed) (DbusTestTask * task, DbusTestTaskState new_state, gpointer user_data);
00070 };
00071 
00072 struct _DbusTestTask {
00073        GObject parent;
00074        DbusTestTaskPrivate * priv;
00075 };
00076 
00077 GType dbus_test_task_get_type (void);
00078 DbusTestTask * dbus_test_task_new (void);
00079 
00080 void dbus_test_task_set_name (DbusTestTask * task, const gchar * name);
00081 void dbus_test_task_set_name_spacing (DbusTestTask * task, glong chars);
00082 void dbus_test_task_set_wait_for (DbusTestTask * task, const gchar * dbus_name);
00083 void dbus_test_task_set_return (DbusTestTask * task, DbusTestTaskReturn ret);
00084 
00085 void dbus_test_task_print (DbusTestTask * task, const gchar * message);
00086 
00087 DbusTestTaskState dbus_test_task_get_state (DbusTestTask * task);
00088 DbusTestTaskReturn dbus_test_task_get_return (DbusTestTask * task);
00089 const gchar * dbus_test_task_get_name (DbusTestTask * task);
00090 const gchar * dbus_test_task_get_wait_for (DbusTestTask * task);
00091 
00092 void dbus_test_task_run (DbusTestTask * task);
00093 
00094 gboolean dbus_test_task_passed (DbusTestTask * task);
00095 
00096 G_END_DECLS
00097 
00098 #endif