File indexing completed on 2024-12-15 04:51:46

0001 /*
0002    SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "notealarmattributetest.h"
0008 #include "notealarmattribute.h"
0009 
0010 #include <QTest>
0011 
0012 NoteAlarmAttributeTest::NoteAlarmAttributeTest(QObject *parent)
0013     : QObject(parent)
0014 {
0015 }
0016 
0017 NoteAlarmAttributeTest::~NoteAlarmAttributeTest() = default;
0018 
0019 void NoteAlarmAttributeTest::shouldHaveDefaultValue()
0020 {
0021     NoteShared::NoteAlarmAttribute attr;
0022     QVERIFY(!attr.dateTime().isValid());
0023 }
0024 
0025 void NoteAlarmAttributeTest::shouldAssignValue()
0026 {
0027     const QDateTime dt = QDateTime::currentDateTime();
0028     NoteShared::NoteAlarmAttribute attr;
0029     attr.setDateTime(dt);
0030     QCOMPARE(dt, attr.dateTime());
0031 }
0032 
0033 void NoteAlarmAttributeTest::shouldCloneAttr()
0034 {
0035     const QDateTime dt = QDateTime::currentDateTime();
0036     NoteShared::NoteAlarmAttribute attr;
0037     attr.setDateTime(dt);
0038     NoteShared::NoteAlarmAttribute *result = attr.clone();
0039     QVERIFY(attr == *result);
0040     delete result;
0041 }
0042 
0043 void NoteAlarmAttributeTest::shouldSerializeAttr()
0044 {
0045     const QDateTime dt = QDateTime::currentDateTime();
0046     NoteShared::NoteAlarmAttribute attr;
0047     attr.setDateTime(dt);
0048     const QByteArray ba = attr.serialized();
0049     NoteShared::NoteAlarmAttribute result;
0050     result.deserialize(ba);
0051     QVERIFY(attr == result);
0052 }
0053 
0054 void NoteAlarmAttributeTest::shouldHaveType()
0055 {
0056     NoteShared::NoteAlarmAttribute attr;
0057     QCOMPARE(attr.type(), QByteArray("NoteAlarmAttribute"));
0058 }
0059 
0060 QTEST_GUILESS_MAIN(NoteAlarmAttributeTest)
0061 
0062 #include "moc_notealarmattributetest.cpp"