Changeset View
Changeset View
Standalone View
Standalone View
tests/benchmarks/serializerTest.cpp
Show All 18 Lines | 1 | /* This file is part of Zanshin | |||
---|---|---|---|---|---|
19 | along with this program; if not, write to the Free Software | 19 | along with this program; if not, write to the Free Software | ||
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | 20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, | ||
21 | USA. | 21 | USA. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #include <testlib/qtest_zanshin.h> | 24 | #include <testlib/qtest_zanshin.h> | ||
25 | #include <AkonadiCore/Item> | 25 | #include <AkonadiCore/Item> | ||
26 | #include <KCalCore/Todo> | 26 | #include <KCalCore/Todo> | ||
27 | #include <kcalcore_version.h> | ||||
27 | #include "domain/task.h" | 28 | #include "domain/task.h" | ||
28 | #include "akonadi/akonadiserializer.h" | 29 | #include "akonadi/akonadiserializer.h" | ||
29 | 30 | | |||
30 | class SerializerBenchmark : public QObject | 31 | class SerializerBenchmark : public QObject | ||
31 | { | 32 | { | ||
32 | Q_OBJECT | 33 | Q_OBJECT | ||
33 | 34 | | |||
34 | Akonadi::Item createTestItem(); | 35 | Akonadi::Item createTestItem(); | ||
35 | private slots: | 36 | private slots: | ||
36 | void deserialize(); | 37 | void deserialize(); | ||
37 | void checkPayloadAndDeserialize(); | 38 | void checkPayloadAndDeserialize(); | ||
38 | void deserializeAndDestroy(); | 39 | void deserializeAndDestroy(); | ||
39 | void checkPayload(); | 40 | void checkPayload(); | ||
40 | }; | 41 | }; | ||
41 | 42 | | |||
43 | #if KCALCORE_VERSION >= QT_VERSION_CHECK(5, 6, 80) | ||||
44 | #define KDateTime QDateTime | ||||
45 | #endif | ||||
46 | | ||||
42 | Akonadi::Item SerializerBenchmark::createTestItem() | 47 | Akonadi::Item SerializerBenchmark::createTestItem() | ||
43 | { | 48 | { | ||
44 | KCalCore::Todo::Ptr todo(new KCalCore::Todo); | 49 | KCalCore::Todo::Ptr todo(new KCalCore::Todo); | ||
45 | todo->setSummary(QStringLiteral("summary")); | 50 | todo->setSummary(QStringLiteral("summary")); | ||
46 | todo->setDescription(QStringLiteral("content")); | 51 | todo->setDescription(QStringLiteral("content")); | ||
47 | todo->setCompleted(false); | 52 | todo->setCompleted(false); | ||
48 | todo->setDtStart(KDateTime(QDateTime(QDate(2013, 11, 24)))); | 53 | todo->setDtStart(KDateTime(QDateTime(QDate(2013, 11, 24)))); | ||
49 | todo->setDtDue(KDateTime(QDateTime(QDate(2014, 03, 01)))); | 54 | todo->setDtDue(KDateTime(QDateTime(QDate(2014, 03, 01)))); | ||
▲ Show 20 Lines • Show All 65 Lines • Show Last 20 Lines |