diff --git a/kio/tests/kdirlistertest.cpp b/kio/tests/kdirlistertest.cpp index 41d66b27..734cfe3b 100644 --- a/kio/tests/kdirlistertest.cpp +++ b/kio/tests/kdirlistertest.cpp @@ -1,52 +1,48 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure +/* This file is part of the KDE libraries + Copyright (C) 2023 Ivailo Monev - 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 free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2, as published by the Free Software Foundation. - 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. + 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. + 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 "kdirlistertest.h" -#include -#include -#include +#include "kdebug.h" #include +#include "kiotesthelper.h" QTEST_KDEMAIN(KDirListerTest, NoGUI) -#include -#include "kiotesthelper.h" -#include -#include -#include -#include - void KDirListerTest::initTestCase() { - // Must be done before the QSignalSpys connect - qRegisterMetaType(); - qRegisterMetaType(); - qRegisterMetaType(); + m_tempDir = new KTempDir(); + m_dirLister = new KDirLister(); + + 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() { - // TODO: + m_dirLister->openUrl(KUrl(m_tempDir->name())); + QTest::kWaitForSignal(m_dirLister, SIGNAL(completed()), 5000); } #include "moc_kdirlistertest.cpp" diff --git a/kio/tests/kdirlistertest.h b/kio/tests/kdirlistertest.h index b4b0cd36..5759ede1 100644 --- a/kio/tests/kdirlistertest.h +++ b/kio/tests/kdirlistertest.h @@ -1,46 +1,39 @@ -/* This file is part of the KDE project - Copyright (C) 2007 David Faure +/* This file is part of the KDE libraries + Copyright (C) 2023 Ivailo Monev - 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 free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License version 2, as published by the Free Software Foundation. - 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. + 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. + 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 KDIRLISTERTEST_H #define KDIRLISTERTEST_H -#include -#include -#include -#include -#include -#include -#include - -Q_DECLARE_METATYPE(KFileItemList) +#include "ktempdir.h" +#include "kdirlister.h" class KDirListerTest : public QObject { Q_OBJECT private Q_SLOTS: void initTestCase(); - void cleanup(); + void cleanupTestCase(); void testOpenUrl(); private: - KTempDir m_tempDir; + KTempDir* m_tempDir; + KDirLister* m_dirLister; }; - -#endif +#endif // KDIRLISTERTEST_H diff --git a/kio/tests/kdirmodeltest.cpp b/kio/tests/kdirmodeltest.cpp index e914ad60..25312055 100644 --- a/kio/tests/kdirmodeltest.cpp +++ b/kio/tests/kdirmodeltest.cpp @@ -35,12 +35,9 @@ QTEST_KDEMAIN(KDirModelTest, NoGUI) -Q_DECLARE_METATYPE(KFileItemList) - void KDirModelTest::initTestCase() { qRegisterMetaType("QModelIndex"); - qRegisterMetaType("KFileItemList"); m_tempDir = new KTempDir(); m_dirModel = new KDirModel(); diff --git a/kio/tests/kdirmodeltest.h b/kio/tests/kdirmodeltest.h index 3a472eff..aeb9107b 100644 --- a/kio/tests/kdirmodeltest.h +++ b/kio/tests/kdirmodeltest.h @@ -34,8 +34,8 @@ private Q_SLOTS: void testIndexForItem(); private: - KDirModel* m_dirModel; KTempDir* m_tempDir; + KDirModel* m_dirModel; }; #endif // KDIRMODELTEST_H