summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/test
authorzecke <zecke>2002-10-09 14:25:38 (UTC)
committer zecke <zecke>2002-10-09 14:25:38 (UTC)
commitf9f2d227b3cfbc2187b4f7f535fc59f9735798d0 (patch) (unidiff)
tree7645623f7dde640222fab3e5ff0af0af3ae2f882 /noncore/apps/opie-console/test
parentff0caad7ea46d19f7a7916047fd0914f6f100dde (diff)
downloadopie-f9f2d227b3cfbc2187b4f7f535fc59f9735798d0.zip
opie-f9f2d227b3cfbc2187b4f7f535fc59f9735798d0.tar.gz
opie-f9f2d227b3cfbc2187b4f7f535fc59f9735798d0.tar.bz2
A small testsuite
the stuff from the remote goes to the stdout There is a send button and a multilineedit be sure to hit \n before sending... Some debug code... in some files debugged IOSerial it should be fine now
Diffstat (limited to 'noncore/apps/opie-console/test') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/test/console.pro15
-rw-r--r--noncore/apps/opie-console/test/main.cpp13
-rw-r--r--noncore/apps/opie-console/test/sender.ui60
-rw-r--r--noncore/apps/opie-console/test/senderui.cpp47
-rw-r--r--noncore/apps/opie-console/test/senderui.h23
5 files changed, 158 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro
new file mode 100644
index 0000000..721b820
--- a/dev/null
+++ b/noncore/apps/opie-console/test/console.pro
@@ -0,0 +1,15 @@
1TEMPLATE = app
2#CONFIG = qt warn_on release
3 CONFIG = qt debug
4#DESTDIR = $(OPIEDIR)/bin
5HEADERS = ../io_layer.h ../io_serial.h \
6 senderui.h ../profile.h
7SOURCES = ../io_layer.cpp ../io_serial.cpp \
8 ../profile.cpp \
9 main.cpp senderui.cpp
10INTERFACES = sender.ui
11INCLUDEPATH += $(OPIEDIR)/include
12DEPENDPATH += $(OPIEDIR)/include
13LIBS += -lqpe -lopie
14TARGET = test
15
diff --git a/noncore/apps/opie-console/test/main.cpp b/noncore/apps/opie-console/test/main.cpp
new file mode 100644
index 0000000..f5e8722
--- a/dev/null
+++ b/noncore/apps/opie-console/test/main.cpp
@@ -0,0 +1,13 @@
1#include <qpe/qpeapplication.h>
2
3#include "senderui.h"
4
5
6int main( int argc, char* argv[] ){
7QPEApplication app(argc,argv );
8
9SenderUI ui;
10app.showMainWidget(&ui);
11
12return app.exec();
13} \ No newline at end of file
diff --git a/noncore/apps/opie-console/test/sender.ui b/noncore/apps/opie-console/test/sender.ui
new file mode 100644
index 0000000..092f6e3
--- a/dev/null
+++ b/noncore/apps/opie-console/test/sender.ui
@@ -0,0 +1,60 @@
1<!DOCTYPE UI><UI>
2<class>Sender</class>
3<widget>
4 <class>QWidget</class>
5 <property stdset="1">
6 <name>name</name>
7 <cstring>Form1</cstring>
8 </property>
9 <property stdset="1">
10 <name>geometry</name>
11 <rect>
12 <x>0</x>
13 <y>0</y>
14 <width>596</width>
15 <height>480</height>
16 </rect>
17 </property>
18 <property stdset="1">
19 <name>caption</name>
20 <string>Form1</string>
21 </property>
22 <vbox>
23 <property stdset="1">
24 <name>margin</name>
25 <number>11</number>
26 </property>
27 <property stdset="1">
28 <name>spacing</name>
29 <number>6</number>
30 </property>
31 <widget>
32 <class>QMultiLineEdit</class>
33 <property stdset="1">
34 <name>name</name>
35 <cstring>MultiLineEdit1</cstring>
36 </property>
37 </widget>
38 <widget>
39 <class>QPushButton</class>
40 <property stdset="1">
41 <name>name</name>
42 <cstring>PushButton1</cstring>
43 </property>
44 <property stdset="1">
45 <name>text</name>
46 <string>&amp;Send</string>
47 </property>
48 </widget>
49 </vbox>
50</widget>
51<connections>
52 <connection>
53 <sender>PushButton1</sender>
54 <signal>clicked()</signal>
55 <receiver>Form1</receiver>
56 <slot>slotSend()</slot>
57 </connection>
58 <slot access="public">slotSend()</slot>
59</connections>
60</UI>
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp
new file mode 100644
index 0000000..fc93c04
--- a/dev/null
+++ b/noncore/apps/opie-console/test/senderui.cpp
@@ -0,0 +1,47 @@
1#include <stdlib.h>
2#include <stdio.h>
3
4#include <qmultilineedit.h>
5
6#include "../profile.h"
7#include "../io_serial.h"
8
9
10#include "senderui.h"
11
12SenderUI::SenderUI()
13 : Sender() {
14
15 /* we do that manually */
16 Profile prof;
17 QString str = "/dev/ttyS0";
18 prof.writeEntry("Device",str );
19 prof.writeEntry("Baud", 115200 );
20
21 qWarning("prof " + prof.readEntry("Device") + " " + str);
22 ser = new IOSerial(prof);
23 connect(ser, SIGNAL(received(const QByteArray& ) ),
24 this, SLOT(got(const QByteArray&) ) );
25
26 if ( ser->open() )
27 qWarning("opened!!!");
28 else
29 qWarning("could not open");
30
31
32
33}
34SenderUI::~SenderUI() {
35
36}
37void SenderUI::slotSend() {
38 QCString str = MultiLineEdit1->text().utf8();
39 qWarning("sending: %s", str.data() );
40 ser->send( str );
41}
42void SenderUI::got(const QByteArray& ar) {
43 for ( uint i = 0; i < ar.count(); i++ ) {
44 printf("%c", ar[i] );
45 }
46 //printf("\n");
47}
diff --git a/noncore/apps/opie-console/test/senderui.h b/noncore/apps/opie-console/test/senderui.h
new file mode 100644
index 0000000..bc69f5d
--- a/dev/null
+++ b/noncore/apps/opie-console/test/senderui.h
@@ -0,0 +1,23 @@
1#ifndef SENDER_UI_H
2#define SENDER_UI_H
3
4#include <qcstring.h>
5
6#include "sender.h"
7
8class IOSerial;
9class SenderUI : public Sender {
10 Q_OBJECT
11public:
12 SenderUI();
13 ~SenderUI();
14
15public slots:
16 void slotSend();
17 void got(const QByteArray& );
18private:
19 IOSerial* ser;
20};
21
22
23#endif