1 /* This file is part of the KDE project
2 Copyright (C) 2006 Will Stephenson <wstephenson@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 // KDE-QTestLib include
23 #include <qtest_kde.h>
25 #include "fakebluetoothmanager.h"
27 #include "fakebluetoothtest.h"
29 QTEST_KDEMAIN_CORE(FakeBluetooth_Test
)
31 void FakeBluetooth_Test::testFakeBluetooth()
33 FakeBluetoothManager
*fbm
= new FakeBluetoothManager(0, QStringList(), TEST_DATA
);
34 QVERIFY(!fbm
->bluetoothInterfaces().isEmpty());
36 // Bluetooth Interface
37 FakeBluetoothInterface
*interface
= static_cast<FakeBluetoothInterface
*>(fbm
->createBluetoothInterface("/org/kde/solid/fakebluetooth/hci0"));
39 QCOMPARE(interface
->ubi(), QString("/org/kde/solid/fakebluetooth/hci0"));
40 QCOMPARE(interface
->address(), QString("00:E0:98:DD:4E:FF"));
41 QCOMPARE(interface
->version(), QString("Bluetooth 1.1"));
42 QCOMPARE(interface
->revision(), QString("Build 525"));
43 QCOMPARE(interface
->name(), QString("Daniel's Laptop"));
45 interface
->setName("CrashDummy");
46 QCOMPARE(interface
->name(), QString("CrashDummy"));
48 // Bluetooth Remote Devices
49 QCOMPARE(interface
->bluetoothRemoteDevices().count(), 4);
50 kDebug() << "REMOTE DEVICES: " << interface
->bluetoothRemoteDevices();
51 FakeBluetoothRemoteDevice
*device
=
52 static_cast<FakeBluetoothRemoteDevice
*>(interface
->createBluetoothRemoteDevice("/org/kde/solid/fakebluetooth/hci0/EE:EE:EE:EE:EE:EE"));
54 QCOMPARE(device
->name(), QString("N800"));
55 QCOMPARE(device
->alias(), QString("My N800"));
57 // Bluetooth Interface
58 interface
= static_cast<FakeBluetoothInterface
*>(fbm
->createBluetoothInterface("/org/kde/solid/fakebluetooth/XXX"));
60 QCOMPARE(interface
->ubi(), QString("/org/kde/solid/fakebluetooth/XXX"));
61 QCOMPARE(interface
->address(), QString("AA:FF:EE:AA:FF:EE"));
62 QCOMPARE(interface
->version(), QString("Bluetooth 2.0"));
63 QCOMPARE(interface
->company(), QString(""));
64 QCOMPARE(interface
->name(), QString("BlueZ (0) sugga"));
66 interface
->setName("CrashDummy2");
67 QCOMPARE(interface
->name(), QString("CrashDummy2"));
72 #include "fakebluetoothtest.moc"