add more spacing
[personal-kdebase.git] / runtime / phonon / tests / audiodevicelisttest.cpp
blobbd1a7076149b86866da2c661ad906e20d576416a
1 /* This file is part of the KDE project
2 Copyright (C) 2006 Matthias Kretz <kretz@kde.org>
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) version 3.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <QtCore/QDebug>
19 #include <QtCore/QObject>
21 #include <qtest_kde.h>
23 #include "../libkaudiodevicelist/audiodeviceenumerator.h"
25 class SimpleTest : public QObject
27 Q_OBJECT
29 private Q_SLOTS:
30 void sanityChecks();
31 void listDevices();
32 void checkCopy();
35 using namespace Phonon;
37 void SimpleTest::sanityChecks()
39 QVERIFY(AudioDeviceEnumerator::self() != 0);
42 void SimpleTest::listDevices()
44 QList<AudioDevice> deviceList = AudioDeviceEnumerator::availablePlaybackDevices();
45 foreach (const AudioDevice &dev, deviceList) {
46 qDebug() << dev.cardName() << dev.deviceIds() << dev.iconName() << dev.isAvailable();
47 foreach (const QString &id, dev.deviceIds()) {
48 QVERIFY(dev.deviceIds().count(id) == 1);
53 void SimpleTest::checkCopy()
55 QList<AudioDevice> deviceList = AudioDeviceEnumerator::availablePlaybackDevices();
56 if (deviceList.count() > 0) {
57 AudioDevice dev = deviceList.first();
58 QCOMPARE(dev, deviceList.first());
59 AudioDevice dev1;
60 AudioDevice dev2;
61 QCOMPARE(dev1, dev2);
62 QVERIFY(dev1 != dev);
63 QVERIFY(dev2 != dev);
64 dev1 = dev;
65 QCOMPARE(dev1, dev);
66 QCOMPARE(dev1, deviceList.first());
67 QVERIFY(dev1 != dev2);
71 QTEST_KDEMAIN_CORE(SimpleTest)
72 #include "audiodevicelisttest.moc"
73 // vim: sw=4 ts=4 et tw=100