File indexing completed on 2024-11-24 04:44:09
0001 /* 0002 * SPDX-FileCopyrightText: 2012 Christian Mollekopf <mollekopf@kolabsys.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 #pragma once 0008 #include <QObject> 0009 0010 /** 0011 * Test complete serialization from mime message to KCalendarCore/KContacts containers. 0012 * 0013 * The .ics .vcf files serve as reference, under the assumption that the iCal/vCard implementations don't have bugs. 0014 * 0015 * The .ics.mime/.vcf.mime messages are first used to test parsing, and then to compare the result after serialization. 0016 * The mime files are of course just a snapshot of how it is thought that the result should be. 0017 * The files may have bugs themselves and will need to be updated to reflect future changes. 0018 * 0019 * kompare (the kde diff tool) is launched if a test fails to show you the difference between expected and actual conversion. 0020 * Comment the code if you don't want it. 0021 * 0022 * Note that some parts of the mime message are not compared, but show up in kompare as difference: 0023 * * Date-Header 0024 * * Content-Type-Header 0025 * * next-part markers 0026 * * Content-ID Header 0027 * 0028 * These are safe to be ignored as they are randomly generated. 0029 * 0030 * To generate the reference files, you can write the vcf/ics by hand and generate the mime message from that one (using the generateMimefile() function). 0031 * You may need to sort some things manually (addresses/phonenumbers), and generally check manually if everything is as it should be. 0032 * The test will then remain to ensure the same for future versions. 0033 * 0034 */ 0035 class FormatTest : public QObject 0036 { 0037 Q_OBJECT 0038 private Q_SLOTS: 0039 0040 void initTestCase(); 0041 0042 void testIncidence_data(); 0043 void testIncidence(); 0044 0045 void testContact_data(); 0046 void testContact(); 0047 0048 void testDistlist_data(); 0049 void testDistlist(); 0050 0051 void testNote_data(); 0052 void testNote(); 0053 0054 // Some pseudo tests and helper functions 0055 void generateMimefile(); 0056 void generateVCard(); 0057 void proveJPGisLossy(); 0058 };