test update

master
Denes Matetelki 14 years ago
parent c55079ddbc
commit 4136447e73

@ -1,26 +1,25 @@
QT += core gui svg
QT += core gui svg xml
CONFIG += qtestlib
TARGET = qtmindmap_test
SOURCES += mainwindow.cpp \
aboutdialog.cpp \
graphwidget.cpp \
node.cpp \
edge.cpp \
systemtray.cpp \
argumentparser.cpp \
algorithmtests.cpp
SOURCES += src/mainwindow.cpp \
src/graphwidget.cpp \
src/node.cpp \
src/edge.cpp \
src/systemtray.cpp \
src/argumentparser.cpp \
test/algorithmtests.cpp
HEADERS += mainwindow.h \
aboutdialog.h \
graphwidget.h \
node.h \
edge.h \
systemtray.h \
argumentparser.h \
algorithmtests.h
HEADERS += include/mainwindow.h \
include/graphwidget.h \
include/node.h \
include/edge.h \
include/systemtray.h \
include/argumentparser.h \
test/algorithmtests.h
FORMS += mainwindow.ui \
aboutdialog.ui
FORMS += ui/mainwindow.ui
RESOURCES = images/qtmindmap.qrc

@ -4,9 +4,10 @@
#include <QDebug>
#include "node.h"
#include "edge.h"
#include "include/mainwindow.h"
#include "include/graphwidget.h"
#include "include/node.h"
#include "include/edge.h"
static const double Pi = 3.14159265358979323846264338327950288419717;
@ -30,14 +31,18 @@ double angleOfPoints(const QPointF &a, const QPointF &b)
void AlgorithmTests::calculateBiggestAngle()
{
MainWindow *mainWindow = new MainWindow;
GraphWidget *graphWidget = new GraphWidget(mainWindow);
// no edges
Node *node1 = new Node();
Node *node1 = new Node(graphWidget);
node1->setPos(0,0);
QCOMPARE(node1->calculateBiggestAngle(), Pi * 1.5);
// one egde
// 1
Node *node2 = new Node();
Node *node2 = new Node(graphWidget);
node2->setPos(30,0);
Edge *edge1 = new Edge(node1, node2);
@ -60,12 +65,12 @@ void AlgorithmTests::calculateBiggestAngle()
node2->setPos(30,0);
edge1->m_angle = angleOfPoints(node1->pos(), node2->pos());
Node *node3 = new Node();
Node *node3 = new Node(graphWidget);
node3->setPos(-30,0);
Edge *edge2 = new Edge(node1, node3);
edge2->m_angle = angleOfPoints(node1->pos(), node3->pos());
Node *node4 = new Node();
Node *node4 = new Node(graphWidget);
node4->setPos(0, -30);
Edge *edge3 = new Edge(node1, node4);
edge3->m_angle = angleOfPoints(node1->pos(), node4->pos());
@ -78,6 +83,10 @@ void AlgorithmTests::calculateBiggestAngle()
delete node1;
delete node2;
delete node3;
delete node4;
delete graphWidget;
delete mainWindow;
}

Loading…
Cancel
Save