Commit 4e7135d2 authored by Laurent Montel's avatar Laurent Montel 😁

Add autotests

parent aac8bb0e
......@@ -31,6 +31,7 @@ ecm_setup_version(${KDEPIMLIBS_VERSION} VARIABLE_PREFIX AKONADICONTACT
SOVERSION 5
)
set(QT_REQUIRED_VERSION "5.5.0")
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test WebKitWidgets)
########### Find packages ###########
find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED)
......
......@@ -63,7 +63,7 @@ void AddressesLocationGrantleeFormater::changeGrantleePath(const QString &path)
mTemplateLoader->setTemplateDirs(QStringList() << path);
mEngine->addTemplateLoader(mTemplateLoader);
mSelfcontainedTemplate = mEngine->loadByName(QStringLiteral("sss")); //TODO
mSelfcontainedTemplate = mEngine->loadByName(QStringLiteral("addresseslocation.html"));
if (mSelfcontainedTemplate->error()) {
mErrorMessage += mSelfcontainedTemplate->errorString() + QLatin1String("<br>");
}
......
set(QT_REQUIRED_VERSION "5.4.0")
find_package(Qt5Test ${QT_REQUIRED_VERSION} CONFIG REQUIRED)
set(addresseslocationviewer_SRCS addresseslocationviewertest.cpp )
set(addresseslocationviewer_SRCS addresseslocationviewertest.cpp ../addresseslocationviewer.cpp ../addresseslocationgrantleeformater.cpp ../addressgrantleeobject.cpp)
add_executable(addresseslocationviewer ${addresseslocationviewer_SRCS})
add_test(addresseslocationviewer addresseslocationviewer)
ecm_mark_as_test(addresseslocationviewer)
target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n)
target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n Qt5::WebKitWidgets Grantlee5::Templates)
set(addresslocationwidget_SRCS addresslocationwidgettest.cpp ../addresslocationwidget.cpp)
......
......@@ -21,6 +21,7 @@
*/
#include "addresseslocationviewertest.h"
#include "../addresseslocationviewer.h"
#include <QTest>
AddressesLocationViewerTest::AddressesLocationViewerTest(QObject *parent)
......@@ -34,4 +35,10 @@ AddressesLocationViewerTest::~AddressesLocationViewerTest()
}
void AddressesLocationViewerTest::shouldHaveDefaultValue()
{
AddressesLocationViewer w;
QVERIFY(w.addresses().isEmpty());
}
QTEST_MAIN(AddressesLocationViewerTest)
......@@ -31,6 +31,8 @@ class AddressesLocationViewerTest : public QObject
public:
explicit AddressesLocationViewerTest(QObject *parent = Q_NULLPTR);
~AddressesLocationViewerTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // ADDRESSESLOCATIONVIEWERTEST_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment