diff --git a/kdecore/tests/CMakeLists.txt b/kdecore/tests/CMakeLists.txt index dbddbfe4..a68fc570 100644 --- a/kdecore/tests/CMakeLists.txt +++ b/kdecore/tests/CMakeLists.txt @@ -54,7 +54,6 @@ KDECORE_UNIT_TESTS( kconfigafterkglobaltest2 ksycocathreadtest qcoreapptest - kmimetype_nomimetypes kunitconversiontest kdevicedatabasetest kdebugtest diff --git a/kdecore/tests/kmimetype_nomimetypes.cpp b/kdecore/tests/kmimetype_nomimetypes.cpp deleted file mode 100644 index 9dddd1f6..00000000 --- a/kdecore/tests/kmimetype_nomimetypes.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* This file is part of the KDE project - Copyright (C) 2011 David Faure - - 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 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. - -*/ - -#include -#include -#include -#include -#include -#include -#include - -class KTestMessageHandler : public KMessageHandler -{ -public: - virtual void message(KMessage::MessageType type, const QString &text, const QString &caption) - { - Q_UNUSED(type); - Q_UNUSED(caption); - m_messages.append(text); - } - - QStringList m_messages; -}; - -int main(int argc, char **argv) -{ - QCoreApplication app(argc, argv); - - // Test what happens when there are no mimetypes installed. - - ::setenv("XDG_DATA_DIRS", "/doesnotexist", 1); - - KComponentData cData("foo"); - - KTestMessageHandler* msgHandler = new KTestMessageHandler; - KMessage::setMessageHandler(msgHandler); - - KMimeType::Ptr s0 = KMimeType::mimeType("application/x-zerosize"); - Q_ASSERT(!s0); - if (s0) { - qFatal("application/x-zerosize should NOT be found, otherwise this test is bogus!"); - return 1; - } - - KMimeType::Ptr mime = KMimeType::findByUrl(KUrl("/")); - Q_ASSERT(mime); - Q_ASSERT(mime->name() == "application/octet-stream"); - if (!mime) { - qFatal("application/octet-stream should be found, otherwise this test is bogus!"); - return 2; - } - qDebug() << mime->name(); - - Q_ASSERT(msgHandler->m_messages.count() > 0); - - return 0; -} -