on 44eced4 help sign in
unity8/tests/plugins/Unity/Launcher/launcherbackendtest.cpp
62 lines 2.0 kB history raw
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Michael Terry <michael.terry@canonical.com>
18 * Michael Zanetti <michael.zanetti@canonical.com>
19 */
21#include "launcherbackend.h"
23#include <QtTest>
24#include <QDebug>
26class LauncherBackendTest : public QObject
28 Q_OBJECT
30private Q_SLOTS:
31 void testFileNames()
32 {
33 LauncherBackend backend(false);
35 backend.setStoredApplications(QStringList() << "relative.path" << "/full/path");
36 QCOMPARE(backend.storedApplications(), QStringList() << "relative.path" << "/full/path");
37 }
39 void testPinning()
40 {
41 LauncherBackend backend(false);
43 backend.setStoredApplications(QStringList() << "one" << "two");
44 QCOMPARE(backend.isPinned("one"), false);
45 QCOMPARE(backend.isPinned("two"), false);
47 backend.setPinned("two", true);
48 QCOMPARE(backend.isPinned("two"), true);
50 backend.setStoredApplications(QStringList() << "one" << "two" << "three");
51 QCOMPARE(backend.isPinned("two"), true);
52 QCOMPARE(backend.isPinned("three"), false);
54 backend.setPinned("three", true);
55 backend.setStoredApplications(QStringList() << "one" << "two");
56 QCOMPARE(backend.isPinned("two"), true);
57 QCOMPARE(backend.isPinned("three"), false); // doesn't exist anymore!
58 }
59};
61QTEST_GUILESS_MAIN(LauncherBackendTest)
62#include "launcherbackendtest.moc"