Commit f2969d86 authored by Laurent Montel's avatar Laurent Montel 😁

Implement autotests

parent f6b1412a
......@@ -42,6 +42,12 @@ AddressLocationWidget::AddressLocationWidget(QWidget *parent)
label->setObjectName(QStringLiteral("streetlabel"));
mStreetEdit = new KLineEdit(this);
mStreetEdit->setPlaceholderText(i18n("Add Street"));
mStreetEdit->setObjectName(QStringLiteral("streetlineedit"));
mStreetEdit->setTrapReturnKey(true);
label = new QLabel(KContacts::Address::postOfficeBoxLabel(), this);
label->setObjectName(QStringLiteral("postofficeboxlabel"));
......
......@@ -46,6 +46,7 @@ private:
KLineEdit *mLocalityEdit;
KLineEdit *mRegionEdit;
KLineEdit *mPostalCodeEdit;
KLineEdit *mStreetEdit;
KComboBox *mCountryCombo;
QPushButton *mAddAddress;
};
......
......@@ -8,8 +8,8 @@ ecm_mark_as_test(addresseslocationviewer)
target_link_libraries(addresseslocationviewer Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n)
set(addresslocationwidget_SRCS addresslocationwidgettest.cpp )
set(addresslocationwidget_SRCS addresslocationwidgettest.cpp ../addresslocationwidget.cpp)
add_executable(addresslocationwidget ${addresslocationwidget_SRCS})
add_test(addresslocationwidget addresslocationwidget)
ecm_mark_as_test(addresslocationwidget)
target_link_libraries(addresslocationwidget Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n)
target_link_libraries(addresslocationwidget Qt5::Test Qt5::Widgets KF5::AkonadiContact KF5::Contacts KF5::I18n KF5::Completion)
......@@ -22,8 +22,13 @@
#include "addresslocationwidgettest.h"
#include "../addresslocationwidget.h"
#include <QLabel>
#include <QPushButton>
#include <KComboBox>
#include <KLineEdit>
#include <QTest>
#include <QCheckBox>
AddressLocationWidgetTest::AddressLocationWidgetTest(QObject *parent)
: QObject(parent)
......@@ -38,7 +43,44 @@ AddressLocationWidgetTest::~AddressLocationWidgetTest()
void AddressLocationWidgetTest::shouldHaveDefaultValue()
{
//TODO
AddressLocationWidget w;
QLabel *streetlabel = w.findChild<QLabel *>(QStringLiteral("streetlabel"));
QVERIFY(streetlabel);
KLineEdit *mStreetEdit = w.findChild<KLineEdit *>(QStringLiteral("streetlineedit"));
QVERIFY(mStreetEdit);
QLabel *postofficeboxlabel = w.findChild<QLabel *>(QStringLiteral("postofficeboxlabel"));
QVERIFY(postofficeboxlabel);
KLineEdit *postofficeboxlineedit = w.findChild<KLineEdit *>(QStringLiteral("postofficeboxlineedit"));
QVERIFY(postofficeboxlineedit);
QLabel *localitylabel = w.findChild<QLabel *>(QStringLiteral("localitylabel"));
QVERIFY(localitylabel);
KLineEdit *localitylineedit = w.findChild<KLineEdit *>(QStringLiteral("localitylineedit"));
QVERIFY(localitylineedit);
QLabel *regionlabel = w.findChild<QLabel *>(QStringLiteral("regionlabel"));
QVERIFY(regionlabel);
KLineEdit *regionlineedit = w.findChild<KLineEdit *>(QStringLiteral("regionlineedit"));
QVERIFY(regionlineedit);
QLabel *postalcodelabel = w.findChild<QLabel *>(QStringLiteral("postalcodelabel"));
QVERIFY(postalcodelabel);
KLineEdit *postalcodelineedit = w.findChild<KLineEdit *>(QStringLiteral("postalcodelineedit"));
QVERIFY(postalcodelineedit);
QLabel *countrylabel = w.findChild<QLabel *>(QStringLiteral("countrylabel"));
QVERIFY(countrylabel);
KComboBox *countrycombobox = w.findChild<KComboBox *>(QStringLiteral("countrylabel"));
QVERIFY(countrycombobox);
QCheckBox *preferredcheckbox = w.findChild<QCheckBox *>(QStringLiteral("preferredcheckbox"));
QVERIFY(preferredcheckbox);
QPushButton *addbuttonaddress = w.findChild<QPushButton *>(QStringLiteral("addbuttonaddress"));
QVERIFY(addbuttonaddress);
}
QTEST_MAIN(AddressLocationWidgetTest)
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