File indexing completed on 2024-12-08 09:34:34
0001 /* 0002 This file is part of KDE. 0003 0004 SPDX-FileCopyrightText: 2010 Martin Sandsmark <martin.sandsmark@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "../privatedata.h" 0010 #include "../privatedataparser.h" 0011 #include <QTest> 0012 0013 using namespace Attica; 0014 0015 class PersonTest : public QObject 0016 { 0017 Q_OBJECT 0018 0019 private slots: 0020 void testParsing(); 0021 void testMergeType(); 0022 }; 0023 0024 void PersonTest::testParsing() 0025 { 0026 PrivateData::Parser parser; 0027 QString validData( 0028 "<?xml version=\"1.0\"?><ocs><attributes>" 0029 "<key>keyfoo</key>" 0030 "<value>valuebar</value>" 0031 "<changed>01.01.1998</changed>" 0032 "</attributes></ocs>"); 0033 PrivateData attributes = parser.parse(validData); 0034 QVERIFY(attributes.attributeChanged("keyfoo").isValid()); 0035 QVERIFY(!attributes.attribute("keyfoo").isNull()); 0036 } 0037 0038 void PersonTest::testMergeType() 0039 { 0040 PrivateData a; 0041 a.setMergeType(PrivateData::OverwriteLocal); 0042 QVERIFY(a.mergeType() == PrivateData::OverwriteLocal); 0043 } 0044 0045 QTEST_MAIN(PersonTest); 0046 0047 #include "moc_persontest.cxx"