File indexing completed on 2024-04-28 03:51:39

0001 /*
0002     This file is part of the KDE Baloo project.
0003     SPDX-FileCopyrightText: 2015 Vishesh Handa <vhanda@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.1-or-later
0006 */
0007 
0008 #include "idfilenamedb.h"
0009 #include "singledbtest.h"
0010 
0011 using namespace Baloo;
0012 
0013 class IdFilenameDBTest : public SingleDBTest
0014 {
0015     Q_OBJECT
0016 private Q_SLOTS:
0017     void test() {
0018         IdFilenameDB db(IdFilenameDB::create(m_txn), m_txn);
0019 
0020         IdFilenameDB::FilePath path;
0021         path.parentId = 5;
0022         path.name = "fire";
0023 
0024         db.put(1, path);
0025 
0026         QCOMPARE(db.get(1), path);
0027 
0028         db.del(1);
0029         QCOMPARE(db.get(1), IdFilenameDB::FilePath());
0030     }
0031 };
0032 
0033 QTEST_MAIN(IdFilenameDBTest)
0034 
0035 #include "idfilenamedbtest.moc"