summaryrefslogtreecommitdiffstats
path: root/dcop/tests/driver.cpp
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commitce4a32fe52ef09d8f5ff1dd22c001110902b60a2 (patch)
tree5ac38a06f3dde268dc7927dc155896926aaf7012 /dcop/tests/driver.cpp
downloadtdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.tar.gz
tdelibs-ce4a32fe52ef09d8f5ff1dd22c001110902b60a2.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'dcop/tests/driver.cpp')
-rw-r--r--dcop/tests/driver.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/dcop/tests/driver.cpp b/dcop/tests/driver.cpp
new file mode 100644
index 000000000..ac06d2873
--- /dev/null
+++ b/dcop/tests/driver.cpp
@@ -0,0 +1,65 @@
+#include "driver.h"
+#include <kapplication.h>
+#include <iostream>
+#include <dcopclient.h>
+#include <kcmdlineargs.h>
+#include <qtimer.h>
+#include <qtimer.h>
+
+using namespace std;
+
+#ifdef _MSC_VER
+#define __PRETTY_FUNCTION__ __FUNCTION__
+#endif
+
+Driver::Driver(const char* app)
+ :Test_stub( app, "TestInterface" ),
+ DCOPStub( app, "TestInterface" ), // DCOPStub is *virtual* inherited
+ count( 0 )
+{
+
+}
+
+QTextStream output( fopen( "driver.returns", "w" ) , IO_WriteOnly );
+#include <iostream>
+void Driver::test()
+{
+ // This is written like this to allow the potentially ASYNC calls to be syncronized
+ // Just sleeping would mean that no errors were reported until much later
+ // I could improve it, so that we don't sleep after a synchronous call, but I will
+ // leave it for later
+
+ std::cerr << __PRETTY_FUNCTION__ << " count: " << count << '\n';
+
+ Driver* object = this;
+ switch ( count ) {
+#include "driver.generated"
+ default:
+ exit( 0 );
+ }
+
+ ++count;
+ QTimer::singleShot( 100, this, SLOT( test() ) );
+}
+
+#include "driver.moc"
+
+#ifdef Q_OS_WIN
+# define main kdemain
+#endif
+
+int main(int argc, char** argv)
+{
+ if ( argc < 2 ) { qWarning("Usage: driver <appid>"); return 1; }
+ const char* appname = strdup( argv[ 1 ] );
+ argv[ 1 ] = 0; // sue me
+ KCmdLineArgs::init( argc, argv, "TestAppDriver", "Tests the dcop familly of tools + libraries", "1.0" ); // FIXME
+ KApplication app;
+ app.dcopClient()->attach( );
+ app.dcopClient()->registerAs( "TestAppDriver" );
+ Driver * object = new Driver( appname );
+ QTimer::singleShot( 10, object, SLOT( test() ) );
+ return app.exec();
+}
+
+