diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt index ac9b2df08..87338ae6c 100644 --- a/src/libcalamares/CMakeLists.txt +++ b/src/libcalamares/CMakeLists.txt @@ -197,6 +197,16 @@ if ( ECM_FOUND AND BUILD_TESTING ) Qt5::Test ) calamares_automoc( libcalamareslocaletest ) + + ecm_add_test( + network/Tests.cpp + TEST_NAME + libcalamaresnetworktest + LINK_LIBRARIES + calamares + Qt5::Test + ) + calamares_automoc( libcalamaresnetworktest ) endif() if( BUILD_TESTING ) diff --git a/src/libcalamares/network/Tests.cpp b/src/libcalamares/network/Tests.cpp new file mode 100644 index 000000000..a13a74c86 --- /dev/null +++ b/src/libcalamares/network/Tests.cpp @@ -0,0 +1,43 @@ +/* === This file is part of Calamares - === + * + * Copyright 2019, Adriaan de Groot + * + * Calamares 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, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares 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 Calamares. If not, see . + */ + +#include "Tests.h" + +#include "Manager.h" + +#include + +QTEST_GUILESS_MAIN( NetworkTests ) + +NetworkTests::NetworkTests() +{ +} + +NetworkTests::~NetworkTests() +{ +} + +void NetworkTests::initTestCase() +{ +} + +void NetworkTests::testInstance() +{ + auto& nam = CalamaresUtils::Network::Manager::instance(); + QVERIFY( !nam.hasInternet() ); +} diff --git a/src/libcalamares/network/Tests.h b/src/libcalamares/network/Tests.h new file mode 100644 index 000000000..56f87cc67 --- /dev/null +++ b/src/libcalamares/network/Tests.h @@ -0,0 +1,37 @@ +/* === This file is part of Calamares - === + * + * Copyright 2019, Adriaan de Groot + * + * Calamares 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, either version 3 of the License, or + * (at your option) any later version. + * + * Calamares 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 Calamares. If not, see . + */ + +#ifndef LIBCALAMARES_NETWORK_TESTS_H +#define LIBCALAMARES_NETWORK_TESTS_H + +#include + +class NetworkTests : public QObject +{ + Q_OBJECT +public: + NetworkTests(); + ~NetworkTests() override; + +private Q_SLOTS: + void initTestCase(); + + void testInstance(); +}; + +#endif