[gnome-power-manager] Remove some unused self test code
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-power-manager] Remove some unused self test code
- Date: Mon, 11 May 2009 07:42:21 -0400 (EDT)
commit 986ec1457ff7498ab613e88da25d32e9aa05610b
Author: Richard Hughes <richard hughsie com>
Date: Mon May 11 12:41:29 2009 +0100
Remove some unused self test code
---
Makefile.am | 4 -
configure.ac | 1 -
data/Makefile.am | 1 -
data/gpm-inhibit-test.ui | 212 -----------------------------------------
po/POTFILES.in | 3 -
test/.gitignore | 5 -
test/Makefile.am | 46 ---------
test/gpm-inhibit-test.c | 212 -----------------------------------------
test/gpm-st-hal-device.c | 136 --------------------------
test/gpm-st-hal-devicestore.c | 143 ---------------------------
test/gpm-st-hal-manager.c | 71 --------------
test/gpm-st-proxy.c | 81 ----------------
12 files changed, 0 insertions(+), 915 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b73e2bf..e7556a6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -15,10 +15,6 @@ if HAVE_APPLETS
SUBDIRS += applets
endif
-if HAVE_TESTS
-SUBDIRS += test
-endif
-
EXTRA_DIST = \
HACKING \
MAINTAINERS \
diff --git a/configure.ac b/configure.ac
index da81b6b..072918c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -629,7 +629,6 @@ man/Makefile
help/Makefile
po/Makefile.in
tools/Makefile
-test/Makefile
data/Makefile
data/gnome-power-manager.desktop.in
data/gnome-power-preferences.desktop.in
diff --git a/data/Makefile.am b/data/Makefile.am
index 9ca0c8a..1a76ac8 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -26,7 +26,6 @@ $(service_DATA): $(service_in_files) Makefile
pkgdata_DATA = \
gpm-statistics.ui \
gpm-feedback-widget.ui \
- gpm-inhibit-test.ui \
gpm-prefs.ui
EXTRA_DIST = \
diff --git a/data/gpm-inhibit-test.ui b/data/gpm-inhibit-test.ui
deleted file mode 100644
index 022592f..0000000
--- a/data/gpm-inhibit-test.ui
+++ /dev/null
@@ -1,212 +0,0 @@
-<?xml version="1.0"?>
-<interface>
- <requires lib="gtk+" version="2.16"/>
- <!-- interface-naming-policy toplevel-contextual -->
- <object class="GtkDialog" id="dialog_inhibit">
- <property name="border_width">5</property>
- <property name="title" translatable="yes">Inhibit Tester</property>
- <property name="resizable">False</property>
- <property name="window_position">center-on-parent</property>
- <property name="type_hint">dialog</property>
- <property name="has_separator">False</property>
- <child internal-child="vbox">
- <object class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkTable" id="table_info">
- <property name="visible">True</property>
- <property name="border_width">6</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">5</property>
- <property name="row_spacing">5</property>
- <child>
- <object class="GtkEntry" id="entry_reason">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="text" translatable="yes">Burning DVD, titled "My Photos"</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="entry_app">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="text" translatable="yes">Vendor Acme Foo</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_reason">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Reason:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_app">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Application:</property>
- </object>
- <packing>
- <property name="x_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child internal-child="action_area">
- <object class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">end</property>
- <child>
- <object class="GtkButton" id="button_inhibit">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image1">
- <property name="visible">True</property>
- <property name="stock">gtk-connect</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Inhibit</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_uninhibit">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image2">
- <property name="visible">True</property>
- <property name="stock">gtk-disconnect</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">UnInhibit</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_close">
- <property name="label">gtk-close</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="0">button_inhibit</action-widget>
- <action-widget response="0">button_uninhibit</action-widget>
- <action-widget response="0">button_close</action-widget>
- </action-widgets>
- </object>
-</interface>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 21969d6..6064041 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -11,7 +11,6 @@ data/gnome-power-preferences.desktop.in.in
data/gnome-power-statistics.desktop.in.in
data/gpm-feedback-widget.ui
data/gpm-statistics.ui
-data/gpm-inhibit-test.ui
data/gpm-prefs.ui
src/gpm-backlight.c
src/gpm-brightness-kbd.c
@@ -38,5 +37,3 @@ src/gpm-statistics.c
src/gpm-tray-icon.c
applets/brightness/GNOME_BrightnessApplet.xml
applets/inhibit/GNOME_InhibitApplet.xml
-test/gpm-inhibit-test.c
-
diff --git a/test/.gitignore b/test/.gitignore
deleted file mode 100644
index 904492c..0000000
--- a/test/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-*.o
-.deps
-Makefile.in
-gnome-power-inhibit-test
-
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index b1833f4..0000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,46 +0,0 @@
-NULL =
-
-INCLUDES = \
- $(GLIB_CFLAGS) \
- $(HAL_CFLAGS) \
- $(DBUS_CFLAGS) \
- $(GNOME_CFLAGS) \
- $(GSTREAMER_CFLAGS) \
- $(GTKUNIQUE_CFLAGS) \
- -DBINDIR=\"$(bindir)\" \
- -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
- -DDATADIR=\"$(datadir)\" \
- -DPREFIX=\""$(prefix)"\" \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- -DLIBDIR=\""$(libdir)"\" \
- -DVERSION="\"$(VERSION)\"" \
- -DGPM_DATA=\""$(datadir)/gnome-power-manager/"\"\
- -I$(top_srcdir) \
- -I$(top_srcdir)/libhal-glib \
- -I$(top_srcdir)/libdbus-glib \
- $(NULL)
-
-noinst_PROGRAMS = \
- gnome-power-inhibit-test \
- $(NULL)
-
-gnome_power_inhibit_test_SOURCES = \
- gpm-inhibit-test.c \
- $(NULL)
-
-gnome_power_inhibit_test_LDADD = \
- $(GLIB_LIBS) \
- $(GNOME_LIBS) \
- $(DBUS_LIBS) \
- $(NULL)
-
-clean-local:
- rm -f *~
-
-CLEANFILES = $(BUILT_SOURCES)
-
-MAINTAINERCLEANFILES = \
- *~ \
- Makefile.in \
- $(NULL)
-
diff --git a/test/gpm-inhibit-test.c b/test/gpm-inhibit-test.c
deleted file mode 100644
index cc97351..0000000
--- a/test/gpm-inhibit-test.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2006-2007 Richard Hughes <richard hughsie com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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.
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <glade/glade.h>
-#include <dbus/dbus-glib.h>
-#include <gtk/gtk.h>
-
-#define GPM_DBUS_SERVICE "org.freedesktop.PowerManagement"
-#define GPM_DBUS_INHIBIT_PATH "/org/freedesktop/PowerManagement/Inhibit"
-#define GPM_DBUS_INHIBIT_INTERFACE "org.freedesktop.PowerManagement.Inhibit"
-
-/* imagine this in a GObject private struct... */
-guint appcookie = -1;
-
-/** cookie is returned as an unsigned integer */
-static guint
-dbus_inhibit_gpm (const gchar *appname,
- const gchar *reason)
-{
- gboolean res;
- guint cookie;
- GError *error = NULL;
- DBusGProxy *proxy = NULL;
- DBusGConnection *session_connection = NULL;
-
- /* get the DBUS session connection */
- session_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (error != NULL) {
- g_warning ("DBUS cannot connect : %s", error->message);
- g_error_free (error);
- return -1;
- }
-
- /* get the proxy with g-p-m */
- proxy = dbus_g_proxy_new_for_name (session_connection,
- GPM_DBUS_SERVICE,
- GPM_DBUS_INHIBIT_PATH,
- GPM_DBUS_INHIBIT_INTERFACE);
- if (proxy == NULL) {
- g_warning ("Could not get DBUS proxy: %s", GPM_DBUS_SERVICE);
- return -1;
- }
-
- res = dbus_g_proxy_call (proxy,
- "Inhibit", &error,
- G_TYPE_STRING, appname,
- G_TYPE_STRING, reason,
- G_TYPE_INVALID,
- G_TYPE_UINT, &cookie,
- G_TYPE_INVALID);
-
- /* check the return value */
- if (! res) {
- cookie = -1;
- g_warning ("Inhibit method failed");
- }
-
- /* check the error value */
- if (error != NULL) {
- g_warning ("Inhibit problem : %s", error->message);
- g_error_free (error);
- cookie = -1;
- }
-
- g_debug ("cookie = %u", cookie);
- g_object_unref (G_OBJECT (proxy));
- return cookie;
-}
-
-static void
-dbus_uninhibit_gpm (guint cookie)
-{
- gboolean res;
- GError *error = NULL;
- DBusGProxy *proxy = NULL;
- DBusGConnection *session_connection = NULL;
-
- /* cookies have to be positive as unsigned */
- if (cookie < 0) {
- g_warning ("Invalid cookie");
- return;
- }
-
- /* get the DBUS session connection */
- session_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
- if (error) {
- g_warning ("DBUS cannot connect : %s", error->message);
- g_error_free (error);
- return;
- }
-
- /* get the proxy with g-p-m */
- proxy = dbus_g_proxy_new_for_name (session_connection,
- GPM_DBUS_SERVICE,
- GPM_DBUS_INHIBIT_PATH,
- GPM_DBUS_INHIBIT_INTERFACE);
- if (proxy == NULL) {
- g_warning ("Could not get DBUS proxy: %s", GPM_DBUS_SERVICE);
- return;
- }
-
- res = dbus_g_proxy_call (proxy,
- "UnInhibit",
- &error,
- G_TYPE_UINT, cookie,
- G_TYPE_INVALID,
- G_TYPE_INVALID);
-
- /* check the return value */
- if (! res) {
- g_warning ("UnInhibit method failed");
- }
-
- /* check the error value */
- if (error != NULL) {
- g_warning ("Inhibit problem : %s", error->message);
- g_error_free (error);
- cookie = -1;
- }
- g_object_unref (G_OBJECT (proxy));
-}
-
-static void
-widget_inhibit_cb (GtkWidget *iwidget, GladeXML *glade_xml)
-{
- GtkWidget *widget;
- const gchar *appname;
- const gchar *reason;
-
- /* get the application name and the reason from the entry boxes */
- widget = glade_xml_get_widget (glade_xml, "entry_app");
- appname = gtk_entry_get_text (GTK_ENTRY (widget));
- widget = glade_xml_get_widget (glade_xml, "entry_reason");
- reason = gtk_entry_get_text (GTK_ENTRY (widget));
-
- /* try to add the inhibit */
- appcookie = dbus_inhibit_gpm (appname, reason);
- g_debug ("adding inhibit: %u", appcookie);
-}
-
-static void
-widget_uninhibit_cb (GtkWidget *widget, GladeXML *glade_xml)
-{
- /* try to remove the inhibit */
- g_debug ("removing inhibit: %u", appcookie);
- dbus_uninhibit_gpm (appcookie);
-}
-
-static void
-window_close_cb (GtkWidget *widget)
-{
- /* we don't have to UnInhibit as g-p-m notices we exit... */
- exit (0);
-}
-
-int
-main (int argc, char **argv)
-{
- GOptionContext *context;
- GMainLoop *loop = NULL;
- GtkWidget *widget = NULL;
- GladeXML *glade_xml = NULL;
-
- context = g_option_context_new (_("GNOME Power Preferences"));
- g_option_context_add_group (context, gtk_get_option_group (FALSE));
- g_option_context_parse (context, &argc, &argv, NULL);
- gtk_init (&argc, &argv);
-
- /* load the glade file, and setup the callbacks */
- glade_xml = glade_xml_new (GPM_DATA "/gpm-inhibit-test.glade", NULL, NULL);
- widget = glade_xml_get_widget (glade_xml, "button_close");
- g_signal_connect (widget, "clicked",
- G_CALLBACK (window_close_cb), glade_xml);
- widget = glade_xml_get_widget (glade_xml, "button_inhibit");
- g_signal_connect (widget, "clicked",
- G_CALLBACK (widget_inhibit_cb), glade_xml);
- widget = glade_xml_get_widget (glade_xml, "button_uninhibit");
- g_signal_connect (widget, "clicked",
- G_CALLBACK (widget_uninhibit_cb), glade_xml);
- widget = glade_xml_get_widget (glade_xml, "window_inhibit");
- g_signal_connect (widget, "destroy",
- G_CALLBACK (window_close_cb), glade_xml);
- gtk_widget_show (widget);
-
- /* main loop */
- loop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (loop);
- g_option_context_free (context);
- return 0;
-}
diff --git a/test/gpm-st-hal-device.c b/test/gpm-st-hal-device.c
deleted file mode 100644
index 8d98f1e..0000000
--- a/test/gpm-st-hal-device.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 Richard Hughes <richard hughsie com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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.
- */
-
-#include <glib.h>
-#include <string.h>
-#include "gpm-st-main.h"
-
-#include <hal-manager.h>
-#include <hal-device.h>
-
-void
-egg_test_hal_device (GpmSelfTest *test)
-{
- HalDevice *device;
- const char *udi;
- char *retstr;
- gboolean ret;
-
- if (egg_test_start (test, "HalDevice") == FALSE) {
- return;
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we get a non null device");
- device = hal_device_new ();
- if (device != NULL) {
- egg_test_success (test, "got HalDevice");
- } else {
- egg_test_failed (test, "could not get HalDevice");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we get a null UDI");
- udi = hal_device_get_udi (device);
- if (udi == NULL) {
- egg_test_success (test, "got NULL UDI");
- } else {
- egg_test_failed (test, "got non-null UDI: %s", udi);
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we can set a UDI");
- ret = hal_device_set_udi (device, HAL_ROOT_COMPUTER);
- if (ret) {
- egg_test_success (test, "set UDI");
- } else {
- egg_test_failed (test, "could not set UDI");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we can get the UDI");
- udi = hal_device_get_udi (device);
- if (udi && strcmp (udi, HAL_ROOT_COMPUTER) == 0) {
- egg_test_success (test, "got correct UDI: %s", udi);
- } else {
- egg_test_failed (test, "got incorrect UDI: %s", udi);
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we cannot set another UDI");
- ret = hal_device_set_udi (device, "foo");
- if (!ret) {
- egg_test_success (test, "Cannot set another UDI");
- } else {
- egg_test_failed (test, "Able to overwrite UDI");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we can get a string key");
- ret = hal_device_get_string (device, "info.product", &retstr, NULL);
- if (ret && retstr && strcmp (retstr, "Computer") == 0) {
- egg_test_success (test, "got correct key");
- } else {
- egg_test_failed (test, "got invalid key");
- }
- g_free (retstr);
-
- /************************************************************/
- egg_test_title (test, "try to get property modified events");
- ret = hal_device_watch_property_modified (device);
- if (ret) {
- egg_test_success (test, "got notification");
- } else {
- egg_test_failed (test, "could not get notification");
- }
-
- /************************************************************/
- egg_test_title (test, "try to get duplicate property modified events");
- ret = hal_device_watch_property_modified (device);
- if (!ret) {
- egg_test_success (test, "duplicate notification refused");
- } else {
- egg_test_failed (test, "got duplicate notification");
- }
-
- /************************************************************/
- egg_test_title (test, "try to cancel property modified events");
- ret = hal_device_remove_property_modified (device);
- if (ret) {
- egg_test_success (test, "cancel notification");
- } else {
- egg_test_failed (test, "could not cancel notification");
- }
-
- /************************************************************/
- egg_test_title (test, "try to get duplicate property modified cancel");
- ret = hal_device_remove_property_modified (device);
- if (!ret) {
- egg_test_success (test, "duplicate cancel refused");
- } else {
- egg_test_failed (test, "did duplicate cancel");
- }
-
- g_object_unref (device);
-
- egg_test_end (test);
-}
-
diff --git a/test/gpm-st-hal-devicestore.c b/test/gpm-st-hal-devicestore.c
deleted file mode 100644
index d885b4b..0000000
--- a/test/gpm-st-hal-devicestore.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 Richard Hughes <richard hughsie com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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.
- */
-
-#include <glib.h>
-#include "gpm-st-main.h"
-
-#include <hal-device.h>
-#include <hal-manager.h>
-#include <hal-device-store.h>
-
-void
-egg_test_hal_device_store (GpmSelfTest *test)
-{
- HalDeviceStore *device_store;
- HalDevice *device;
- HalDevice *device2;
- HalDevice *device3;
- gboolean ret;
-
- if (egg_test_start (test, "HalDeviceStore") == FALSE) {
- return;
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we get a non null device_store");
- device_store = hal_device_store_new ();
- if (device_store != NULL) {
- egg_test_success (test, "got HalDeviceStore");
- } else {
- egg_test_failed (test, "could not get HalDeviceStore");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure device not in device_store");
- device = hal_device_new ();
- hal_device_set_udi (device, HAL_ROOT_COMPUTER);
- ret = hal_device_store_present (device_store, device);
- if (!ret) {
- egg_test_success (test, "could not get different device");
- } else {
- egg_test_failed (test, "got computer in empty store");
- }
-
- /************************************************************/
- egg_test_title (test, "insert device");
- ret = hal_device_store_insert (device_store, device);
- if (ret) {
- egg_test_success (test, "inserted device");
- } else {
- egg_test_failed (test, "could not insert device");
- }
-
- /************************************************************/
- egg_test_title (test, "insert duplicate device");
- ret = hal_device_store_insert (device_store, device);
- if (!ret) {
- egg_test_success (test, "cannot insert duplicate device");
- } else {
- egg_test_failed (test, "inserted duplicate device");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure device in store");
- ret = hal_device_store_present (device_store, device);
- if (ret) {
- egg_test_success (test, "found device");
- } else {
- egg_test_failed (test, "could not find device");
- }
-
- /************************************************************/
- egg_test_title (test, "find device by UDI");
- device3 = hal_device_store_find_udi (device_store, HAL_ROOT_COMPUTER);
- if (device3 == device) {
- egg_test_success (test, "found device");
- } else {
- egg_test_failed (test, "could not find device");
- }
-
- /************************************************************/
- egg_test_title (test, "find missing device by UDI");
- device3 = hal_device_store_find_udi (device_store, "/foo");
- if (device3 == NULL) {
- egg_test_success (test, "not found invalid device");
- } else {
- egg_test_failed (test, "Found /foo device");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we can match on UDI");
- device2 = hal_device_new ();
- hal_device_set_udi (device2, HAL_ROOT_COMPUTER);
- ret = hal_device_store_present (device_store, device2);
- if (ret) {
- egg_test_success (test, "found device");
- } else {
- egg_test_failed (test, "could not find device");
- }
-
- /************************************************************/
- egg_test_title (test, "remove device");
- g_object_ref (device); /* so we can test it in a minute */
- ret = hal_device_store_remove (device_store, device);
- if (ret) {
- egg_test_success (test, "removed device");
- } else {
- egg_test_failed (test, "could not remove device");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure device not in device_store");
- ret = hal_device_store_present (device_store, device);
- if (!ret) {
- egg_test_success (test, "could not get device from empty device_store");
- } else {
- egg_test_failed (test, "got computer in empty store");
- }
-
- g_object_unref (device);
- g_object_unref (device2);
- g_object_unref (device_store);
-
- egg_test_end (test);
-}
-
diff --git a/test/gpm-st-hal-manager.c b/test/gpm-st-hal-manager.c
deleted file mode 100644
index 12927d7..0000000
--- a/test/gpm-st-hal-manager.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 Richard Hughes <richard hughsie com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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.
- */
-
-#include <glib.h>
-#include "gpm-st-main.h"
-
-#include <hal-manager.h>
-
-void
-egg_test_hal_manager (GpmSelfTest *test)
-{
- HalManager *manager;
- gboolean ret;
-
- if (egg_test_start (test, "HalManager") == FALSE) {
- return;
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we get a non null device");
- manager = hal_manager_new ();
- if (manager != NULL) {
- egg_test_success (test, "got HalManager");
- } else {
- egg_test_failed (test, "could not get HalManager");
- }
-
- /************************************************************/
- egg_test_title (test, "check if we are a laptop");
- ret = hal_manager_is_laptop (manager);
- if (ret) {
- egg_test_success (test, "identified as a laptop");
- } else {
- egg_test_failed (test, "not identified as a laptop");
- }
-
-
- /************************************************************/
- gchar **value;
- egg_test_title (test, "search for battery devices");
- ret = hal_manager_find_capability (manager, "battery", &value, NULL);
- if (ret && value != NULL && value[0] != NULL) {
- egg_test_success (test, "found battery device");
- } else {
- egg_test_failed (test, "did not find battery device");
- }
- g_strfreev (value);
-
- g_object_unref (manager);
-
- egg_test_end (test);
-}
-
diff --git a/test/gpm-st-proxy.c b/test/gpm-st-proxy.c
deleted file mode 100644
index b63a3b5..0000000
--- a/test/gpm-st-proxy.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
- *
- * Copyright (C) 2007 Richard Hughes <richard hughsie com>
- *
- * Licensed under the GNU General Public License Version 2
- *
- * 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.
- */
-
-#include <glib.h>
-#include <dbus/dbus-glib.h>
-#include <egg-dbus-proxy.h>
-#include "gpm-st-main.h"
-#include "../src/gpm-common.h"
-
-void
-egg_test_proxy (GpmSelfTest *test)
-{
- EggDbusProxy *gproxy = NULL;
- DBusGProxy *proxy = NULL;
- DBusGConnection *connection;
-
- if (egg_test_start (test, "EggDbusProxy") == FALSE) {
- return;
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we can get a new gproxy");
- gproxy = egg_dbus_proxy_new ();
- if (gproxy != NULL) {
- egg_test_success (test, "got gproxy");
- } else {
- egg_test_failed (test, "could not get gproxy");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure proxy if NULL when no assign");
- proxy = egg_dbus_proxy_get_proxy (gproxy);
- if (proxy == NULL) {
- egg_test_success (test, "got NULL proxy");
- } else {
- egg_test_failed (test, "did not get NULL proxy");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure we can assign and connect");
- connection = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
- proxy = egg_dbus_proxy_assign (gproxy, connection, GPM_DBUS_SERVICE,
- GPM_DBUS_PATH_INHIBIT, GPM_DBUS_INTERFACE_INHIBIT);
- if (proxy != NULL) {
- egg_test_success (test, "got proxy (init)");
- } else {
- egg_test_failed (test, "could not get proxy (init)");
- }
-
- /************************************************************/
- egg_test_title (test, "make sure proxy non NULL when assigned");
- proxy = egg_dbus_proxy_get_proxy (gproxy);
- if (proxy != NULL) {
- egg_test_success (test, "got valid proxy");
- } else {
- egg_test_failed (test, "did not get valid proxy");
- }
-
- g_object_unref (gproxy);
-
- egg_test_end (test);
-}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]