diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 72fe3f3f..eff65e5b 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -14,4 +14,4 @@ SOURCES += testjsonrpc.cpp \ HEADERS += mocktcpserver.h -LIBS += -L../mocks/mockdeviceplugin/ -lguh_devicepluginmockdevice +LIBS += -L$$top_builddir/plugins/deviceplugins/mock/ -lguh_devicepluginmock diff --git a/tests/auto/testjsonrpc.cpp b/tests/auto/testjsonrpc.cpp index 09244cb8..a7d53aff 100644 --- a/tests/auto/testjsonrpc.cpp +++ b/tests/auto/testjsonrpc.cpp @@ -24,7 +24,7 @@ #include //#include -Q_IMPORT_PLUGIN(DevicePluginMockDevice) +Q_IMPORT_PLUGIN(DevicePluginMock) class TestJSONRPC: public QObject { @@ -117,7 +117,7 @@ void TestJSONRPC::getSupportedDevices() // Make sure there is exactly 1 supported device class with the name Mock Wifi Device QCOMPARE(supportedDevices.toMap().value("params").toMap().value("deviceClasses").toList().count(), 1); QString deviceName = supportedDevices.toMap().value("params").toMap().value("deviceClasses").toList().first().toMap().value("name").toString(); - QCOMPARE(deviceName, QString("Mock WiFi Device")); + QCOMPARE(deviceName, QString("Mock Device")); } void TestJSONRPC::enableDisableNotifications_data() diff --git a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp deleted file mode 100644 index b8c527f0..00000000 --- a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** - * * - * This file is part of guh. * - * * - * Guh is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, version 2 of the License. * - * * - * Guh is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with guh. If not, see . * - * * - ***************************************************************************/ - -#include "devicepluginmockdevice.h" - -#include "device.h" -#include "devicemanager.h" - -#include -#include - -QUuid pluginUuid = QUuid("2ce2ebc6-7dbb-4b89-ad67-6226aa955041"); -QUuid mockWifiDetectorId = QUuid("37279e41-a478-43fa-92b4-c889db578670"); -QUuid inRangeStateTypeId = QUuid("110deaf9-5615-4e08-942b-d5443a3bf965"); -QUuid inRangeEventTypeId = QUuid("7f77120e-b3d1-493f-936e-9d86d7489785"); - -DevicePluginMockDevice::DevicePluginMockDevice() -{ -} - -QList DevicePluginMockDevice::supportedDevices() const -{ - QList ret; - - DeviceClass deviceClassMockWifiDetector(pluginId(), mockWifiDetectorId); - deviceClassMockWifiDetector.setName("Mock WiFi Device"); - - QVariantList detectorParams; - QVariantMap macParam; - macParam.insert("name", "mac"); - macParam.insert("type", "string"); - detectorParams.append(macParam); - - deviceClassMockWifiDetector.setParams(detectorParams); - - QList detectorStates; - - StateType inRangeState(inRangeStateTypeId); - inRangeState.setName("inRange"); - inRangeState.setType(QVariant::Bool); - inRangeState.setDefaultValue(false); - detectorStates.append(inRangeState); - - deviceClassMockWifiDetector.setStates(detectorStates); - - QList detectorEvents; - - QVariantList detectorEventParams; - QVariantMap paramInRange; - paramInRange.insert("name", "inRange"); - paramInRange.insert("type", "bool"); - detectorEventParams.append(paramInRange); - - EventType inRangeEvent(inRangeEventTypeId); - inRangeEvent.setName("inRange"); - inRangeEvent.setParameters(detectorEventParams); - detectorEvents.append(inRangeEvent); - - deviceClassMockWifiDetector.setEvents(detectorEvents); - ret.append(deviceClassMockWifiDetector); - - return ret; -} - -DeviceManager::HardwareResources DevicePluginMockDevice::requiredHardware() const -{ - return DeviceManager::HardwareResourceTimer; -} - -QString DevicePluginMockDevice::pluginName() const -{ - return "WiFi Detector"; -} - -QUuid DevicePluginMockDevice::pluginId() const -{ - return pluginUuid; -} - -void DevicePluginMockDevice::guhTimer() -{ -} - diff --git a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.h b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.h deleted file mode 100644 index a3701deb..00000000 --- a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** - * * - * This file is part of guh. * - * * - * Guh is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, version 2 of the License. * - * * - * Guh is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with guh. If not, see . * - * * - ***************************************************************************/ - -#ifndef DEVICEPLUGINMOCKDEVICE_H -#define DEVICEPLUGINMOCKDEVICE_H - -#include "deviceplugin.h" - -class DevicePluginMockDevice: public DevicePlugin -{ - Q_OBJECT - - Q_PLUGIN_METADATA(IID "org.guh.DevicePlugin" FILE "devicepluginmockdevice.json") - Q_INTERFACES(DevicePlugin) - -public: - explicit DevicePluginMockDevice(); - - QList supportedDevices() const override; - DeviceManager::HardwareResources requiredHardware() const override; - - QString pluginName() const override; - QUuid pluginId() const override; - - void guhTimer() override; - -}; - -#endif // DEVICEPLUGINMOCKDEVICE_H diff --git a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.json b/tests/mocks/mockdeviceplugin/devicepluginmockdevice.json deleted file mode 100644 index 0967ef42..00000000 --- a/tests/mocks/mockdeviceplugin/devicepluginmockdevice.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/mocks/mockdeviceplugin/mockdeviceplugin.pro b/tests/mocks/mockdeviceplugin/mockdeviceplugin.pro deleted file mode 100644 index e9da6a4e..00000000 --- a/tests/mocks/mockdeviceplugin/mockdeviceplugin.pro +++ /dev/null @@ -1,9 +0,0 @@ -include($$top_srcdir/plugins/plugins.pri) - -TARGET = $$qtLibraryTarget(guh_devicepluginmockdevice) - -SOURCES += \ - devicepluginmockdevice.cpp - -HEADERS += \ - devicepluginmockdevice.h diff --git a/tests/mocks/mocks.pro b/tests/mocks/mocks.pro deleted file mode 100644 index 733c0137..00000000 --- a/tests/mocks/mocks.pro +++ /dev/null @@ -1,2 +0,0 @@ -TEMPLATE = subdirs -SUBDIRS += mockdeviceplugin diff --git a/tests/tests.pro b/tests/tests.pro index 958dd618..7fbc8a94 100644 --- a/tests/tests.pro +++ b/tests/tests.pro @@ -1,4 +1,2 @@ TEMPLATE = subdirs -SUBDIRS = mocks auto - -auto.depens = mocks +SUBDIRS = auto