From 4136447e73d0d1ff64135163d590906b0344a17b Mon Sep 17 00:00:00 2001 From: Denes Matetelki Date: Sat, 25 Jun 2011 10:08:48 +0200 Subject: [PATCH] test update --- qtmindmap_test.pro | 37 ++++++++++++++++++------------------- test/algorithmtests.cpp | 23 ++++++++++++++++------- 2 files changed, 34 insertions(+), 26 deletions(-) diff --git a/qtmindmap_test.pro b/qtmindmap_test.pro index bf072cc..fa9e04f 100644 --- a/qtmindmap_test.pro +++ b/qtmindmap_test.pro @@ -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 diff --git a/test/algorithmtests.cpp b/test/algorithmtests.cpp index da51fa6..c471c08 100644 --- a/test/algorithmtests.cpp +++ b/test/algorithmtests.cpp @@ -4,9 +4,10 @@ #include -#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; }