Browse Source

tests fix

master
Robin Thoni 11 years ago
parent
commit
177eee1256
3 changed files with 54 additions and 1 deletions
  1. 1
    1
      tests/Makefile
  2. 28
    0
      tests/bctest.cpp
  3. 25
    0
      tests/bctest.h

+ 1
- 1
tests/Makefile View File

@@ -1,6 +1,6 @@
1 1
 #############################################################################
2 2
 # Makefile for building: tests
3
-# Generated by qmake (2.01a) (Qt 4.8.2) on: jeu. janv. 2 17:22:59 2014
3
+# Generated by qmake (2.01a) (Qt 4.8.2) on: jeu. janv. 2 17:25:09 2014
4 4
 # Project:  tests.pro
5 5
 # Template: app
6 6
 # Command: /usr/bin/qmake -o Makefile tests.pro

+ 28
- 0
tests/bctest.cpp View File

@@ -0,0 +1,28 @@
1
+#include "bctest.h"
2
+
3
+BcTest::BcTest() : QObject()
4
+{
5
+	m_bc = new Broadcast(false, this);
6
+	m_serv = new Broadcast(true, this);
7
+	connect(m_bc, SIGNAL(serverDiscovered(QHostAddress, quint16)), this, SLOT(newServer(QHostAddress, quint16)));
8
+}
9
+
10
+void BcTest::test()
11
+{
12
+	int ps = 4242, pc = 4241;
13
+	if(!m_serv->start(ps, pc))
14
+	{
15
+		qDebug()<<m_serv->getError();
16
+		Q_ASSERT(false);
17
+	}
18
+	if(!m_bc->start(pc, ps))
19
+	{
20
+		qDebug()<<m_bc->getError();
21
+		Q_ASSERT(false);
22
+	}
23
+}
24
+
25
+void BcTest::newServer(QHostAddress ad, quint16 port)
26
+{
27
+	qDebug()<<"New Server:"<<ad<<port;
28
+}

+ 25
- 0
tests/bctest.h View File

@@ -0,0 +1,25 @@
1
+#ifndef BCTEST_H
2
+#define BCTEST_H
3
+
4
+#include <QDebug>
5
+#include "broadcast.h"
6
+
7
+class BcTest : public QObject
8
+{
9
+	Q_OBJECT
10
+public:
11
+	BcTest();
12
+
13
+public slots:
14
+	void test();
15
+
16
+private slots:
17
+	void newServer(QHostAddress ad, quint16 port);
18
+
19
+private:
20
+	Broadcast* m_bc;
21
+	Broadcast* m_serv;
22
+
23
+};
24
+
25
+#endif

Loading…
Cancel
Save