Project cleanup
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
enable_testing()
|
||||
|
||||
set(HEADERS
|
||||
dbmsgbase.h
|
||||
dbmsgfieldbase.h
|
||||
@@ -20,3 +22,10 @@ target_compile_definitions(messaginglib PRIVATE MESSAGINGLIB_LIBRARY)
|
||||
target_link_libraries(messaginglib Qt5::Core Qt5::Network)
|
||||
|
||||
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)
|
||||
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user