• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepim API Reference
  • KDE Home
  • Contact Us
 

kmail

  • sources
  • kde-4.14
  • kdepim
  • kmail
  • folderarchive
  • autotests
folderarchiveaccountinfotest.cpp
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014-2015 Montel Laurent <montel@kde.org>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "folderarchiveaccountinfotest.h"
19 #include "../folderarchiveaccountinfo.h"
20 #include <KGlobal>
21 #include <Akonadi/Collection>
22 #include <qtest_kde.h>
23 
24 
25 FolderArchiveAccountInfoTest::FolderArchiveAccountInfoTest(QObject *parent)
26  : QObject(parent)
27 {
28 
29 }
30 
31 FolderArchiveAccountInfoTest::~FolderArchiveAccountInfoTest()
32 {
33 
34 }
35 
36 void FolderArchiveAccountInfoTest::shouldHaveDefaultValue()
37 {
38  FolderArchiveAccountInfo info;
39  QVERIFY(info.instanceName().isEmpty());
40  QCOMPARE(info.archiveTopLevel(), Akonadi::Collection(-1).id());
41  QCOMPARE(info.folderArchiveType(), FolderArchiveAccountInfo::UniqueFolder);
42  QCOMPARE(info.enabled(), false);
43  QCOMPARE(info.keepExistingStructure(), false);
44  QCOMPARE(info.isValid(), false);
45 
46 }
47 
48 void FolderArchiveAccountInfoTest::shouldBeValid()
49 {
50  FolderArchiveAccountInfo info;
51  QVERIFY(!info.isValid());
52  info.setArchiveTopLevel(Akonadi::Collection(42).id());
53  QVERIFY(!info.isValid());
54  info.setInstanceName(QLatin1String("FOO"));
55  QVERIFY(info.isValid());
56 }
57 
58 void FolderArchiveAccountInfoTest::shouldRestoreFromSettings()
59 {
60  FolderArchiveAccountInfo info;
61  info.setInstanceName(QLatin1String("FOO1"));
62  info.setArchiveTopLevel(Akonadi::Collection(42).id());
63  info.setFolderArchiveType(FolderArchiveAccountInfo::FolderByMonths);
64  info.setEnabled(true);
65  info.setKeepExistingStructure(true);
66 
67  KConfigGroup grp(KGlobal::config(), "testsettings");
68  info.writeConfig(grp);
69 
70  FolderArchiveAccountInfo restoreInfo(grp);
71  QCOMPARE(info, restoreInfo);
72 }
73 
74 QTEST_KDEMAIN(FolderArchiveAccountInfoTest, NoGUI)
FolderArchiveAccountInfo::folderArchiveType
FolderArchiveType folderArchiveType() const
Definition: folderarchiveaccountinfo.cpp:53
FolderArchiveAccountInfo::setEnabled
void setEnabled(bool enabled)
Definition: folderarchiveaccountinfo.cpp:78
FolderArchiveAccountInfo::FolderByMonths
Definition: folderarchiveaccountinfo.h:33
FolderArchiveAccountInfoTest
Definition: folderarchiveaccountinfotest.h:24
FolderArchiveAccountInfo::setKeepExistingStructure
void setKeepExistingStructure(bool b)
Definition: folderarchiveaccountinfo.cpp:88
FolderArchiveAccountInfo::setInstanceName
void setInstanceName(const QString &instance)
Definition: folderarchiveaccountinfo.cpp:73
FolderArchiveAccountInfoTest::~FolderArchiveAccountInfoTest
~FolderArchiveAccountInfoTest()
Definition: folderarchiveaccountinfotest.cpp:31
FolderArchiveAccountInfo::instanceName
QString instanceName() const
Definition: folderarchiveaccountinfo.cpp:68
FolderArchiveAccountInfoTest::FolderArchiveAccountInfoTest
FolderArchiveAccountInfoTest(QObject *parent=0)
Definition: folderarchiveaccountinfotest.cpp:25
FolderArchiveAccountInfo::isValid
bool isValid() const
Definition: folderarchiveaccountinfo.cpp:43
FolderArchiveAccountInfo::setArchiveTopLevel
void setArchiveTopLevel(Akonadi::Collection::Id id)
Definition: folderarchiveaccountinfo.cpp:58
FolderArchiveAccountInfo::setFolderArchiveType
void setFolderArchiveType(FolderArchiveType type)
Definition: folderarchiveaccountinfo.cpp:48
QObject
QString::isEmpty
bool isEmpty() const
FolderArchiveAccountInfo::writeConfig
void writeConfig(KConfigGroup &config)
Definition: folderarchiveaccountinfo.cpp:107
FolderArchiveAccountInfo::archiveTopLevel
Akonadi::Collection::Id archiveTopLevel() const
Definition: folderarchiveaccountinfo.cpp:63
FolderArchiveAccountInfo
Definition: folderarchiveaccountinfo.h:24
FolderArchiveAccountInfo::enabled
bool enabled() const
Definition: folderarchiveaccountinfo.cpp:83
folderarchiveaccountinfotest.h
QLatin1String
FolderArchiveAccountInfo::UniqueFolder
Definition: folderarchiveaccountinfo.h:32
FolderArchiveAccountInfo::keepExistingStructure
bool keepExistingStructure() const
Definition: folderarchiveaccountinfo.cpp:93
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kmail

Skip menu "kmail"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal