File: xmlobjecttest.cpp

package info (click to toggle)
kdepim-runtime 4%3A20.08.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 25,680 kB
  • sloc: cpp: 94,670; xml: 981; sh: 101; javascript: 60; makefile: 13
file content (61 lines) | stat: -rw-r--r-- 2,143 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
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
/*
 * Copyright (C) 2012  Christian Mollekopf <mollekopf@kolabsys.com>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#include "xmlobjecttest.h"

#include <QTest>
#include <iostream>

#include "kolabformat/xmlobject.h"

void XMLObjectTest::testEvent()
{
    Kolab::Event event;
    event.setStart(Kolab::cDateTime(2012, 01, 01));

    Kolab::XMLObject xmlobject;
    const std::string output = xmlobject.writeEvent(event, Kolab::KolabV2, "productid");
    QVERIFY(!output.empty());
    std::cout << output;

    const Kolab::Event resultEvent = xmlobject.readEvent(output, Kolab::KolabV2);
    QVERIFY(resultEvent.isValid());
}

void XMLObjectTest::testDontCrash()
{
    Kolab::XMLObject ob;
    ob.writeEvent(Kolab::Event(), Kolab::KolabV2, "");
    ob.writeTodo(Kolab::Todo(), Kolab::KolabV2, "");
    ob.writeJournal(Kolab::Journal(), Kolab::KolabV2, "");
    ob.writeFreebusy(Kolab::Freebusy(), Kolab::KolabV2, "");
    ob.writeContact(Kolab::Contact(), Kolab::KolabV2, "");
    ob.writeDistlist(Kolab::DistList(), Kolab::KolabV2, "");
    ob.writeNote(Kolab::Note(), Kolab::KolabV2, "");
    ob.writeConfiguration(Kolab::Configuration(), Kolab::KolabV2, "");

    ob.readEvent("", Kolab::KolabV2);
    ob.readTodo("", Kolab::KolabV2);
    ob.readJournal("", Kolab::KolabV2);
    ob.readFreebusy("", Kolab::KolabV2);
    ob.readContact("", Kolab::KolabV2);
    ob.readDistlist("", Kolab::KolabV2);
    ob.readNote("", Kolab::KolabV2);
    ob.readConfiguration("", Kolab::KolabV2);
}

QTEST_MAIN(XMLObjectTest)