summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAdrien BUSTANY <madcat@mymadcat.com>2008-06-11 01:25:29 +0200
committerAdrien BUSTANY <madcat@mymadcat.com>2008-06-11 01:25:29 +0200
commitbf1ad081871705a850cef9f80b93779ec122e6ff (patch)
tree36dd6b6bba05a89612d659b720e3ca38c902e02d /lib
parentc6bd8627636e7f8d99755683608fe6f1bd7f7411 (diff)
Install unit test
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/Install/Install.pro14
-rwxr-xr-xlib/tests/Install/run.sh2
-rw-r--r--lib/tests/Install/testCallback.cpp16
-rw-r--r--lib/tests/Install/testCallback.h29
-rw-r--r--lib/tests/Install/testInstall.cpp12
5 files changed, 73 insertions, 0 deletions
diff --git a/lib/tests/Install/Install.pro b/lib/tests/Install/Install.pro
new file mode 100644
index 0000000..63ebd63
--- /dev/null
+++ b/lib/tests/Install/Install.pro
@@ -0,0 +1,14 @@
+######################################################################
+# Automatically generated by qmake (2.01a) mar. mars 18 19:24:01 2008
+######################################################################
+
+TEMPLATE = app
+TARGET = testInstall
+DEPENDPATH += .
+INCLUDEPATH += .
+LIBS += -L../../ -lpackagekit-qt
+QT += dbus
+
+# Input
+HEADERS += testCallback.h
+SOURCES += testInstall.cpp testCallback.cpp
diff --git a/lib/tests/Install/run.sh b/lib/tests/Install/run.sh
new file mode 100755
index 0000000..9dd3d30
--- /dev/null
+++ b/lib/tests/Install/run.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+LD_LIBRARY_PATH=../..:$LD_LIBRARY_PATH ./testInstall
diff --git a/lib/tests/Install/testCallback.cpp b/lib/tests/Install/testCallback.cpp
new file mode 100644
index 0000000..d9b0b35
--- /dev/null
+++ b/lib/tests/Install/testCallback.cpp
@@ -0,0 +1,16 @@
+#include "testCallback.h"
+
+using namespace PackageKit;
+
+TestCallback::TestCallback(QObject *parent) : QObject(parent) {
+ d = new Daemon(this);
+ t = d->newTransaction();
+ QObject::connect(t, SIGNAL(Finished(Exit::Value, uint)), this, SLOT(finish()));
+ qDebug() << "Installing nedit";
+ t->installPackage(new Package("nedit;5.5-18.fc9;x86_64;fedora"));
+}
+
+void TestCallback::finish() {
+ qDebug() << "Installed";
+ QCoreApplication::quit();
+}
diff --git a/lib/tests/Install/testCallback.h b/lib/tests/Install/testCallback.h
new file mode 100644
index 0000000..47a61f7
--- /dev/null
+++ b/lib/tests/Install/testCallback.h
@@ -0,0 +1,29 @@
+#ifndef TESTCALLBACK
+#define TESTCALLBACK
+
+#include <QtCore>
+
+#include "../../QPackageKit.h"
+
+namespace PackageKit {
+
+class TestCallback : public QObject {
+
+ Q_OBJECT
+
+public:
+ TestCallback(QObject *parent = 0);
+
+public slots:
+ void finish();
+
+private:
+ Transaction *t;
+ Daemon *d;
+
+};
+
+} // End namespace PackageKit
+
+#endif
+
diff --git a/lib/tests/Install/testInstall.cpp b/lib/tests/Install/testInstall.cpp
new file mode 100644
index 0000000..4a9baa7
--- /dev/null
+++ b/lib/tests/Install/testInstall.cpp
@@ -0,0 +1,12 @@
+#include <QtCore>
+
+#include "../../QPackageKit.h"
+#include "testCallback.h"
+
+using namespace PackageKit;
+
+int main(int argc, char **argv) {
+ QCoreApplication app(argc, argv);
+ TestCallback tc;
+ return app.exec();
+}