Project cleanup
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
project(DbMessaging)
|
project(DbMessaging)
|
||||||
|
|
||||||
|
add_custom_target(messaging)
|
||||||
|
|
||||||
add_subdirectory(messagingclient)
|
add_subdirectory(messagingclient)
|
||||||
add_subdirectory(messaginglib)
|
add_subdirectory(messaginglib)
|
||||||
add_subdirectory(messagingserver)
|
add_subdirectory(messagingserver)
|
||||||
add_subdirectory(messagingtest)
|
|
||||||
|
@ -8,3 +8,5 @@ set(SOURCES
|
|||||||
add_executable(messagingclient ${HEADERS} ${SOURCES})
|
add_executable(messagingclient ${HEADERS} ${SOURCES})
|
||||||
|
|
||||||
target_link_libraries(messagingclient Qt5::Core Qt5::Network messaginglib)
|
target_link_libraries(messagingclient Qt5::Core Qt5::Network messaginglib)
|
||||||
|
|
||||||
|
add_dependencies(messaging messagingclient)
|
||||||
|
@ -1,31 +1,8 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QDate>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QVariantMap>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "messages/mymessage.h"
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication app(argc, argv);
|
QCoreApplication app(argc, argv);
|
||||||
|
|
||||||
MyMessage original("Daniel", QDate(1996, 11, 12), QDateTime::currentDateTime(), 21, 80);
|
|
||||||
MyMessage copy(original);
|
|
||||||
|
|
||||||
original.setName("Peter");
|
|
||||||
|
|
||||||
QVariantMap delta;
|
|
||||||
original.copyTouchedTo(delta);
|
|
||||||
original.setTouched(false);
|
|
||||||
|
|
||||||
qDebug() << "before applying delta";
|
|
||||||
copy.debug();
|
|
||||||
|
|
||||||
copy.apply(delta);
|
|
||||||
|
|
||||||
qDebug() << "after applying delta";
|
|
||||||
copy.debug();
|
|
||||||
|
|
||||||
return app.exec();
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
enable_testing()
|
||||||
|
|
||||||
set(HEADERS
|
set(HEADERS
|
||||||
dbmsgbase.h
|
dbmsgbase.h
|
||||||
dbmsgfieldbase.h
|
dbmsgfieldbase.h
|
||||||
@ -20,3 +22,10 @@ target_compile_definitions(messaginglib PRIVATE MESSAGINGLIB_LIBRARY)
|
|||||||
target_link_libraries(messaginglib Qt5::Core Qt5::Network)
|
target_link_libraries(messaginglib Qt5::Core Qt5::Network)
|
||||||
|
|
||||||
target_include_directories(messaginglib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(messaginglib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
add_dependencies(messaging messaginglib)
|
||||||
|
|
||||||
|
|
||||||
|
add_executable(messagingtest tst_messagingtest.cpp)
|
||||||
|
add_test(messagingtest messagingtest)
|
||||||
|
target_link_libraries(messagingtest Qt5::Core Qt5::Test messaginglib)
|
||||||
|
54
messaginglib/tst_messagingtest.cpp
Normal file
54
messaginglib/tst_messagingtest.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#include <QtTest>
|
||||||
|
#include <QDate>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QVariantMap>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
#include "messages/mymessage.h"
|
||||||
|
|
||||||
|
class MessagingTest : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
MessagingTest();
|
||||||
|
~MessagingTest();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void test_case1();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
MessagingTest::MessagingTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MessagingTest::~MessagingTest()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MessagingTest::test_case1()
|
||||||
|
{
|
||||||
|
MyMessage original("Daniel", QDate(1996, 11, 12), QDateTime::currentDateTime(), 21, 80);
|
||||||
|
MyMessage copy(original);
|
||||||
|
|
||||||
|
original.setName("Peter");
|
||||||
|
|
||||||
|
QVariantMap delta;
|
||||||
|
original.copyTouchedTo(delta);
|
||||||
|
original.setTouched(false);
|
||||||
|
|
||||||
|
qDebug() << "before applying delta";
|
||||||
|
copy.debug();
|
||||||
|
|
||||||
|
copy.apply(delta);
|
||||||
|
|
||||||
|
qDebug() << "after applying delta";
|
||||||
|
copy.debug();
|
||||||
|
}
|
||||||
|
|
||||||
|
QTEST_APPLESS_MAIN(MessagingTest)
|
||||||
|
|
||||||
|
#include "tst_messagingtest.moc"
|
@ -12,3 +12,5 @@ set(SOURCES
|
|||||||
add_executable(messagingserver ${HEADERS} ${SOURCES})
|
add_executable(messagingserver ${HEADERS} ${SOURCES})
|
||||||
|
|
||||||
target_link_libraries(messagingserver Qt5::Core Qt5::Network messaginglib)
|
target_link_libraries(messagingserver Qt5::Core Qt5::Network messaginglib)
|
||||||
|
|
||||||
|
add_dependencies(messaging messagingserver)
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
enable_testing()
|
|
||||||
|
|
||||||
set(HEADERS
|
|
||||||
)
|
|
||||||
|
|
||||||
set(SOURCES
|
|
||||||
tst_messagingtest.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
add_executable(messagingtest ${HEADERS} ${SOURCES})
|
|
||||||
|
|
||||||
add_test(messagingtest messagingtest)
|
|
||||||
|
|
||||||
target_link_libraries(messagingtest Qt5::Core Qt5::Test messaginglib)
|
|
@ -1,21 +0,0 @@
|
|||||||
QT += core testlib
|
|
||||||
QT -= gui widgets
|
|
||||||
|
|
||||||
DBLIBS += messaginglib
|
|
||||||
|
|
||||||
#this makes install step fail
|
|
||||||
# CONFIG += testcase
|
|
||||||
|
|
||||||
PROJECT_ROOT = ../..
|
|
||||||
|
|
||||||
SOURCES += tst_messagingtest.cpp
|
|
||||||
|
|
||||||
HEADERS +=
|
|
||||||
|
|
||||||
FORMS +=
|
|
||||||
|
|
||||||
RESOURCES +=
|
|
||||||
|
|
||||||
TRANSLATIONS +=
|
|
||||||
|
|
||||||
include($${PROJECT_ROOT}/app.pri)
|
|
@ -1,35 +0,0 @@
|
|||||||
#include <QtTest>
|
|
||||||
|
|
||||||
// add necessary includes here
|
|
||||||
|
|
||||||
class MessagingTest : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
MessagingTest();
|
|
||||||
~MessagingTest();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void test_case1();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
MessagingTest::MessagingTest()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
MessagingTest::~MessagingTest()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void MessagingTest::test_case1()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(MessagingTest)
|
|
||||||
|
|
||||||
#include "tst_messagingtest.moc"
|
|
Reference in New Issue
Block a user