libtaskmanager: Fix autotest

The test depends on the applications being installed and the path being
correctly set. To make it more robust the path is set inside of the test
and the files the test used are shipped with it.
wilder-5.22
Alexander Lohnau 5 years ago committed by Aleix Pol Gonzalez
parent 2b07e0ce70
commit af38078ecd
  1. 15
      libtaskmanager/autotests/data/applications/org.kde.dolphin.desktop
  2. 15
      libtaskmanager/autotests/data/applications/org.kde.konversation.desktop
  3. 12
      libtaskmanager/autotests/launchertasksmodeltest.cpp

@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
[Desktop Entry]
Name=Dolphin
Exec=dolphin %u
Icon=system-file-manager
Type=Application
X-DocPath=dolphin/index.html
Categories=Qt;KDE;System;FileTools;FileManager;
GenericName=File Manager
Terminal=false
MimeType=inode/directory;
InitialPreference=10
X-DBUS-ServiceName=org.kde.dolphin
StartupWMClass=dolphin

@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: none
# SPDX-License-Identifier: CC0-1.0
[Desktop Entry]
Type=Application
Exec=konversation -qwindowtitle %c %u
Icon=konversation
X-DocPath=konversation/index.html
MimeType=x-scheme-handler/irc;x-scheme-handler/ircs;
GenericName=IRC Client
Terminal=false
Name=Konversation
Categories=Qt;KDE;Network;IRCClient;
X-DBUS-StartupType=Unique
X-DBUS-ServiceName=org.kde.konversation
StartupNotify=true

@ -1,5 +1,6 @@
/********************************************************************
Copyright 2016 Eike Hein <hein@kde.org>
Copyright 2021 Alexander Lohnau <alexander.lohnau@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -49,8 +50,10 @@ private:
void LauncherTasksModelTest::initTestCase()
{
qApp->setProperty("org.kde.KActivities.core.disableAutostart", true);
m_urlStrings << QLatin1String("file:///usr/share/applications/org.kde.systemmonitor.desktop");
m_urlStrings << QLatin1String("file:///usr/share/applications/org.kde.konversation.desktop");
m_urlStrings = QStringList{QUrl::fromLocalFile(QFINDTESTDATA("data/applications/org.kde.dolphin.desktop")).toString(),
QUrl::fromLocalFile(QFINDTESTDATA("data/applications/org.kde.konversation.desktop")).toString()};
// We don't want the globally installed apps to interfere and want the test to use our data files
qputenv("XDG_DATA_DIRS", QFINDTESTDATA("data").toLocal8Bit());
}
void LauncherTasksModelTest::shouldRoundTripLauncherUrlList()
@ -113,9 +116,8 @@ void LauncherTasksModelTest::shouldRejectDuplicates()
{
LauncherTasksModel m;
QStringList urlStrings;
urlStrings << QLatin1String("file:///usr/share/applications/org.kde.dolphin.desktop");
urlStrings << QLatin1String("file:///usr/share/applications/org.kde.dolphin.desktop");
const QStringList urlStrings = {QUrl::fromLocalFile(QFINDTESTDATA("data/applications/org.kde.dolphin.desktop")).toString(),
QUrl::fromLocalFile(QFINDTESTDATA("data/applications/org.kde.dolphin.desktop")).toString()};
QSignalSpy launcherListChangedSpy(&m, &LauncherTasksModel::launcherListChanged);
QVERIFY(launcherListChangedSpy.isValid());

Loading…
Cancel
Save