#include <QApplication>
#include <gtest/gtest.h>

#include "../plugin/common.h"
#include "../plugin/devicemanager.h"
#include "../plugin/devicemonitor.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //common
    EXPECT_TRUE(env::isWayland());
    EXPECT_TRUE(env::isTabletMode());

    //DeviceManager
    QList<Device> outputDeviceList = DeviceManager::getInstance()->getOutputDevices();
    QList<Device> inputDeviceList = DeviceManager::getInstance()->getTouchDevices();
    EXPECT_FALSE(outputDeviceList.isEmpty());
    EXPECT_FALSE(inputDeviceList.isEmpty());

    if (!outputDeviceList.isEmpty() && !inputDeviceList.isEmpty()) {
        EXPECT_TRUE(DeviceManager::getInstance()->isPrimaryOutput(outputDeviceList.at(0).deviceId));

        EXPECT_FALSE(DeviceManager::getInstance()->getInputName(inputDeviceList.at(0).deviceId).isEmpty());
        EXPECT_FALSE(DeviceManager::getInstance()->getInputProductId(inputDeviceList.at(0).deviceId).isEmpty());
        EXPECT_FALSE(DeviceManager::getInstance()->getInputSerial(inputDeviceList.at(0).deviceId).isEmpty());

        DeviceManager::getInstance()->mapToOutput(inputDeviceList.at(0).deviceId, outputDeviceList.at(0).name);
    }

    //DeviceMonitor

    EXPECT_FALSE(DeviceMonitor::getInstance() == nullptr);

    return 0;
}
