mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kio: test KDirLister::openUrl()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ce3c7b0195
commit
3849efb2b0
4 changed files with 47 additions and 61 deletions
|
@ -1,10 +1,9 @@
|
||||||
/* This file is part of the KDE project
|
/* This file is part of the KDE libraries
|
||||||
Copyright (C) 2007 David Faure <faure@kde.org>
|
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
License as published by the Free Software Foundation; either
|
License version 2, as published by the Free Software Foundation.
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -18,35 +17,32 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kdirlistertest.h"
|
#include "kdirlistertest.h"
|
||||||
#include <ktemporaryfile.h>
|
#include "kdebug.h"
|
||||||
#include <kdirnotify.h>
|
|
||||||
#include <kdirlister.h>
|
|
||||||
#include <qtest_kde.h>
|
#include <qtest_kde.h>
|
||||||
|
#include "kiotesthelper.h"
|
||||||
|
|
||||||
QTEST_KDEMAIN(KDirListerTest, NoGUI)
|
QTEST_KDEMAIN(KDirListerTest, NoGUI)
|
||||||
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include "kiotesthelper.h"
|
|
||||||
#include <kio/deletejob.h>
|
|
||||||
#include <kdirwatch.h>
|
|
||||||
#include <kio/job.h>
|
|
||||||
#include <kio/copyjob.h>
|
|
||||||
|
|
||||||
void KDirListerTest::initTestCase()
|
void KDirListerTest::initTestCase()
|
||||||
{
|
{
|
||||||
// Must be done before the QSignalSpys connect
|
m_tempDir = new KTempDir();
|
||||||
qRegisterMetaType<KUrl>();
|
m_dirLister = new KDirLister();
|
||||||
qRegisterMetaType<KFileItem>();
|
|
||||||
qRegisterMetaType<KFileItemList>();
|
qDebug() << Q_FUNC_INFO << m_tempDir->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
void KDirListerTest::cleanup()
|
void KDirListerTest::cleanupTestCase()
|
||||||
{
|
{
|
||||||
|
delete m_dirLister;
|
||||||
|
m_dirLister = nullptr;
|
||||||
|
delete m_tempDir;
|
||||||
|
m_tempDir = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void KDirListerTest::testOpenUrl()
|
void KDirListerTest::testOpenUrl()
|
||||||
{
|
{
|
||||||
// TODO:
|
m_dirLister->openUrl(KUrl(m_tempDir->name()));
|
||||||
|
QTest::kWaitForSignal(m_dirLister, SIGNAL(completed()), 5000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "moc_kdirlistertest.cpp"
|
#include "moc_kdirlistertest.cpp"
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
/* This file is part of the KDE project
|
/* This file is part of the KDE libraries
|
||||||
Copyright (C) 2007 David Faure <faure@kde.org>
|
Copyright (C) 2023 Ivailo Monev <xakepa10@gmail.com>
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Library General Public
|
modify it under the terms of the GNU Library General Public
|
||||||
License as published by the Free Software Foundation; either
|
License version 2, as published by the Free Software Foundation.
|
||||||
version 2 of the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
@ -16,31 +15,25 @@
|
||||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef KDIRLISTERTEST_H
|
#ifndef KDIRLISTERTEST_H
|
||||||
#define KDIRLISTERTEST_H
|
#define KDIRLISTERTEST_H
|
||||||
|
|
||||||
#include <QSignalSpy>
|
#include "ktempdir.h"
|
||||||
#include <QObject>
|
#include "kdirlister.h"
|
||||||
#include <QEventLoop>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <ktempdir.h>
|
|
||||||
#include <kdirlister.h>
|
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(KFileItemList)
|
|
||||||
|
|
||||||
class KDirListerTest : public QObject
|
class KDirListerTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void initTestCase();
|
void initTestCase();
|
||||||
void cleanup();
|
void cleanupTestCase();
|
||||||
|
|
||||||
void testOpenUrl();
|
void testOpenUrl();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KTempDir m_tempDir;
|
KTempDir* m_tempDir;
|
||||||
|
KDirLister* m_dirLister;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif // KDIRLISTERTEST_H
|
||||||
#endif
|
|
||||||
|
|
|
@ -35,12 +35,9 @@
|
||||||
|
|
||||||
QTEST_KDEMAIN(KDirModelTest, NoGUI)
|
QTEST_KDEMAIN(KDirModelTest, NoGUI)
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(KFileItemList)
|
|
||||||
|
|
||||||
void KDirModelTest::initTestCase()
|
void KDirModelTest::initTestCase()
|
||||||
{
|
{
|
||||||
qRegisterMetaType<QModelIndex>("QModelIndex");
|
qRegisterMetaType<QModelIndex>("QModelIndex");
|
||||||
qRegisterMetaType<KFileItemList>("KFileItemList");
|
|
||||||
|
|
||||||
m_tempDir = new KTempDir();
|
m_tempDir = new KTempDir();
|
||||||
m_dirModel = new KDirModel();
|
m_dirModel = new KDirModel();
|
||||||
|
|
|
@ -34,8 +34,8 @@ private Q_SLOTS:
|
||||||
void testIndexForItem();
|
void testIndexForItem();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
KDirModel* m_dirModel;
|
|
||||||
KTempDir* m_tempDir;
|
KTempDir* m_tempDir;
|
||||||
|
KDirModel* m_dirModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KDIRMODELTEST_H
|
#endif // KDIRMODELTEST_H
|
||||||
|
|
Loading…
Add table
Reference in a new issue