diff --git a/src/bugzillaintegration/libbugzilla/clients/commands/newbug.cpp b/src/bugzillaintegration/libbugzilla/clients/commands/newbug.cpp index b456348a..e683e123 100644 --- a/src/bugzillaintegration/libbugzilla/clients/commands/newbug.cpp +++ b/src/bugzillaintegration/libbugzilla/clients/commands/newbug.cpp @@ -1,37 +1,42 @@ /* Copyright 2019 Harald Sitter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include "newbug.h" #include namespace Bugzilla { +NewBug::NewBug(QObject *parent) + : JsonCommand(parent) +{ +} + NewBug::NewBug(const NewBug &other) : JsonCommand(other.parent()) { const auto propertyCount = staticMetaObject.propertyCount(); for (int i = 0; i < propertyCount; ++i) { const auto property = staticMetaObject.property(i); property.write(this, property.read(&other)); } } } // namespace Bugzilla diff --git a/src/bugzillaintegration/libbugzilla/clients/commands/newbug.h b/src/bugzillaintegration/libbugzilla/clients/commands/newbug.h index 56a8a8fb..abfb5e97 100644 --- a/src/bugzillaintegration/libbugzilla/clients/commands/newbug.h +++ b/src/bugzillaintegration/libbugzilla/clients/commands/newbug.h @@ -1,48 +1,49 @@ /* Copyright 2019 Harald Sitter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #ifndef NEWBUG_H #define NEWBUG_H #include "jsoncommand.h" namespace Bugzilla { class NewBug : public JsonCommand { Q_OBJECT BUGZILLA_MEMBER_PROPERTY(QString, product); BUGZILLA_MEMBER_PROPERTY(QString, component); BUGZILLA_MEMBER_PROPERTY(QString, summary); // aka shortdesc BUGZILLA_MEMBER_PROPERTY(QString, version); BUGZILLA_MEMBER_PROPERTY(QString, description); BUGZILLA_MEMBER_PROPERTY(QString, op_sys); BUGZILLA_MEMBER_PROPERTY(QString, platform); BUGZILLA_MEMBER_PROPERTY(QString, priority); BUGZILLA_MEMBER_PROPERTY(QString, severity); BUGZILLA_MEMBER_PROPERTY(QStringList, keywords); // not documented but also supported public: - using JsonCommand::JsonCommand; + // only needed because we impl the copy ctor, otherwise this could be `using` + explicit NewBug(QObject *parent = nullptr); NewBug(const NewBug &other); }; } // namespace Bugzilla #endif // NEWBUG_H diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 4b0741c7..c8848957 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,66 +1,68 @@ if(NOT BUILD_TESTING) # Skip everything. Particularly trying to look for integration test deps. return() endif() remove_definitions(-DQT_NO_CAST_FROM_ASCII) find_package(Qt5Test ${REQUIRED_QT_VERSION} CONFIG REQUIRED) # Test helper for systeminformationtest -add_executable(lsb_release lsb_release_double.c) +if(HAVE_UNAME) + add_executable(lsb_release lsb_release_double.c) -ecm_add_tests( - systeminformationtest - LINK_LIBRARIES - Qt5::Core - Qt5::Test - DrKonqiInternal -) + ecm_add_tests( + systeminformationtest + LINK_LIBRARIES + Qt5::Core + Qt5::Test + DrKonqiInternal + ) +endif() add_subdirectory(crashtest) add_subdirectory(backtraceparsertest) add_subdirectory(bugzillalibtest) if(NOT APPLE) if(NOT RUBY_EXECTUABLE) find_program(RUBY_EXECUTABLE ruby) endif() if(RUBY_EXECUTABLE) execute_process(COMMAND ${RUBY_EXECUTABLE} -e "require 'atspi'" RESULT_VARIABLE RUBY_ATSPI) endif() if(NOT GDB_EXECUTABLE) # Needed so drkonqi can actually trace something. find_program(GDB_EXECUTABLE gdb) endif() if(NOT XVFB_RUN_EXECTUABLE) find_program(XVFB_RUN_EXECTUABLE xvfb-run) endif() set(ATSPI_PATHS /usr/lib/at-spi2-core/ # debians /usr/lib/at-spi2/ # suses ) if(NOT ATSPI_BUS_LAUNCHER_EXECUTABLE) find_program(ATSPI_BUS_LAUNCHER_EXECUTABLE NAMES at-spi-bus-launcher PATHS ${ATSPI_PATHS} DOC "AT-SPI accessibility dbus launcher") endif() if(NOT ATSPI_REGISTRYD_EXECUTABLE) find_program(ATSPI_REGISTRYD_EXECUTABLE NAMES at-spi2-registryd PATHS ${ATSPI_PATHS} DOC "AT-SPI accessibility registry daemon") endif() if(RUBY_EXECUTABLE AND XVFB_RUN_EXECTUABLE AND ATSPI_BUS_LAUNCHER_EXECUTABLE AND ATSPI_REGISTRYD_EXECUTABLE AND GDB_EXECUTABLE AND RUBY_ATSPI EQUAL 0) set(WITH_DRKONI_INTEGRATION_TESTING TRUE) add_subdirectory(integration) endif() add_feature_info(DrKonqiIntegrationTesting WITH_DRKONI_INTEGRATION_TESTING "Needs Ruby, functional atspi gem, gdb, as well as xvfb-run.") endif() diff --git a/src/tests/systeminformationtest.cpp b/src/tests/systeminformationtest.cpp index 168d7e44..0f5f23d2 100644 --- a/src/tests/systeminformationtest.cpp +++ b/src/tests/systeminformationtest.cpp @@ -1,97 +1,92 @@ /* Copyright 2019 Harald Sitter This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) version 3, or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 6 of version 3 of the license. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library. If not, see . */ #include #include #include -#if HAVE_UNAME -# include -# include -#endif +#include +#include #include class SystemInformationTest : public QObject { Q_OBJECT private Q_SLOTS: - -#if HAVE_UNAME static int uname(utsname *buf) { strcpy(buf->sysname, "FreeBSD"); strcpy(buf->release, "1.0.0"); strcpy(buf->machine, "x86_64"); return 0; } -#endif void initTestCase() { } // NOTE: bugzillaOperatingSystem is not tested anywhere because it is based // on the compilation platform and testing it fairly moot because of that void testLsb() { SystemInformation::Config config; config.basicOperatingSystem = "Linux"; // other parts getting filled depends on OS config.lsbReleasePath = QFINDTESTDATA("lsb_release"); // double binary config.osReleasePath.clear(); config.unameFunc = (void *) &uname; SystemInformation info(config); QTRY_VERIFY(info.complete()); QCOMPARE(info.bugzillaPlatform(), "openSUSE RPMs"); QCOMPARE(info.operatingSystem(), "FreeBSD 1.0.0 x86_64"); QCOMPARE(info.distributionPrettyName(), "KDE SUSE User Edition 5.16"); QCOMPARE(info.compiledSources(), false); QCOMPARE(info.qtVersion(), qVersion()); QCOMPARE(info.frameworksVersion(), KCoreAddons::versionString()); } void testOsRelease() { SystemInformation::Config config; config.basicOperatingSystem = "Linux"; // other parts getting filled depends on OS config.lsbReleasePath.clear(); config.osReleasePath = QFINDTESTDATA("data/os-release"); // fixture config.unameFunc = (void *) &uname; SystemInformation info(config); QTRY_VERIFY(info.complete()); QCOMPARE(info.bugzillaPlatform(), "FreeBSD Ports"); QCOMPARE(info.operatingSystem(), "FreeBSD 1.0.0 x86_64"); QCOMPARE(info.distributionPrettyName(), "FreeBSD #1"); QCOMPARE(info.compiledSources(), false); QCOMPARE(info.qtVersion(), qVersion()); QCOMPARE(info.frameworksVersion(), KCoreAddons::versionString()); } }; QTEST_GUILESS_MAIN(SystemInformationTest) #include "systeminformationtest.moc"