Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F16571265
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/kdecore/tests/kshareddatacachetest.cpp b/kdecore/tests/kshareddatacachetest.cpp
index 116cb1c4fd..1e5a8bd4f1 100644
--- a/kdecore/tests/kshareddatacachetest.cpp
+++ b/kdecore/tests/kshareddatacachetest.cpp
@@ -1,76 +1,75 @@
/* This file is part of the KDE libraries
* Copyright (c) 2012 David Faure <faure@kde.org>
*
* This library 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 2 of the License or ( at
* your option ) version 3 or, at the discretion of KDE e.V. ( which shall
* act as a proxy as in section 14 of the GPLv3 ), 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 Lesser 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 <kshareddatacache.h>
#include <qtest_kde.h>
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QDir>
#include <kstandarddirs.h>
#include <string.h> // strcpy
class KSharedDataCacheTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void simpleInsert();
};
void KSharedDataCacheTest::initTestCase()
{
}
void KSharedDataCacheTest::simpleInsert()
{
const QLatin1String cacheName("myTestCache");
const QLatin1String key("mypic");
// clear the cache
QString cacheFile = KGlobal::dirs()->locateLocal("cache", cacheName + QLatin1String(".kcache"));
QFile file(cacheFile);
if (file.exists())
QVERIFY(file.remove());
// insert something into it
KSharedDataCache cache(cacheName, 5*1024*1024);
QVERIFY(file.exists()); // make sure we got the cache filename right
QByteArray data;
data.resize(9228);
strcpy(data.data(), "Hello world");
QVERIFY(cache.insert(key, data));
// read it out again
QByteArray result;
QVERIFY(cache.find(key, &result));
QCOMPARE(result, data);
// another insert
strcpy(data.data(), "Hello KDE");
QVERIFY(cache.insert(key, data));
// and another read
QVERIFY(cache.find(key, &result));
- QEXPECT_FAIL("", "Bug in findNamedEntry!", Continue);
QCOMPARE(result, data);
}
QTEST_KDEMAIN_CORE(KSharedDataCacheTest)
#include "kshareddatacachetest.moc"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Fri, Nov 1, 10:05 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
10076343
Default Alt Text
(2 KB)
Attached To
Mode
rKL kdelibs
Attached
Detach File
Event Timeline
Log In to Comment