dtor first
[personal-kdebase.git] / workspace / libs / solid / control / tests / solidbluetoothtest.cpp
blob85bf95531391e897d479478f85bf7a2c297420b6
1 /* This file is part of the KDE project
2 Copyright (C) 2005 Kevin Ottens <ervin@kde.org>
3 Copyright (C) 2007 Daniel Gollub <dgollub@suse.de>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License version 2 as published by the Free Software Foundation.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 #include "solidbluetoothtest.h"
24 #include <qtest_kde.h>
26 #include <solid/control/bluetoothmanager.h>
27 #include <solid/control/bluetoothinterface.h>
28 #include "solid/control/managerbase_p.h"
29 #include <kdebug.h>
31 #include <fakebluetoothmanager.h>
33 #ifndef FAKE_BLUETOOTH_XML
34 #error "FAKE_BLUETOOTH_XML not set. An XML file describing a bluetooth context is required for this test"
35 #endif
37 QTEST_KDEMAIN_CORE(SolidBluetoothTest)
39 void SolidBluetoothTest::initTestCase()
41 fakeManager = new FakeBluetoothManager(0, QStringList(), FAKE_BLUETOOTH_XML);
42 Solid::Control::ManagerBasePrivate::_k_forcePreloadedBackend("Solid::Control::Ifaces::BluetoothManager", fakeManager);
45 void SolidBluetoothTest::testBluetoothInterfaces()
47 Solid::Control::BluetoothManager &manager = Solid::Control::BluetoothManager::self();
49 Solid::Control::BluetoothInterfaceList interfaces = manager.bluetoothInterfaces();
51 // Verify that the framework reported correctly the interfaces available
52 // in the backend.
53 QSet<QString> expected_ubis, received_ubis;
55 expected_ubis = QSet<QString>::fromList(fakeManager->bluetoothInterfaces());
57 foreach (Solid::Control::BluetoothInterface iface , interfaces) {
58 received_ubis << iface.ubi();
61 QCOMPARE(expected_ubis, received_ubis);
64 void SolidBluetoothTest::testManagerBasicFeatures()
66 //Solid::Control::BluetoothManager &manager = Solid::Control::BluetoothManager::self();
70 void SolidBluetoothTest::testInterfaceBasicFeatures()
72 //Solid::Control::BluetoothManager &manager = Solid::Control::BluetoothManager::self();
74 // Retrieve a valid BluetoothInterface object
75 Solid::Control::BluetoothInterface valid_iface("/org/kde/solid/fakebluetooth/hci0");
79 #include "solidbluetoothtest.moc"