From a45c934da638650c3b1cecfcd009b3828399604b Mon Sep 17 00:00:00 2001 From: EndrII Date: Sun, 19 Aug 2018 19:16:21 +0300 Subject: [PATCH] test integration --- .gitignore | 2 +- SoundBand.pro | 3 ++- Sync/Log.h | 5 ++-- tests/tests.pro | 25 ++------------------ tests/tst_synctest.cpp | 52 +++++++++--------------------------------- 5 files changed, 19 insertions(+), 68 deletions(-) diff --git a/.gitignore b/.gitignore index eeb2f6e..33abb93 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,4 @@ Makefile* # QtCtreator CMake CMakeLists.txt.user* - +installer/installerApp diff --git a/SoundBand.pro b/SoundBand.pro index b898b21..263e612 100644 --- a/SoundBand.pro +++ b/SoundBand.pro @@ -8,7 +8,8 @@ message( DEPLOY_FILES_MASTER = $$DEPLOY_FILES) SUBDIRS += Sync \ QuasarAppLib/QuasarApp.pro \ SoundBand \ - CQtDeployer + CQtDeployer \ + tests SoundBand.depends = Sync QuasarAppLib/QuasarApp.pro diff --git a/Sync/Log.h b/Sync/Log.h index ae3fd15..23f91c9 100644 --- a/Sync/Log.h +++ b/Sync/Log.h @@ -4,10 +4,11 @@ #include #include #include +#include "sync_global.h" -enum LogType{ERROR, WARNING, INFORMATION, NONE}; +enum SYNCSHARED_EXPORT LogType{ERROR, WARNING, INFORMATION, NONE}; -class Log +class SYNCSHARED_EXPORT Log { public: explicit Log(const QString &fileName); diff --git a/tests/tests.pro b/tests/tests.pro index e308cc3..44d3b02 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -7,32 +7,11 @@ CONFIG -= app_bundle TEMPLATE = app SOURCES += \ - tst_synctest.cpp \ - ../chronotime.cpp \ - ../ETcpSocket.cpp \ - ../LocalScanner.cpp \ - ../node.cpp \ - ../player.cpp \ - ../song.cpp \ - ../sync.cpp \ - ../mysql.cpp \ - ../Log.cpp + tst_synctest.cpp RESOURCES += \ res.qrc -HEADERS += \ - ../chronotime.h \ - ../config.h \ - ../ETcpSocket.h \ - ../exaptions.h \ - ../LocalScanner.h \ - ../node.h \ - ../player.h \ - ../song.h \ - ../sync.h \ - ../mysql.h \ - ../Log.h - +include($$PWD/../Sync/Sync.pri) diff --git a/tests/tst_synctest.cpp b/tests/tst_synctest.cpp index 91f7ff3..c3477bb 100644 --- a/tests/tst_synctest.cpp +++ b/tests/tst_synctest.cpp @@ -1,8 +1,8 @@ #include -#include "../sync.h" +#include "sync.h" #include #include -#include "../Log.h" +#include "Log.h" // add necessary includes here @@ -42,7 +42,7 @@ void SyncTest::sycn_tests() { - syncLib::Sync *sync = new syncLib::Sync; + Sync *sync = new Sync; QVERIFY(sync != nullptr); @@ -61,8 +61,8 @@ void SyncTest::sycn_tests() delete sync; - sync = new syncLib::Sync(LOCAL_HOST, 1994); - syncLib::Sync sync2(LOCAL_HOST, 1998,"test2.dat"); + sync = new Sync(LOCAL_HOST, 1994); + Sync sync2(LOCAL_HOST, 1998,"test2.dat"); QVERIFY(sync->play(1)); @@ -75,43 +75,13 @@ void SyncTest::sycn_tests() void SyncTest::player_tests() { - QFile f(":/song/test_song"); - - QVERIFY(f.open(QIODevice::ReadOnly)); - - Player pl(BUFFER_NAME); - - QByteArray array = f.readAll(); - f.close(); - QVERIFY(pl.setMediaFromBytes(array)); - - f.setFileName(BUFFER_NAME); - - QVERIFY(f.open(QIODevice::ReadOnly)); - - QByteArray array2 = f.readAll(); - f.close(); - - QVERIFY(array.length() == array2.length()); - - QVERIFY(pl.setMediaFromBytes(array)); - - QVERIFY(f.open(QIODevice::ReadOnly)); - - array2 = f.readAll(); - - QVERIFY(array.length() == array2.length()); - - - - } void SyncTest::database_tests() { - syncLib::MySql sql("test1"); - syncLib::SongHeader header; - syncLib::Song song; + MySql sql("test1"); + SongHeader header; + SongStorage song; QVERIFY(!sql.load(header, song)); @@ -122,7 +92,7 @@ void SyncTest::database_tests() QVERIFY(sql.load(header ,song)); - header = static_cast(song); + header = static_cast(song); QVERIFY(sql.load(header, song)); QVERIFY(sql.addPlayList("play", "desc of play")); @@ -138,7 +108,7 @@ void SyncTest::database_tests() QVERIFY(!sql.addToPlayList(header, "play")); - QList list; + PlayList list; sql.updateAvailableSongs(list); QVERIFY(list.size() == 1); @@ -173,7 +143,7 @@ void SyncTest::database_tests() void SyncTest::network_tests(){ - syncLib::Node node1("127.0.0.1", 1994); + Node node1("127.0.0.1", 1994); QVERIFY(node1.getClients()->size() == 0);