Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Akonadi Contacts
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PIM
Akonadi Contacts
Commits
b43f8ecb
Commit
b43f8ecb
authored
Sep 11, 2009
by
Tobias Koenig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add first unit-test for akonadi-contact library
svn path=/trunk/KDE/kdepimlibs/; revision=1022308
parent
d4975a59
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
163 additions
and
1 deletion
+163
-1
akonadi/contact/CMakeLists.txt
akonadi/contact/CMakeLists.txt
+2
-0
akonadi/contact/akonadi-contactprivate_export.h
akonadi/contact/akonadi-contactprivate_export.h
+36
-0
akonadi/contact/contactmetadataattribute_p.h
akonadi/contact/contactmetadataattribute_p.h
+3
-1
akonadi/contact/tests/CMakeLists.txt
akonadi/contact/tests/CMakeLists.txt
+9
-0
akonadi/contact/tests/contactmetadataattributetest.cpp
akonadi/contact/tests/contactmetadataattributetest.cpp
+76
-0
akonadi/contact/tests/contactmetadataattributetest.h
akonadi/contact/tests/contactmetadataattributetest.h
+37
-0
No files found.
akonadi/contact/CMakeLists.txt
View file @
b43f8ecb
...
...
@@ -5,6 +5,8 @@ include_directories(
${
CMAKE_SOURCE_DIR
}
/kabc
)
add_subdirectory
(
tests
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII
${
KDE4_ENABLE_EXCEPTIONS
}
"
)
########### next target ###############
...
...
akonadi/contact/akonadi-contactprivate_export.h
0 → 100644
View file @
b43f8ecb
/* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef AKONADI_CONTACT_PRIVATE_EXPORT_H
#define AKONADI_CONTACT_PRIVATE_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
#ifndef AKONADI_CONTACT_TESTS_EXPORT
# if defined(MAKE_AKONADI_CONTACT_LIB)
/* We are building this library */
# define AKONADI_CONTACT_TESTS_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define AKONADI_CONTACT_TESTS_EXPORT KDE_IMPORT
# endif
#endif
#endif
akonadi/contact/contactmetadataattribute_p.h
View file @
b43f8ecb
...
...
@@ -22,6 +22,8 @@
#ifndef AKONADI_CONTACTMETADATAATTRIBUTE_P_H
#define AKONADI_CONTACTMETADATAATTRIBUTE_P_H
#include "akonadi-contactprivate_export.h"
#include <akonadi/attribute.h>
#include <QtCore/QVariant>
...
...
@@ -33,7 +35,7 @@ namespace Akonadi {
*
* @author Tobias Koenig <tokoe@kde.org>
*/
class
ContactMetaDataAttribute
:
public
Akonadi
::
Attribute
class
AKONADI_CONTACT_TESTS_EXPORT
ContactMetaDataAttribute
:
public
Akonadi
::
Attribute
{
public:
/**
...
...
akonadi/contact/tests/CMakeLists.txt
0 → 100644
View file @
b43f8ecb
set
(
EXECUTABLE_OUTPUT_PATH
${
CMAKE_CURRENT_BINARY_DIR
}
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
/akonadi/contact
)
########### next target ###############
set
(
contactmetadataattributetest_SRCS contactmetadataattributetest.cpp
)
kde4_add_unit_test
(
contactmetadataattributetest TESTNAME contactmetadataattributetest
${
contactmetadataattributetest_SRCS
}
)
target_link_libraries
(
contactmetadataattributetest
${
QT_QTTEST_LIBRARY
}
${
QT_QTCORE_LIBRARY
}
${
KDE4_KDECORE_LIBS
}
akonadi-contact
)
akonadi/contact/tests/contactmetadataattributetest.cpp
0 → 100644
View file @
b43f8ecb
/*
This file is part of Akonadi Contact.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#include "contactmetadataattributetest.h"
#include "contactmetadataattribute_p.h"
#include <qtest_kde.h>
QTEST_KDEMAIN
(
ContactMetaDataAttributeTest
,
NoGUI
)
static
QVariantMap
testData
()
{
QVariantMap
data
;
data
.
insert
(
QLatin1String
(
"key1"
),
QLatin1String
(
"value1"
)
);
data
.
insert
(
QLatin1String
(
"key2"
),
QLatin1String
(
"value2"
)
);
return
data
;
}
void
ContactMetaDataAttributeTest
::
type
()
{
Akonadi
::
ContactMetaDataAttribute
attribute
;
QVERIFY
(
attribute
.
type
()
==
"contactmetadata"
);
}
void
ContactMetaDataAttributeTest
::
clone
()
{
const
QVariantMap
content1
=
testData
();
Akonadi
::
ContactMetaDataAttribute
attribute1
;
attribute1
.
setMetaData
(
content1
);
Akonadi
::
ContactMetaDataAttribute
*
attribute2
=
static_cast
<
Akonadi
::
ContactMetaDataAttribute
*>
(
attribute1
.
clone
()
);
const
QVariantMap
content2
=
attribute2
->
metaData
();
QVERIFY
(
content1
==
content2
);
}
void
ContactMetaDataAttributeTest
::
serialization
()
{
const
QVariantMap
content1
=
testData
();
Akonadi
::
ContactMetaDataAttribute
attribute1
;
attribute1
.
setMetaData
(
content1
);
const
QByteArray
data
=
attribute1
.
serialized
();
Akonadi
::
ContactMetaDataAttribute
attribute2
;
attribute2
.
deserialize
(
data
);
const
QVariantMap
content2
=
attribute2
.
metaData
();
QVERIFY
(
content1
==
content2
);
}
#include "contactmetadataattributetest.moc"
akonadi/contact/tests/contactmetadataattributetest.h
0 → 100644
View file @
b43f8ecb
/*
This file is part of Akonadi Contact.
Copyright (c) 2009 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library 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 Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef CONTACTMETADATAATTRIBUTETEST_H
#define CONTACTMETADATAATTRIBUTETEST_H
#include <QtCore/QObject>
class
ContactMetaDataAttributeTest
:
public
QObject
{
Q_OBJECT
private
Q_SLOTS
:
void
type
();
void
clone
();
void
serialization
();
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment