notealarmattributetest.cpp 1.47 KB
Newer Older
1
/*
Laurent Montel's avatar
Laurent Montel committed
2
   SPDX-FileCopyrightText: 2014-2021 Laurent Montel <montel@kde.org>
Laurent Montel's avatar
Laurent Montel committed
3

4
   SPDX-License-Identifier: GPL-2.0-or-later
5 6 7
*/

#include "notealarmattributetest.h"
8 9 10 11
#include "notealarmattribute.h"

#include <QTest>

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
NoteAlarmAttributeTest::NoteAlarmAttributeTest(QObject *parent)
    : QObject(parent)
{
}

NoteAlarmAttributeTest::~NoteAlarmAttributeTest()
{
}

void NoteAlarmAttributeTest::shouldHaveDefaultValue()
{
    NoteShared::NoteAlarmAttribute attr;
    QVERIFY(!attr.dateTime().isValid());
}

void NoteAlarmAttributeTest::shouldAssignValue()
{
    const QDateTime dt = QDateTime::currentDateTime();
    NoteShared::NoteAlarmAttribute attr;
    attr.setDateTime(dt);
    QCOMPARE(dt, attr.dateTime());
}

void NoteAlarmAttributeTest::shouldCloneAttr()
{
    const QDateTime dt = QDateTime::currentDateTime();
    NoteShared::NoteAlarmAttribute attr;
    attr.setDateTime(dt);
    NoteShared::NoteAlarmAttribute *result = attr.clone();
    QVERIFY(attr == *result);
    delete result;
}

void NoteAlarmAttributeTest::shouldSerializeAttr()
{
    const QDateTime dt = QDateTime::currentDateTime();
    NoteShared::NoteAlarmAttribute attr;
    attr.setDateTime(dt);
    const QByteArray ba = attr.serialized();
    NoteShared::NoteAlarmAttribute result;
    result.deserialize(ba);
    QVERIFY(attr == result);
}

void NoteAlarmAttributeTest::shouldHaveType()
{
    NoteShared::NoteAlarmAttribute attr;
    QCOMPARE(attr.type(), QByteArray("NoteAlarmAttribute"));
}

Laurent Montel's avatar
Laurent Montel committed
62
QTEST_GUILESS_MAIN(NoteAlarmAttributeTest)