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 "notedisplayattributetest.h" 0008 #include "notedisplayattribute.h" 0009 0010 #include <QFontDatabase> 0011 0012 #include <QTest> 0013 0014 NoteDisplayAttributeTest::NoteDisplayAttributeTest(QObject *parent) 0015 : QObject(parent) 0016 { 0017 } 0018 0019 NoteDisplayAttributeTest::~NoteDisplayAttributeTest() = default; 0020 0021 void NoteDisplayAttributeTest::shouldHaveDefaultValue() 0022 { 0023 NoteShared::NoteDisplayAttribute attribute; 0024 QVERIFY(attribute.autoIndent()); 0025 QVERIFY(!attribute.keepBelow()); 0026 QVERIFY(!attribute.keepAbove()); 0027 QVERIFY(!attribute.showInTaskbar()); 0028 QVERIFY(!attribute.isHidden()); 0029 //@krazy:cond=qenums because everyone expects yellow postit notes 0030 QCOMPARE(attribute.backgroundColor(), QColor(Qt::yellow)); 0031 QCOMPARE(attribute.foregroundColor(), QColor(Qt::black)); 0032 //@krazy:endcond=qenums 0033 QVERIFY(attribute.rememberDesktop()); 0034 QCOMPARE(attribute.tabSize(), 4); 0035 QCOMPARE(attribute.font(), QFontDatabase::systemFont(QFontDatabase::GeneralFont)); 0036 QCOMPARE(attribute.titleFont(), QFontDatabase::systemFont(QFontDatabase::TitleFont)); 0037 QCOMPARE(attribute.size(), QSize(300, 300)); 0038 QCOMPARE(attribute.desktop(), -10); 0039 QCOMPARE(attribute.position(), QPoint(-10000, -10000)); 0040 } 0041 0042 void NoteDisplayAttributeTest::shouldEqualWhenCloning() 0043 { 0044 NoteShared::NoteDisplayAttribute attribute; 0045 NoteShared::NoteDisplayAttribute *attr2 = attribute.clone(); 0046 QVERIFY(attribute == *attr2); 0047 delete attr2; 0048 0049 attribute.setBackgroundColor(QColor("#454545")); 0050 attribute.setForegroundColor(QColor("#454545")); 0051 attribute.setSize(QSize(50, 70)); 0052 attribute.setRememberDesktop(false); 0053 attribute.setTabSize(8); 0054 attribute.setFont(QFont()); 0055 attribute.setTitleFont(QFont()); 0056 attribute.setDesktop(7); 0057 attribute.setIsHidden(true); 0058 attribute.setPosition(QPoint(7, 8)); 0059 attribute.setShowInTaskbar(false); 0060 attribute.setKeepAbove(false); 0061 attribute.setKeepBelow(false); 0062 attribute.setAutoIndent(false); 0063 attr2 = attribute.clone(); 0064 QVERIFY(attribute == *attr2); 0065 delete attr2; 0066 } 0067 0068 void NoteDisplayAttributeTest::shouldHaveType() 0069 { 0070 NoteShared::NoteDisplayAttribute attribute; 0071 QCOMPARE(attribute.type(), QByteArray("NoteDisplayAttribute")); 0072 } 0073 0074 QTEST_GUILESS_MAIN(NoteDisplayAttributeTest) 0075 0076 #include "moc_notedisplayattributetest.cpp"