summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog5
-rw-r--r--debian/compat1
-rw-r--r--debian/control43
-rw-r--r--debian/libdbus-qeventloop-dev.install1
-rw-r--r--debian/libdbus-qeventloop0.install1
-rw-r--r--debian/libresourceqt-dev.install1
-rw-r--r--debian/libresourceqt-tests.install2
-rw-r--r--debian/libresourceqt0.install1
-rwxr-xr-xdebian/rules105
-rw-r--r--libdbus-qeventloop/dbusconnectioneventloop.cpp259
-rw-r--r--libdbus-qeventloop/dbusconnectioneventloop.h62
-rw-r--r--libdbus-qeventloop/libdbus-qeventloop.pro29
-rw-r--r--project.pro11
-rw-r--r--tests/test-dbus-ping/test-dbus-ping.cpp36
-rw-r--r--tests/test-dbus-ping/test-dbus-ping.pro19
-rw-r--r--tests/test-dbus-pong/pong.h13
-rw-r--r--tests/test-dbus-pong/test-dbus-pong.cpp41
-rw-r--r--tests/test-dbus-pong/test-dbus-pong.pro20
-rw-r--r--tests/test-dbus-qeventloop/test-dbus-qeventloop.cpp20
-rw-r--r--tests/test-dbus-qeventloop/test-dbus-qeventloop.pro28
-rw-r--r--tests/test-resource/test-resource.pro4
-rw-r--r--tests/tests.pro18
-rw-r--r--tests/tests.xml36
23 files changed, 754 insertions, 2 deletions
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..5fc5a2e
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+libresourceqt (0.1) unstable; urgency=low
+
+ * First release
+
+ -- Martin Wolf <ext-martin.2.wolf@nokia.com> Fri, 29 Jan 2010 12:00:00 +0200
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..bf0d87a
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+4 \ No newline at end of file
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..dd27f2d
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,43 @@
+Source: libresourceqt
+Priority: extra
+Maintainer: Martin Wolf <ext-martin.2.wolf@nokia.com>
+Build-Depends: debhelper (>= 5), libqt4-dev (>= 4.5), libdbus-1-dev
+Standards-Version: 3.8.0
+Section: libs
+
+Package: libresourceqt-dev
+Section: libdevel
+Architecture: any
+Depends: libresourceqt0 (= ${binary:Version})
+Description: Development package for libresourceqt
+ Includes development files for libresourceqt.
+
+Package: libresourceqt0
+Section: libs
+Architecture: any
+Depends: libdbus-qeventloop0, ${shlibs:Depends}, ${misc:Depends}
+Description: libresourceqt library
+ Contains library files for the application that use libresourceqt
+
+Package: libdbus-qeventloop-dev
+Section: libdevel
+Architecture: any
+Depends: libdbus-qeventloop0 (= ${binary:Version})
+Description: Development package for libdbus-qeventloop
+ Includes development files for libdbus-qeventloop.
+
+Package: libdbus-qeventloop0
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: libdbus-qeventloop library
+ Contains library files for the application that use libdbus-qeventloop
+
+Package: libresourceqt-tests
+Section: misc
+Depends: testrunner, libresourceqt0, libdbus-qeventloop0, ${shlibs:Depends}
+XB-Maemo-CI-Packages: libresourceqt0, libdbus-qeventloop0
+XB-Maemo-CI-Stage: fast, staging, acceptance
+Architecture: any
+Description: libresourceqt0 and libdbus-qeventloop test package
+ This package contains tests which can be used in CI environment
diff --git a/debian/libdbus-qeventloop-dev.install b/debian/libdbus-qeventloop-dev.install
new file mode 100644
index 0000000..facc538
--- /dev/null
+++ b/debian/libdbus-qeventloop-dev.install
@@ -0,0 +1 @@
+usr/include/resource/qt4/dbus*
diff --git a/debian/libdbus-qeventloop0.install b/debian/libdbus-qeventloop0.install
new file mode 100644
index 0000000..f960cda
--- /dev/null
+++ b/debian/libdbus-qeventloop0.install
@@ -0,0 +1 @@
+usr/lib/libdbus-qeventloop*.so*
diff --git a/debian/libresourceqt-dev.install b/debian/libresourceqt-dev.install
new file mode 100644
index 0000000..1e9ea18
--- /dev/null
+++ b/debian/libresourceqt-dev.install
@@ -0,0 +1 @@
+usr/include/resource/qt4/resource* \ No newline at end of file
diff --git a/debian/libresourceqt-tests.install b/debian/libresourceqt-tests.install
new file mode 100644
index 0000000..2144fbf
--- /dev/null
+++ b/debian/libresourceqt-tests.install
@@ -0,0 +1,2 @@
+usr/lib/libresourceqt-tests/*
+usr/share/libresourceqt-tests/* \ No newline at end of file
diff --git a/debian/libresourceqt0.install b/debian/libresourceqt0.install
new file mode 100644
index 0000000..c09c3e8
--- /dev/null
+++ b/debian/libresourceqt0.install
@@ -0,0 +1 @@
+usr/lib/libresourceqt*.so*
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..aff3d26
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,105 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+# shared library versions, option 1
+version=2.0.5
+major=2
+# option 2, assuming the library is created as src/.libs/libfoo.so.2.0.5 or so
+#version=`ls src/build/lib*.so.* | \
+# awk '{if (match($$0,/[0-9]+\.[0-9]+\.[0-9]+$$/)) print substr($$0,RSTART)}'`
+#major=`ls src/build/lib*.so.* | \
+# awk '{if (match($$0,/\.so\.[0-9]+$$/)) print substr($$0,RSTART+4)}'`
+
+configure: configure-stamp
+configure-stamp:
+ dh_testdir
+
+ qmake
+
+ touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp configure-stamp
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) distclean
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp
+ INSTALL_ROOT=$(CURDIR)/debian/tmp make install
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs
+ dh_installdocs
+ dh_installexamples
+ dh_install --sourcedir=debian/tmp -v
+
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_python
+ dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure \ No newline at end of file
diff --git a/libdbus-qeventloop/dbusconnectioneventloop.cpp b/libdbus-qeventloop/dbusconnectioneventloop.cpp
new file mode 100644
index 0000000..16f4a24
--- /dev/null
+++ b/libdbus-qeventloop/dbusconnectioneventloop.cpp
@@ -0,0 +1,259 @@
+#include <QCoreApplication>
+#include <QSocketNotifier>
+#include <QTimer>
+#include <QTimerEvent>
+
+#include "dbusconnectioneventloop.h"
+#include <stdio.h>
+
+DBUSConnectionEventLoop::DBUSConnectionEventLoop() : QObject()
+{
+}
+
+DBUSConnectionEventLoop::~DBUSConnectionEventLoop()
+{
+}
+
+// Handle a socket being ready to read.
+void DBUSConnectionEventLoop::readSocket(int fd)
+{
+ Watchers::const_iterator it = watchers.find(fd);
+
+ while( it != watchers.end() && it.key() == fd )
+ {
+ const Watcher &watcher = it.value();
+
+ if( watcher.read && watcher.read->isEnabled() )
+ {
+ watcher.read->setEnabled(false);
+ dbus_watch_handle(watcher.watch, DBUS_WATCH_READABLE);
+ watcher.read->setEnabled(true);
+ break;
+ }
+
+ ++it;
+ }
+
+ dispatch();
+}
+
+// Handle a socket being ready to write.
+void DBUSConnectionEventLoop::writeSocket(int fd)
+{
+ Watchers::const_iterator it = watchers.find(fd);
+
+ while( it != watchers.end() && it.key() == fd )
+ {
+ const Watcher &watcher = it.value();
+
+ if( watcher.write && watcher.write->isEnabled() )
+ {
+ watcher.write->setEnabled(false);
+ dbus_watch_handle(watcher.watch, DBUS_WATCH_WRITABLE);
+ watcher.write->setEnabled(true);
+ break;
+ }
+
+ ++it;
+ }
+}
+
+void DBUSConnectionEventLoop::dispatch()
+{
+ for( Connections::const_iterator it = connections.constBegin(); it != connections.constEnd(); ++it )
+ while( dbus_connection_dispatch(*it) == DBUS_DISPATCH_DATA_REMAINS )
+ ;
+}
+
+// Handle timer events.
+void DBUSConnectionEventLoop::timerEvent(QTimerEvent *e)
+{
+ DBusTimeout *timeout = timeouts.value(e->timerId());
+
+ if( timeout )
+ dbus_timeout_handle(timeout);
+}
+
+dbus_bool_t DBUSConnectionEventLoop::addWatch(DBusWatch *watch, void *data)
+{
+ DBUSConnectionEventLoop *loop = reinterpret_cast<DBUSConnectionEventLoop *>(data);
+
+ int fd = dbus_watch_get_unix_fd(watch);
+ unsigned int flags = dbus_watch_get_flags(watch);
+ dbus_bool_t enabled = dbus_watch_get_enabled(watch);
+
+ DBUSConnectionEventLoop::Watcher watcher;
+ watcher.watch = watch;
+
+ if( flags & DBUS_WATCH_READABLE )
+ {
+ watcher.read = new QSocketNotifier(fd, QSocketNotifier::Read, loop);
+ watcher.read->setEnabled(enabled);
+ loop->connect(watcher.read, SIGNAL(activated(int)), SLOT(readSocket(int)));
+ }
+
+ if( flags & DBUS_WATCH_WRITABLE )
+ {
+ watcher.write = new QSocketNotifier(fd, QSocketNotifier::Write, loop);
+ watcher.write->setEnabled(enabled);
+ loop->connect(watcher.write, SIGNAL(activated(int)), SLOT(writeSocket(int)));
+ }
+
+ loop->watchers.insertMulti(fd, watcher);
+
+ return true;
+}
+
+void DBUSConnectionEventLoop::removeWatch(DBusWatch *watch, void *data)
+{
+ DBUSConnectionEventLoop *loop = reinterpret_cast<DBUSConnectionEventLoop *>(data);
+
+ int fd = dbus_watch_get_unix_fd(watch);
+
+ DBUSConnectionEventLoop::Watchers::iterator it = loop->watchers.find(fd);
+
+ while( it != loop->watchers.end() && it.key() == fd )
+ {
+ DBUSConnectionEventLoop::Watcher &watcher = it.value();
+
+ if( watcher.watch == watch )
+ {
+ if( watcher.read )
+ delete watcher.read;
+
+ if( watcher.write )
+ delete watcher.write;
+
+ loop->watchers.erase(it);
+
+ return;
+ }
+
+ ++it;
+ }
+}
+
+void DBUSConnectionEventLoop::toggleWatch(DBusWatch *watch, void *data)
+{
+ DBUSConnectionEventLoop *loop = reinterpret_cast<DBUSConnectionEventLoop *>(data);
+
+ int fd = dbus_watch_get_unix_fd(watch);
+ unsigned int flags = dbus_watch_get_flags(watch);
+ dbus_bool_t enabled = dbus_watch_get_enabled(watch);
+
+ DBUSConnectionEventLoop::Watchers::const_iterator it = loop->watchers.find(fd);
+
+ while( it != loop->watchers.end() && it.key() == fd )
+ {
+ const DBUSConnectionEventLoop::Watcher &watcher = it.value();
+
+ if( watcher.watch == watch )
+ {
+ if( flags & DBUS_WATCH_READABLE && watcher.read )
+ watcher.read->setEnabled(enabled);
+
+ if( flags & DBUS_WATCH_WRITABLE && watcher.write )
+ watcher.write->setEnabled(enabled);
+
+ return;
+ }
+
+ ++it;
+ }
+}
+
+dbus_bool_t DBUSConnectionEventLoop::addTimeout(DBusTimeout *timeout, void *data)
+{
+ // Nothing to do if the timeout is disabled.
+ if( !dbus_timeout_get_enabled(timeout) )
+ return true;
+
+ // Pretend it is successful if there is no application instance.
+ if( !QCoreApplication::instance() )
+ return true;
+
+ DBUSConnectionEventLoop *loop = reinterpret_cast<DBUSConnectionEventLoop *>(data);
+
+ int id = loop->startTimer(dbus_timeout_get_interval(timeout));
+
+ if( !id )
+ return false;
+
+ loop->timeouts[id] = timeout;
+
+ return true;
+}
+
+void DBUSConnectionEventLoop::removeTimeout(DBusTimeout *timeout, void *data)
+{
+ DBUSConnectionEventLoop *loop = reinterpret_cast<DBUSConnectionEventLoop *>(data);
+
+ DBUSConnectionEventLoop::Timeouts::iterator it = loop->timeouts.begin();
+
+ while( it != loop->timeouts.end() )
+ {
+ if( it.value() == timeout )
+ {
+ loop->killTimer(it.key());
+ it = loop->timeouts.erase(it);
+ }
+ else
+ ++it;
+ }
+}
+
+void DBUSConnectionEventLoop::toggleTimeout(DBusTimeout *timeout, void *data)
+{
+ DBUSConnectionEventLoop::removeTimeout(timeout, data);
+ DBUSConnectionEventLoop::addTimeout(timeout, data);
+}
+
+void DBUSConnectionEventLoop::wakeupMain(void *data)
+{
+ DBUSConnectionEventLoop *loop = reinterpret_cast<DBUSConnectionEventLoop *>(data);
+
+ QTimer::singleShot(0, loop, SLOT(dispatch()));
+}
+
+// The initialization point
+bool DBUSConnectionEventLoop::initConnection(DBusConnection* conn)
+{
+ bool rc;
+
+ if( conn == NULL )
+ {
+ return false;
+ }
+
+ connections.append(conn);
+
+ if(
+ !dbus_connection_set_watch_functions(conn,
+ DBUSConnectionEventLoop::addWatch,
+ DBUSConnectionEventLoop::removeWatch,
+ DBUSConnectionEventLoop::toggleWatch,
+ this, 0)
+ )
+ {
+ rc = false;
+ }
+ else if(
+ !dbus_connection_set_timeout_functions(conn,
+ DBUSConnectionEventLoop::addTimeout,
+ DBUSConnectionEventLoop::removeTimeout,
+ DBUSConnectionEventLoop::toggleTimeout,
+ this, 0)
+ )
+ {
+ rc = false;
+ }
+ else
+ {
+ rc = true;
+ }
+
+ dbus_connection_set_wakeup_main_function(conn, DBUSConnectionEventLoop::wakeupMain, this, 0);
+
+ return rc;
+}
+
diff --git a/libdbus-qeventloop/dbusconnectioneventloop.h b/libdbus-qeventloop/dbusconnectioneventloop.h
new file mode 100644
index 0000000..ef46ea2
--- /dev/null
+++ b/libdbus-qeventloop/dbusconnectioneventloop.h
@@ -0,0 +1,62 @@
+#ifndef DBUSCONNECTIONEVENTLOOP_H
+#define DBUSCONNECTIONEVENTLOOP_H
+
+#include <QObject>
+#include <QList>
+#include <QMultiHash>
+#include <QHash>
+
+#include <dbus/dbus.h>
+
+class QSocketNotifier;
+class QTimerEvent;
+
+class DBUSConnectionEventLoop : public QObject
+{
+ Q_OBJECT
+private:
+ Q_DISABLE_COPY(DBUSConnectionEventLoop)
+
+public:
+ DBUSConnectionEventLoop();
+ virtual ~DBUSConnectionEventLoop();
+
+public:
+ bool initConnection(DBusConnection* conn);
+
+ class Watcher
+ {
+ public:
+ Watcher() : watch(0), read(0), write(0) {}
+
+ DBusWatch* watch;
+ QSocketNotifier* read;
+ QSocketNotifier* write;
+ };
+
+ typedef QMultiHash<int, Watcher> Watchers;
+ typedef QHash<int, DBusTimeout*> Timeouts;
+ typedef QList<DBusConnection*> Connections;
+
+ Watchers watchers;
+ Timeouts timeouts;
+ Connections connections;
+
+public slots:
+ void readSocket(int fd);
+ void writeSocket(int fd);
+ void dispatch();
+
+protected:
+ void timerEvent(QTimerEvent *e);
+
+ static dbus_bool_t addWatch(DBusWatch *watch, void *data);
+ static void removeWatch(DBusWatch *watch, void *data);
+ static void toggleWatch(DBusWatch *watch, void *data);
+ static dbus_bool_t addTimeout(DBusTimeout *timeout, void *data);
+ static void removeTimeout(DBusTimeout *timeout, void *data);
+ static void toggleTimeout(DBusTimeout *timeout, void *data);
+ static void wakeupMain(void *data);
+};
+
+#endif // DBUSCONNECTIONEVENTLOOP_H
diff --git a/libdbus-qeventloop/libdbus-qeventloop.pro b/libdbus-qeventloop/libdbus-qeventloop.pro
new file mode 100644
index 0000000..7aa22b1
--- /dev/null
+++ b/libdbus-qeventloop/libdbus-qeventloop.pro
@@ -0,0 +1,29 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-01-18T16:28:34
+#
+#-------------------------------------------------
+
+
+TARGET = dbus-qeventloop
+TEMPLATE = lib
+VERSION = 0.1
+DESTDIR = build
+MOC_DIR = .moc
+OBJECTS_DIR = .obj
+
+DEFINES += LIBDBUSQEVENTLOOP_LIBRARY
+SOURCES += dbusconnectioneventloop.cpp
+
+HEADERS += dbusconnectioneventloop.h
+
+QT = core
+CONFIG += qt link_pkgconfig dll
+PKGCONFIG += dbus-1
+
+# Install directives
+headers.files = $$HEADERS
+INSTALLBASE = /usr
+target.path = $$INSTALLBASE/lib
+headers.path = $$INSTALLBASE/include/resource/qt4
+INSTALLS = target headers
diff --git a/project.pro b/project.pro
new file mode 100644
index 0000000..7801d61
--- /dev/null
+++ b/project.pro
@@ -0,0 +1,11 @@
+#####################################################################
+# Main projectfile
+#####################################################################
+
+CONFIG += ordered
+TEMPLATE = subdirs
+
+SUBDIRS = libdbus-qeventloop \
+ libresourceqt \
+ tests
+
diff --git a/tests/test-dbus-ping/test-dbus-ping.cpp b/tests/test-dbus-ping/test-dbus-ping.cpp
new file mode 100644
index 0000000..ff496e6
--- /dev/null
+++ b/tests/test-dbus-ping/test-dbus-ping.cpp
@@ -0,0 +1,36 @@
+#include <stdio.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtDBus/QtDBus>
+
+#define SERVICE_NAME "com.nokia.dbusqeventloop.test"
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if( !QDBusConnection::systemBus().isConnected() )
+ {
+ fprintf(stderr, "Cannot connect to the D-Bus system bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ QDBusInterface iface(SERVICE_NAME, "/", "", QDBusConnection::systemBus());
+ if( iface.isValid() )
+ {
+ QDBusReply<QString> reply = iface.call("ping", argc > 1 ? argv[1] : "");
+ if( reply.isValid() )
+ {
+ printf("Reply was: %s\n", qPrintable(reply.value()));
+ return 0;
+ }
+
+ fprintf(stderr, "Call failed: %s\n", qPrintable(reply.error().message()));
+ return 2;
+ }
+
+ fprintf(stderr, "%s\n", qPrintable(QDBusConnection::systemBus().lastError().message()));
+ return 3;
+}
diff --git a/tests/test-dbus-ping/test-dbus-ping.pro b/tests/test-dbus-ping/test-dbus-ping.pro
new file mode 100644
index 0000000..b81bd3d
--- /dev/null
+++ b/tests/test-dbus-ping/test-dbus-ping.pro
@@ -0,0 +1,19 @@
+TEMPLATE = app
+TARGET = test-dbus-ping
+MOC_DIR = .moc
+OBJECTS_DIR = .obj
+DEPENDPATH += .
+QT = core dbus
+CONFIG += console
+CONFIG -= app_bundle
+
+QMAKE_CXXFLAGS += -Wall
+
+# Input
+SOURCES += test-dbus-ping.cpp
+
+QMAKE_DISTCLEAN += -r .moc .obj
+
+# Install options
+target.path = /usr/lib/libresourceqt-tests/
+INSTALLS = target
diff --git a/tests/test-dbus-pong/pong.h b/tests/test-dbus-pong/pong.h
new file mode 100644
index 0000000..8656186
--- /dev/null
+++ b/tests/test-dbus-pong/pong.h
@@ -0,0 +1,13 @@
+#ifndef _PONG_H_
+#define _PONG_H_
+
+#include <QtCore/QObject>
+
+class Pong: public QObject
+{
+ Q_OBJECT
+public slots:
+ Q_SCRIPTABLE QString ping(const QString &arg);
+};
+
+#endif // _PONG_H_
diff --git a/tests/test-dbus-pong/test-dbus-pong.cpp b/tests/test-dbus-pong/test-dbus-pong.cpp
new file mode 100644
index 0000000..f781004
--- /dev/null
+++ b/tests/test-dbus-pong/test-dbus-pong.cpp
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <QtCore/QCoreApplication>
+#include <QtCore/QTimer>
+#include <QtDBus/QtDBus>
+
+#include "pong.h"
+
+#define SERVICE_NAME "com.nokia.dbusqeventloop.test"
+
+QString Pong::ping(const QString &arg)
+{
+ QMetaObject::invokeMethod(QCoreApplication::instance(), "quit");
+ return QString("ping(\"%1\") got called").arg(arg);
+}
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+
+ if( !QDBusConnection::systemBus().isConnected() )
+ {
+ fprintf(stderr, "Cannot connect to the D-Bus system bus.\n"
+ "To start it, run:\n"
+ "\teval `dbus-launch --auto-syntax`\n");
+ return 1;
+ }
+
+ if( !QDBusConnection::systemBus().registerService(SERVICE_NAME) )
+ {
+ fprintf(stderr, "%s\n", qPrintable(QDBusConnection::systemBus().lastError().message()));
+ exit(2);
+ }
+
+ Pong pong;
+ QDBusConnection::systemBus().registerObject("/", &pong, QDBusConnection::ExportAllSlots);
+
+ app.exec();
+ return 0;
+}
diff --git a/tests/test-dbus-pong/test-dbus-pong.pro b/tests/test-dbus-pong/test-dbus-pong.pro
new file mode 100644
index 0000000..ab59e1a
--- /dev/null
+++ b/tests/test-dbus-pong/test-dbus-pong.pro
@@ -0,0 +1,20 @@
+TEMPLATE = app
+TARGET = test-dbus-pong
+MOC_DIR = .moc
+OBJECTS_DIR = .obj
+DEPENDPATH += .
+QT = core dbus
+CONFIG += console
+CONFIG -= app_bundle
+
+QMAKE_CXXFLAGS += -Wall
+
+# Input
+SOURCES += test-dbus-pong.cpp
+HEADERS += pong.h
+
+QMAKE_DISTCLEAN += -r .moc .obj
+
+# Install options
+target.path = /usr/lib/libresourceqt-tests/
+INSTALLS = target
diff --git a/tests/test-dbus-qeventloop/test-dbus-qeventloop.cpp b/tests/test-dbus-qeventloop/test-dbus-qeventloop.cpp
new file mode 100644
index 0000000..f0385af
--- /dev/null
+++ b/tests/test-dbus-qeventloop/test-dbus-qeventloop.cpp
@@ -0,0 +1,20 @@
+#include "dbusconnectioneventloop.h"
+#include <QtTest/QtTest>
+
+class TestDbusQEventLoop: public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void basicTest()
+ {
+ DBusConnection* systemBus = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ QVERIFY(systemBus != NULL);
+
+ DBUSConnectionEventLoop d;
+ QVERIFY(d.initConnection(systemBus) == true);
+ }
+};
+
+QTEST_MAIN(TestDbusQEventLoop)
+#include "test-dbus-qeventloop.moc"
diff --git a/tests/test-dbus-qeventloop/test-dbus-qeventloop.pro b/tests/test-dbus-qeventloop/test-dbus-qeventloop.pro
new file mode 100644
index 0000000..80066bf
--- /dev/null
+++ b/tests/test-dbus-qeventloop/test-dbus-qeventloop.pro
@@ -0,0 +1,28 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-01-18T16:28:34
+#
+#-------------------------------------------------
+
+TEMPLATE = app
+TARGET = test-dbus-qeventloop
+MOC_DIR = .moc
+OBJECTS_DIR = .obj
+DEPENDPATH += .
+QT = testlib core
+CONFIG += console link_pkgconfig
+CONFIG -= app_bundle
+PKGCONFIG += dbus-1
+
+INCLUDEPATH += ../../libdbus-qeventloop
+QMAKE_CXXFLAGS += -Wall
+LIBS += -L../../libdbus-qeventloop/build -ldbus-qeventloop
+
+# Input
+SOURCES += test-dbus-qeventloop.cpp
+
+QMAKE_DISTCLEAN += -r .moc .obj
+
+# Install options
+target.path = /usr/lib/libresourceqt-tests/
+INSTALLS = target
diff --git a/tests/test-resource/test-resource.pro b/tests/test-resource/test-resource.pro
index 7ab2678..6ff2f35 100644
--- a/tests/test-resource/test-resource.pro
+++ b/tests/test-resource/test-resource.pro
@@ -1,4 +1,4 @@
-BASE = ..
+BASE = ../../libresourceqt
TEMPLATE = app
TARGET = test-resource
DESTDIR = build
@@ -17,5 +17,5 @@ QT -= gui
# Install directives
INSTALLBASE = /usr
-target.path = $$INSTALLBASE/share/libresourceqt/tests
+target.path = $$INSTALLBASE/lib/libresourceqt-tests/
INSTALLS = target
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644
index 0000000..e5751bb
--- /dev/null
+++ b/tests/tests.pro
@@ -0,0 +1,18 @@
+#####################################################################
+# Tests projectfile
+#####################################################################
+
+CONFIG += ordered
+TEMPLATE = subdirs
+
+SUBDIRS = test-dbus-qeventloop \
+ test-dbus-ping \
+ test-dbus-pong \
+ test-resource \
+# test-resource-engine \
+ test-resource-set
+
+# Install options
+testsxml.path = /usr/share/libresourceqt-tests/
+testsxml.files = tests.xml
+INSTALLS = testsxml
diff --git a/tests/tests.xml b/tests/tests.xml
new file mode 100644
index 0000000..8cd4f87
--- /dev/null
+++ b/tests/tests.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<testdefinition version="0.1">
+ <suite name="libresourceqt-tests" domain="Multimedia Middleware">
+ <set name="libresourceqt-tests" feature="Resource policy">
+
+ <case name="test-resource" type="Functional" level="Component" description="Unit tests for libresourceqt" timeout="15">
+ <step expected_result="0">/usr/lib/libresourceqt-tests/test-resource</step>
+ </case>
+
+ <case name="test-resource-set" type="Functional" level="Component" description="Unit tests for libresourceqt" timeout="15">
+ <step expected_result="0">/usr/lib/libresourceqt-tests/test-resource-set</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+ </suite>
+
+ <suite name="libdbus-qeventloop-tests" domain="Multimedia Middleware">
+ <set name="libdbus-qeventloop-tests" feature="Resource policy">
+
+ <case name="unit-tests" type="Functional" level="Component" description="Unit tests for libdbus-qeventloop" timeout="15">
+ <step expected_result="0">/usr/lib/libresourceqt-tests/test-dbus-qeventloop</step>
+ </case>
+
+ <environments>
+ <scratchbox>false</scratchbox>
+ <hardware>true</hardware>
+ </environments>
+
+ </set>
+ </suite>
+</testdefinition>